rename IDatabaseAccountDocument to IDatabaseAccountJson
This commit is contained in:
parent
7b38fd582c
commit
7e42a6237c
@ -7,7 +7,7 @@ import buildConfig from "@/static/data/buildConfig.json";
|
||||
import { toLoginRequest } from "@/src/helpers/loginHelpers";
|
||||
import { Account } from "@/src/models/loginModel";
|
||||
import { createAccount, isCorrectPassword } from "@/src/services/loginService";
|
||||
import { IDatabaseAccountDocument, ILoginResponse } from "@/src/types/loginTypes";
|
||||
import { IDatabaseAccountJson, ILoginResponse } from "@/src/types/loginTypes";
|
||||
import { DTLS, groups, HUB, platformCDNs } from "@/static/fixed_responses/login_static";
|
||||
import { logger } from "@/src/utils/logger";
|
||||
|
||||
@ -65,7 +65,7 @@ export const loginController: RequestHandler = async (request, response) => {
|
||||
response.json(createLoginResponse(account.toJSON(), buildLabel));
|
||||
};
|
||||
|
||||
const createLoginResponse = (account: IDatabaseAccountDocument, buildLabel: string): ILoginResponse => {
|
||||
const createLoginResponse = (account: IDatabaseAccountJson, buildLabel: string): ILoginResponse => {
|
||||
return {
|
||||
id: account.id,
|
||||
DisplayName: account.DisplayName,
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { IDatabaseAccountDocument } from "@/src/types/loginTypes";
|
||||
import { IDatabaseAccountJson } from "@/src/types/loginTypes";
|
||||
import { model, Schema, SchemaOptions } from "mongoose";
|
||||
|
||||
const opts = {
|
||||
@ -20,7 +20,7 @@ const opts = {
|
||||
// }
|
||||
// }
|
||||
|
||||
const databaseAccountSchema = new Schema<IDatabaseAccountDocument>(
|
||||
const databaseAccountSchema = new Schema<IDatabaseAccountJson>(
|
||||
{
|
||||
email: { type: String, required: true, unique: true },
|
||||
password: { type: String, required: true },
|
||||
@ -48,4 +48,4 @@ databaseAccountSchema.set("toJSON", {
|
||||
virtuals: true
|
||||
});
|
||||
|
||||
export const Account = model<IDatabaseAccountDocument>("Account", databaseAccountSchema);
|
||||
export const Account = model<IDatabaseAccountJson>("Account", databaseAccountSchema);
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { Account } from "@/src/models/loginModel";
|
||||
import { createInventory } from "@/src/services/inventoryService";
|
||||
import { IDatabaseAccount, IDatabaseAccountDocument } from "@/src/types/loginTypes";
|
||||
import { IDatabaseAccount, IDatabaseAccountJson } from "@/src/types/loginTypes";
|
||||
import { createShip } from "./shipService";
|
||||
import { Types } from "mongoose";
|
||||
import { Loadout } from "@/src/models/inventoryModels/loadoutModel";
|
||||
@ -12,7 +12,7 @@ export const isCorrectPassword = (requestPassword: string, databasePassword: str
|
||||
return requestPassword === databasePassword;
|
||||
};
|
||||
|
||||
export const createAccount = async (accountData: IDatabaseAccount): Promise<IDatabaseAccountDocument> => {
|
||||
export const createAccount = async (accountData: IDatabaseAccount): Promise<IDatabaseAccountJson> => {
|
||||
const account = new Account(accountData);
|
||||
try {
|
||||
await account.save();
|
||||
|
@ -24,7 +24,7 @@ export interface ILoginResponse extends IAccountAndLoginResponseCommons {
|
||||
}
|
||||
|
||||
// Includes virtual ID
|
||||
export interface IDatabaseAccountDocument extends IDatabaseAccount {
|
||||
export interface IDatabaseAccountJson extends IDatabaseAccount {
|
||||
id: string;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user