refactor(nestjs): Implement users module

This commit is contained in:
Ahmed Bouhuolia
2025-05-20 17:55:58 +02:00
parent ce058b9416
commit 99fe5a6b0d
48 changed files with 1823 additions and 207 deletions

View File

@@ -0,0 +1,35 @@
import moment from 'moment';
import { BaseModel } from '@/models/Model';
export class UserInvite extends BaseModel {
token!: string;
userId!: number;
tenantId!: number;
email!: string;
/**
* Table name.
*/
static get tableName() {
return 'user_invites';
}
/**
* Timestamps columns.
*/
get timestamps() {
return ['createdAt'];
}
/**
* Model modifiers.
*/
static get modifiers() {
return {
notExpired(query) {
const comp = moment().subtract(24, 'hours').toMySqlDateTime();
query.where('created_at', '>=', comp);
},
};
}
}