Restructuring the folders (#1)

Co-authored-by: mifi <badmf@mifi.dev>
Reviewed-on: #1
This commit was merged in pull request #1.
This commit is contained in:
2023-05-24 16:48:47 +00:00
parent d3210b73c9
commit 88562d01cd
44 changed files with 1611 additions and 466 deletions

15
src/api/deleteStrategy.ts Normal file
View File

@@ -0,0 +1,15 @@
import { StringSchemaDefinition } from 'mongoose';
import { Auth, Strategy } from '..';
export const deleteStrategy = async (id: StringSchemaDefinition) => {
const strategy = await Strategy.findById(id);
if (strategy) {
const parentId = strategy.parent;
await strategy.deleteOne();
await Auth.findOneAndUpdate({ id: parentId, strategies: { $pull: id } });
return true;
}
return false;
};