Add UserEmail.getMainFromUser
This commit is contained in:
parent
b13d70bfc0
commit
49fc92df5c
@ -10,6 +10,11 @@ export default class UserEmail extends Model {
|
||||
return emails.length > 0 ? emails[0] : null;
|
||||
}
|
||||
|
||||
public static async getMainFromUser(userID: number): Promise<UserEmail | null> {
|
||||
const emails = await this.models<UserEmail>(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;
|
||||
|
Loading…
Reference in New Issue
Block a user