From b84c2cdff1fde57d85a220bbeb0f76b2694f9093 Mon Sep 17 00:00:00 2001 From: Alice Gaudon Date: Sun, 6 Sep 2020 10:47:24 +0200 Subject: [PATCH] Code formatting and cleanup --- src/auth/magic_link/MagicLinkAuthController.ts | 1 - src/auth/magic_link/MagicLinkController.ts | 1 - src/auth/models/MagicLink.ts | 5 ----- src/auth/models/User.ts | 4 ---- src/auth/models/UserEmail.ts | 4 ---- src/db/ModelQuery.ts | 2 +- 6 files changed, 1 insertion(+), 16 deletions(-) diff --git a/src/auth/magic_link/MagicLinkAuthController.ts b/src/auth/magic_link/MagicLinkAuthController.ts index 209ef30..7602514 100644 --- a/src/auth/magic_link/MagicLinkAuthController.ts +++ b/src/auth/magic_link/MagicLinkAuthController.ts @@ -8,7 +8,6 @@ import {MailTemplate} from "../../Mail"; import {AuthError, PendingApprovalAuthError, RegisterCallback} from "../AuthGuard"; import geoip from "geoip-lite"; import AuthController from "../AuthController"; -import NunjucksComponent from "../../components/NunjucksComponent"; import RedirectBackComponent from "../../components/RedirectBackComponent"; diff --git a/src/auth/magic_link/MagicLinkController.ts b/src/auth/magic_link/MagicLinkController.ts index 0aa6643..e55881a 100644 --- a/src/auth/magic_link/MagicLinkController.ts +++ b/src/auth/magic_link/MagicLinkController.ts @@ -6,7 +6,6 @@ import Throttler from "../../Throttler"; import Mail, {MailTemplate} from "../../Mail"; import MagicLink from "../models/MagicLink"; import config from "config"; -import ModelFactory from "../../db/ModelFactory"; export default abstract class MagicLinkController extends Controller { public static async sendMagicLink(sessionID: string, actionType: string, original_url: string, email: string, mailTemplate: MailTemplate, data: object): Promise { diff --git a/src/auth/models/MagicLink.ts b/src/auth/models/MagicLink.ts index c82b382..6fa4460 100644 --- a/src/auth/models/MagicLink.ts +++ b/src/auth/models/MagicLink.ts @@ -6,7 +6,6 @@ import User from "./User"; import argon2 from "argon2"; import {WhereTest} from "../../db/ModelQuery"; import UserEmail from "./UserEmail"; -import ModelFactory from "../../db/ModelFactory"; import {EMAIL_REGEX} from "../../db/Validator"; export default class MagicLink extends Model implements AuthProof { @@ -35,10 +34,6 @@ export default class MagicLink extends Model implements AuthProof { private generated_at?: Date = undefined; private authorized: boolean = false; - constructor(factory: ModelFactory) { - super(factory); - } - protected init(): void { this.setValidation('session_id').defined().length(32).unique(this); this.setValidation('email').defined().regexp(EMAIL_REGEX); diff --git a/src/auth/models/User.ts b/src/auth/models/User.ts index 33415fc..d53485c 100644 --- a/src/auth/models/User.ts +++ b/src/auth/models/User.ts @@ -25,10 +25,6 @@ export default class User extends Model { public readonly mainEmail = this.emails.cloneReduceToOne().constraint(q => q.where('id', this.main_email_id)); - public constructor(factory: ModelFactory) { - super(factory); - } - protected init(): void { this.setValidation('name').acceptUndefined().between(3, 64); this.setValidation('main_email_id').acceptUndefined().exists(UserEmail, 'id'); diff --git a/src/auth/models/UserEmail.ts b/src/auth/models/UserEmail.ts index 3da41e3..0833e52 100644 --- a/src/auth/models/UserEmail.ts +++ b/src/auth/models/UserEmail.ts @@ -15,10 +15,6 @@ export default class UserEmail extends Model { foreignKey: 'id' }); - constructor(factory: ModelFactory) { - super(factory); - } - protected init(): void { this.setValidation('user_id').acceptUndefined().exists(User, 'id'); this.setValidation('email').defined().regexp(EMAIL_REGEX).unique(this); diff --git a/src/db/ModelQuery.ts b/src/db/ModelQuery.ts index e2211a2..28f8250 100644 --- a/src/db/ModelQuery.ts +++ b/src/db/ModelQuery.ts @@ -167,7 +167,7 @@ export default class ModelQuery implements WhereFieldConsumer