File tree Expand file tree Collapse file tree 3 files changed +19
-6
lines changed
src/realms/rest/endpoints Expand file tree Collapse file tree 3 files changed +19
-6
lines changed Original file line number Diff line number Diff line change @@ -396,7 +396,10 @@ export default class PlayerController {
396
396
req . params . statKey ,
397
397
req . body . value ,
398
398
req . body . reason ,
399
- req . query . set
399
+ req . query . set ,
400
+ req . body . type ,
401
+ req . body . displayName ,
402
+ req . body . color
400
403
)
401
404
return reply . code ( 204 ) . send ( )
402
405
}
Original file line number Diff line number Diff line change 1
1
import { FastifySchema } from "fastify"
2
2
import { Static , Type } from "@sinclair/typebox"
3
3
import PlayerSchema from "../../schemas/Player.schema"
4
- import { ApiScope , ChatChannels } from "@prisma/client"
4
+ import { ApiScope , ChatChannels , StatisticType } from "@prisma/client"
5
5
import PermissionSchema from "../../schemas/Permission.schema"
6
6
import PermissionInputSchema from "../../schemas/PermissionInput.schema"
7
7
import PlayerStatisticRecordSchema from "../../schemas/PlayerStatisticRecord.schema"
@@ -382,7 +382,11 @@ export type PlayerStatParamsSchema = Static<typeof PlayerStatParamsSchema>
382
382
383
383
const PlayerStatManageBodySchema = Type . Object ( {
384
384
value : Type . Number ( ) ,
385
- reason : Type . Optional ( Type . String ( ) )
385
+ reason : Type . Optional ( Type . String ( ) ) ,
386
+
387
+ type : Type . Optional ( Type . Enum ( StatisticType ) ) ,
388
+ displayName : Type . Optional ( Type . String ( ) ) ,
389
+ color : Type . Optional ( Type . String ( ) )
386
390
} )
387
391
388
392
export type PlayerStatManageBodySchema = Static <
Original file line number Diff line number Diff line change @@ -681,8 +681,11 @@ export default class PlayerService {
681
681
key : string ,
682
682
value : number ,
683
683
reason : string ,
684
- set = false
685
- ) : Promise < void > {
684
+ set = false ,
685
+ type ?: StatisticType ,
686
+ displayName ?: string ,
687
+ color ?: string
688
+ ) {
686
689
let stat = await prisma . statistic . findUnique ( {
687
690
where : {
688
691
key
@@ -700,7 +703,10 @@ export default class PlayerService {
700
703
if ( ! stat ) {
701
704
stat = await prisma . statistic . create ( {
702
705
data : {
703
- key
706
+ key,
707
+ type,
708
+ displayName,
709
+ color
704
710
} ,
705
711
select : {
706
712
type : true ,
You can’t perform that action at this time.
0 commit comments