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