From 3552c268b44ca9ea4677a0d15075bb5fbe0e5323 Mon Sep 17 00:00:00 2001 From: Will McGinty Date: Tue, 21 Mar 2023 19:06:06 -0500 Subject: [PATCH] Fix a few small issues in backend code --- .../Sources/BackendApp/Model/Authentication/User/User.swift | 3 ++- Backend/Tests/BackendAppTests/AppTests.swift | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Backend/Sources/BackendApp/Model/Authentication/User/User.swift b/Backend/Sources/BackendApp/Model/Authentication/User/User.swift index 6745a35..18b862a 100644 --- a/Backend/Sources/BackendApp/Model/Authentication/User/User.swift +++ b/Backend/Sources/BackendApp/Model/Authentication/User/User.swift @@ -57,6 +57,7 @@ extension User { .field("email", .string, .required) .unique(on: "email") .field("password", .string, .required) + .field("social_id", .string) .create() } @@ -85,7 +86,7 @@ extension User { } static func uniqueness(forEmail email: String, on request: Request) async throws -> Bool { - return try await User.isExisting(matching: \.$email == email, on: request.db) + return try await !User.isExisting(matching: \.$email == email, on: request.db) } static func ensureUniqueness(for registrant: User, on request: Request) async throws { diff --git a/Backend/Tests/BackendAppTests/AppTests.swift b/Backend/Tests/BackendAppTests/AppTests.swift index cfce2e4..d868cae 100755 --- a/Backend/Tests/BackendAppTests/AppTests.swift +++ b/Backend/Tests/BackendAppTests/AppTests.swift @@ -1,4 +1,4 @@ -import App +import BackendApp import Dispatch import XCTest