Restructuring the folders
Some checks failed
continuous-integration/drone/pr Build is failing

This commit is contained in:
2023-05-24 10:24:15 -04:00
parent d3210b73c9
commit 7619899edc
38 changed files with 42 additions and 7 deletions

15
src/dao/deleteById.ts Normal file
View File

@@ -0,0 +1,15 @@
import { StringSchemaDefinition } from 'mongoose';
import { Auth, Log, Strategy, Token } from '..';
import { Status } from '../constants/auth';
import { Action } from '../constants/action';
export const deleteById = async (id: StringSchemaDefinition) => {
if (await Auth.findByIdAndUpdate(id, { status: Status.DELETED, strategies: [] }).catch()) {
await Strategy.deleteMany({ parent: id });
await Token.deleteMany({ auth: id });
Log.add(id, Action.DELETE);
return true;
}
return false;
};