@tomei/sso
Version:
Tomei SSO Package
40 lines (35 loc) • 1.05 kB
text/typescript
import { RepositoryBase, IRepositoryBase } from '@tomei/general';
import UserPasswordHistoryModel from '../../models/user-password-history';
import { Op } from 'sequelize';
export class UserPasswordHistoryRepository
extends RepositoryBase<UserPasswordHistoryModel>
implements IRepositoryBase<UserPasswordHistoryModel>
{
constructor() {
super(UserPasswordHistoryModel);
}
async findByPk(id: string, options?: any): Promise<UserPasswordHistoryModel> {
return await UserPasswordHistoryModel.findByPk(parseInt(id), options);
}
async destroy(HistoryId: number, dbTransaction: any): Promise<void> {
await UserPasswordHistoryModel.destroy({
where: {
HistoryId: HistoryId,
},
transaction: dbTransaction,
});
}
async destroyMultiple(
HistoryIdList: string[],
dbTransaction: any,
): Promise<void> {
await UserPasswordHistoryModel.destroy({
where: {
HistoryId: {
[Op.in]: HistoryIdList,
},
},
transaction: dbTransaction,
});
}
}