diff --git a/src/auth/models/UserEmail.ts b/src/auth/models/UserEmail.ts index 8ef284c..f037f2b 100644 --- a/src/auth/models/UserEmail.ts +++ b/src/auth/models/UserEmail.ts @@ -10,6 +10,11 @@ export default class UserEmail extends Model { return emails.length > 0 ? emails[0] : null; } + public static async getMainFromUser(userID: number): Promise { + const emails = await this.models(this.select().where('user_id', userID).where('main', 1)); + return emails.length > 0 ? emails[0] : null; + } + public user_id?: number; public email?: string; private main?: boolean;