rename accountId to ownerId
All checks were successful
Build / build (18) (push) Successful in 44s
Build / build (20) (push) Successful in 1m7s
Build / build (18) (pull_request) Successful in 46s
Build / build (22) (push) Successful in 1m11s
Build / build (20) (pull_request) Successful in 1m8s
Build / build (22) (pull_request) Successful in 40s
All checks were successful
Build / build (18) (push) Successful in 44s
Build / build (20) (push) Successful in 1m7s
Build / build (18) (pull_request) Successful in 46s
Build / build (22) (push) Successful in 1m11s
Build / build (20) (pull_request) Successful in 1m8s
Build / build (22) (pull_request) Successful in 40s
This commit is contained in:
parent
2fb2213c59
commit
8616af14d7
@ -18,7 +18,7 @@ export const deleteAccountController: RequestHandler = async (req, res) => {
|
||||
GuildMember.deleteMany({ accountId: accountId }),
|
||||
Inbox.deleteMany({ ownerId: accountId }),
|
||||
Inventory.deleteOne({ accountOwnerId: accountId }),
|
||||
Leaderboard.deleteMany({ accountId: accountId }),
|
||||
Leaderboard.deleteMany({ ownerId: accountId }),
|
||||
Loadout.deleteOne({ loadoutOwnerId: accountId }),
|
||||
PersonalRooms.deleteOne({ personalRoomsOwnerId: accountId }),
|
||||
Ship.deleteMany({ ShipOwnerId: accountId }),
|
||||
|
@ -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 }
|
||||
},
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user