Created account.ts#getSimpleAccountObjectById
This commit is contained in:
parent
a45b419e9c
commit
c330d78fb3
@ -59,4 +59,13 @@ export const updateTOTP = async (id: ObjectId | undefined, status: boolean) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
await Account.findByIdAndUpdate(id, { totpEnabled: status });
|
await Account.findByIdAndUpdate(id, { totpEnabled: status });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const getSimpleAccountObjectById = async (id: string) => {
|
||||||
|
if (!Types.ObjectId.isValid(id)) return { code: 3, message: "Invalid object id provided" };
|
||||||
|
|
||||||
|
const account = await Account.findById(id);
|
||||||
|
if (account === null) return {};
|
||||||
|
|
||||||
|
return {id: account._id, username: account.username, email: account.email};
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user