rename accountId to ownerId
Some checks failed
Build / build (18) (push) Has been cancelled
Build / build (20) (push) Has been cancelled
Build / build (22) (push) Has been cancelled
Build / build (20) (pull_request) Successful in 40s
Build / build (18) (pull_request) Successful in 1m10s
Build / build (22) (pull_request) Successful in 1m14s

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

View File

@ -5,7 +5,7 @@ const leaderboardEntrySchema = new Schema<ILeaderboardEntryDatabase>(
{
leaderboard: { 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 },
expiry: { type: Date, required: true }
},

View File

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

View File

@ -2,7 +2,7 @@ import { Types } from "mongoose";
export interface ILeaderboardEntryDatabase {
leaderboard: string;
accountId: Types.ObjectId;
ownerId: Types.ObjectId;
displayName: string;
score: number;
expiry: Date;