diff --git a/src/controller/account.ts b/src/controller/account.ts index caed0ab..bd678cf 100644 --- a/src/controller/account.ts +++ b/src/controller/account.ts @@ -59,4 +59,13 @@ export const updateTOTP = async (id: ObjectId | undefined, status: boolean) => { }; await Account.findByIdAndUpdate(id, { totpEnabled: status }); -}; \ No newline at end of file +}; + +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}; +} \ No newline at end of file