diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2018-03-09 18:11:10 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2018-03-09 18:11:10 +0900 |
| commit | 910ccf1804033a940a36273e21d4a586a26a6145 (patch) | |
| tree | 8ed2d2351216d79a812aba65646c307c422f14cc /src/api/models | |
| parent | v4046 (diff) | |
| download | sharkey-910ccf1804033a940a36273e21d4a586a26a6145.tar.gz sharkey-910ccf1804033a940a36273e21d4a586a26a6145.tar.bz2 sharkey-910ccf1804033a940a36273e21d4a586a26a6145.zip | |
なんかもうめっちゃ変えた
Diffstat (limited to 'src/api/models')
| -rw-r--r-- | src/api/models/othello-game.ts | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/api/models/othello-game.ts b/src/api/models/othello-game.ts index de7c804c46..7ae48b8aab 100644 --- a/src/api/models/othello-game.ts +++ b/src/api/models/othello-game.ts @@ -28,7 +28,7 @@ export interface IGame { winner_id: mongo.ObjectID; logs: any[]; settings: { - map: Map; + map: string[]; bw: string | number; is_llotheo: boolean; }; @@ -39,8 +39,15 @@ export interface IGame { */ export const pack = ( game: any, - me?: string | mongo.ObjectID | IUser + me?: string | mongo.ObjectID | IUser, + options?: { + detail?: boolean + } ) => new Promise<any>(async (resolve, reject) => { + const opts = Object.assign({ + detail: true + }, options); + let _game: any; // Populate the game if 'game' is ID @@ -69,6 +76,11 @@ export const pack = ( _game.id = _game._id; delete _game._id; + if (opts.detail === false) { + delete _game.logs; + delete _game.settings.map; + } + // Populate user _game.user1 = await packUser(_game.user1_id, meId); _game.user2 = await packUser(_game.user2_id, meId); |