feat: Initial payment implementation
This commit is contained in:
36
packages/backend/src/models/usage-data.ee.ts
Normal file
36
packages/backend/src/models/usage-data.ee.ts
Normal 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;
|
Reference in New Issue
Block a user