rename accountId to ownerId
All checks were successful
Build / build (18) (push) Successful in 43s
Build / build (22) (push) Successful in 1m8s
Build / build (20) (push) Successful in 1m11s
Build / build (18) (pull_request) Successful in 44s
Build / build (20) (pull_request) Successful in 1m10s
Build / build (22) (pull_request) Successful in 1m13s

This commit is contained in:
Sainan 2025-03-24 22:19:54 +01:00
parent 2fb2213c59
commit e270ca2f84
4 changed files with 8 additions and 8 deletions

View File

@ -18,7 +18,7 @@ export const deleteAccountController: RequestHandler = async (req, res) => {
GuildMember.deleteMany({ accountId: accountId }), GuildMember.deleteMany({ accountId: accountId }),
Inbox.deleteMany({ ownerId: accountId }), Inbox.deleteMany({ ownerId: accountId }),
Inventory.deleteOne({ accountOwnerId: accountId }), Inventory.deleteOne({ accountOwnerId: accountId }),
Leaderboard.deleteMany({ accountId: accountId }), Leaderboard.deleteMany({ ownerId: accountId }),
Loadout.deleteOne({ loadoutOwnerId: accountId }), Loadout.deleteOne({ loadoutOwnerId: accountId }),
PersonalRooms.deleteOne({ personalRoomsOwnerId: accountId }), PersonalRooms.deleteOne({ personalRoomsOwnerId: accountId }),
Ship.deleteMany({ ShipOwnerId: accountId }), Ship.deleteMany({ ShipOwnerId: accountId }),

View File

@ -5,7 +5,7 @@ const leaderboardEntrySchema = new Schema<ILeaderboardEntryDatabase>(
{ {
leaderboard: { type: String, required: true }, leaderboard: { type: String, required: true },
displayName: { type: String, required: true }, displayName: { type: String, required: true },
accountId: { type: Schema.Types.ObjectId, required: true }, ownerId: { type: Schema.Types.ObjectId, required: true },
score: { type: Number, required: true }, score: { type: Number, required: true },
expiry: { type: Date, required: true } expiry: { type: Date, required: true }
}, },

View File

@ -3,7 +3,7 @@ import { ILeaderboardEntryClient } from "../types/leaderboardTypes";
export const submitLeaderboardScore = async ( export const submitLeaderboardScore = async (
leaderboard: string, leaderboard: string,
accountId: string, ownerId: string,
displayName: string, displayName: string,
score: number score: number
): Promise<void> => { ): Promise<void> => {
@ -21,7 +21,7 @@ export const submitLeaderboardScore = async (
} }
await Leaderboard.findOneAndUpdate( await Leaderboard.findOneAndUpdate(
{ leaderboard, displayName }, { leaderboard, displayName },
{ $max: { score }, $set: { accountId, expiry } }, { $max: { score }, $set: { ownerId, expiry } },
{ upsert: true } { upsert: true }
); );
}; };
@ -35,7 +35,7 @@ export const getLeaderboard = async (
let entries: TLeaderboardEntryDocument[]; let entries: TLeaderboardEntryDocument[];
let r: number; let r: number;
if (pivotId) { if (pivotId) {
const pivotDoc = await Leaderboard.findOne({ leaderboard, accountId: pivotId }); const pivotDoc = await Leaderboard.findOne({ leaderboard, ownerId: pivotId });
if (!pivotDoc) { if (!pivotDoc) {
return []; return [];
} }
@ -67,7 +67,7 @@ export const getLeaderboard = async (
const res: ILeaderboardEntryClient[] = []; const res: ILeaderboardEntryClient[] = [];
for (const entry of entries) { for (const entry of entries) {
res.push({ res.push({
_id: entry.accountId.toString(), _id: entry.ownerId.toString(),
s: entry.score, s: entry.score,
r: ++r, r: ++r,
n: entry.displayName n: entry.displayName

View File

@ -2,14 +2,14 @@ import { Types } from "mongoose";
export interface ILeaderboardEntryDatabase { export interface ILeaderboardEntryDatabase {
leaderboard: string; leaderboard: string;
accountId: Types.ObjectId;
displayName: string; displayName: string;
ownerId: Types.ObjectId;
score: number; score: number;
expiry: Date; expiry: Date;
} }
export interface ILeaderboardEntryClient { export interface ILeaderboardEntryClient {
_id: string; // player id _id: string; // owner id
s: number; // score s: number; // score
r: number; // rank r: number; // rank
n: string; // displayName n: string; // displayName