enhance(reversi): tweak reversi

This commit is contained in:
syuilo
2024-01-21 10:07:43 +09:00
parent 576484835e
commit a17251d913
19 changed files with 395 additions and 135 deletions

View File

@@ -13,6 +13,12 @@ export class MiReversiGame {
})
public startedAt: Date | null;
@Column('timestamp with time zone', {
nullable: true,
comment: 'The ended date of the ReversiGame.',
})
public endedAt: Date | null;
@Column(id())
public user1Id: MiUser['id'];
@@ -71,7 +77,19 @@ export class MiReversiGame {
...id(),
nullable: true,
})
public surrendered: MiUser['id'] | null;
public surrenderedUserId: MiUser['id'] | null;
@Column({
...id(),
nullable: true,
})
public timeoutUserId: MiUser['id'] | null;
// in sec
@Column('smallint', {
default: 90,
})
public timeLimitForEachTurn: number;
@Column('jsonb', {
default: [],

View File

@@ -21,6 +21,11 @@ export const packedReversiGameLiteSchema = {
optional: false, nullable: true,
format: 'date-time',
},
endedAt: {
type: 'string',
optional: false, nullable: true,
format: 'date-time',
},
isStarted: {
type: 'boolean',
optional: false, nullable: false,
@@ -75,7 +80,12 @@ export const packedReversiGameLiteSchema = {
optional: false, nullable: true,
ref: 'User',
},
surrendered: {
surrenderedUserId: {
type: 'string',
optional: false, nullable: true,
format: 'id',
},
timeoutUserId: {
type: 'string',
optional: false, nullable: true,
format: 'id',
@@ -100,6 +110,10 @@ export const packedReversiGameLiteSchema = {
type: 'boolean',
optional: false, nullable: false,
},
timeLimitForEachTurn: {
type: 'number',
optional: false, nullable: false,
},
},
} as const;
@@ -121,6 +135,11 @@ export const packedReversiGameDetailedSchema = {
optional: false, nullable: true,
format: 'date-time',
},
endedAt: {
type: 'string',
optional: false, nullable: true,
format: 'date-time',
},
isStarted: {
type: 'boolean',
optional: false, nullable: false,
@@ -175,7 +194,12 @@ export const packedReversiGameDetailedSchema = {
optional: false, nullable: true,
ref: 'User',
},
surrendered: {
surrenderedUserId: {
type: 'string',
optional: false, nullable: true,
format: 'id',
},
timeoutUserId: {
type: 'string',
optional: false, nullable: true,
format: 'id',
@@ -200,6 +224,10 @@ export const packedReversiGameDetailedSchema = {
type: 'boolean',
optional: false, nullable: false,
},
timeLimitForEachTurn: {
type: 'number',
optional: false, nullable: false,
},
logs: {
type: 'array',
optional: false, nullable: false,