feat: Initial payment implementation

This commit is contained in:
Faruk AYDIN
2023-03-05 17:12:46 +01:00
parent 63f8fc266d
commit 5e18ef5830
10 changed files with 268 additions and 4 deletions

View File

@@ -0,0 +1,36 @@
import Base from './base';
import User from './user';
class UsageData extends Base {
id!: string;
userId!: string;
consumedTaskCount!: number;
nextResetAt!: string;
static tableName = 'usage_data';
static jsonSchema = {
type: 'object',
required: ['userId', 'consumedTaskCount', 'nextResetAt'],
properties: {
id: { type: 'string', format: 'uuid' },
userId: { type: 'string', format: 'uuid' },
consumedTaskCount: { type: 'integer' },
nextResetAt: { type: 'string' },
},
};
static relationMappings = () => ({
user: {
relation: Base.BelongsToOneRelation,
modelClass: User,
join: {
from: 'payment_plans.user_id',
to: 'users.id',
},
},
});
}
export default UsageData;