mirror of
https://github.com/Drop-OSS/drop.git
synced 2026-08-29 04:32:06 -04:00
chore: remove old playtime api
This commit is contained in:
parent
83a0ef2240
commit
fca85633c1
1 changed files with 0 additions and 50 deletions
|
|
@ -1,50 +0,0 @@
|
|||
import prisma from "../db/database";
|
||||
|
||||
class PlaytimeManager {
|
||||
/**
|
||||
* Get a user's playtime on a game
|
||||
* @param gameId
|
||||
* @param userId
|
||||
* @returns
|
||||
*/
|
||||
async get(gameId: string, userId: string) {
|
||||
return await prisma.playtime.findUnique({
|
||||
where: {
|
||||
gameId_userId: {
|
||||
gameId,
|
||||
userId,
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Add time to a user's playtime
|
||||
* @param gameId
|
||||
* @param userId
|
||||
* @param seconds seconds played
|
||||
*/
|
||||
async add(gameId: string, userId: string, seconds: number) {
|
||||
await prisma.playtime.upsert({
|
||||
where: {
|
||||
gameId_userId: {
|
||||
gameId,
|
||||
userId,
|
||||
},
|
||||
},
|
||||
create: {
|
||||
gameId,
|
||||
userId,
|
||||
seconds,
|
||||
},
|
||||
update: {
|
||||
seconds: {
|
||||
increment: seconds,
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export const playtimeManager = new PlaytimeManager();
|
||||
export default playtimeManager;
|
||||
Loading…
Add table
Add a link
Reference in a new issue