Skip to content

Commit

Permalink
fix code quality issues
Browse files Browse the repository at this point in the history
  • Loading branch information
u1-liquid committed Jan 22, 2024
1 parent 8aa7686 commit d8d2188
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 34 deletions.
13 changes: 2 additions & 11 deletions packages/backend/src/core/ReversiService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ import { IdService } from '@/core/IdService.js';
import { NotificationService } from '@/core/NotificationService.js';
import { Serialized } from '@/types.js';
import { ReversiGameEntityService } from './entities/ReversiGameEntityService.js';
import type { OnApplicationShutdown, OnModuleInit } from '@nestjs/common';
import type { OnModuleInit } from '@nestjs/common';

const MATCHING_TIMEOUT_MS = 1000 * 15; // 15sec

@Injectable()
export class ReversiService implements OnApplicationShutdown, OnModuleInit {
export class ReversiService implements OnModuleInit {
private notificationService: NotificationService;

constructor(
Expand Down Expand Up @@ -543,13 +543,4 @@ export class ReversiService implements OnApplicationShutdown, OnModuleInit {
return null;
}
}

@bindThis
public dispose(): void {
}

@bindThis
public onApplicationShutdown(signal?: string | undefined): void {
this.dispose();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ export class ReversiGameEntityService {
return await awaitAll({
id: game.id,
createdAt: game.createdAt.toISOString(),
startedAt: game.startedAt && game.startedAt.toISOString(),
endedAt: game.endedAt && game.endedAt.toISOString(),
startedAt: game.startedAt?.toISOString() ?? null,
endedAt: game.endedAt?.toISOString() ?? null,
isStarted: game.isStarted,
isEnded: game.isEnded,
form1: game.form1,
Expand Down Expand Up @@ -90,8 +90,8 @@ export class ReversiGameEntityService {
return await awaitAll({
id: game.id,
createdAt: game.createdAt.toISOString(),
startedAt: game.startedAt && game.startedAt.toISOString(),
endedAt: game.endedAt && game.endedAt.toISOString(),
startedAt: game.startedAt?.toISOString() ?? null,
endedAt: game.endedAt?.toISOString() ?? null,
isStarted: game.isStarted,
isEnded: game.isEnded,
user1Id: game.user1Id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
super(meta, paramDef, async (ps, me) => {
if (ps.userId) {
await this.reversiService.matchSpecificUserCancel(me, ps.userId);
return;
} else {
await this.reversiService.matchAnyUserCancel(me);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
* SPDX-License-Identifier: AGPL-3.0-only
*/

import { Inject, Injectable } from '@nestjs/common';
import { Injectable } from '@nestjs/common';
import { Endpoint } from '@/server/api/endpoint-base.js';
import { DI } from '@/di-symbols.js';
import { UserEntityService } from '@/core/entities/UserEntityService.js';
import { ReversiService } from '@/core/ReversiService.js';

Expand Down
11 changes: 0 additions & 11 deletions packages/backend/src/server/api/stream/channels/reversi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,6 @@ class ReversiChannel extends Channel {
public static requireCredential = true as const;
public static kind = 'read:account';

constructor(
id: string,
connection: Channel['connection'],
) {
super(id, connection);
}

@bindThis
public async init(params: any) {
this.subscriber.on(`reversiStream:${this.user!.id}`, this.send);
Expand All @@ -38,10 +31,6 @@ export class ReversiChannelService implements MiChannelService<true> {
public readonly requireCredential = ReversiChannel.requireCredential;
public readonly kind = ReversiChannel.kind;

constructor(
) {
}

@bindThis
public create(id: string, connection: Channel['connection']): ReversiChannel {
return new ReversiChannel(
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/src/components/MkTimeline.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { computed, watch, onUnmounted, provide, shallowRef } from 'vue';
import { Connection } from 'misskey-js/built/streaming.js';
import { Connection } from 'misskey-js/streaming.js';
import MkNotes from '@/components/MkNotes.vue';
import MkPullToRefresh from '@/components/MkPullToRefresh.vue';
import { useStream } from '@/stream.js';
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/src/pages/reversi/game.setting.vue
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template>

<script lang="ts" setup>
import { computed, watch, ref, onMounted, shallowRef, onUnmounted } from 'vue';
import { computed, watch, ref, onUnmounted } from 'vue';
import * as Misskey from 'misskey-js';
import * as Reversi from 'misskey-reversi';
import { i18n } from '@/i18n.js';
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/src/pages/reversi/game.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template>

<script lang="ts" setup>
import { computed, watch, ref, onMounted, shallowRef, onUnmounted } from 'vue';
import { computed, watch, onMounted, shallowRef, onUnmounted } from 'vue';
import * as Misskey from 'misskey-js';
import GameSetting from './game.setting.vue';
import GameBoard from './game.board.vue';
Expand Down
2 changes: 1 addition & 1 deletion packages/misskey-bubble-game/src/game.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ export class DropAndFusionGame extends EventEmitter<{
case 'square': return SQUARE_MONOS;
case 'sweets': return SWEETS_MONOS;
case 'space': return NORAML_MONOS;
default: throw new Error('unrecognized game mode');
}
}

Expand Down Expand Up @@ -302,7 +303,6 @@ export class DropAndFusionGame extends EventEmitter<{
this.gameOver();
break;
}
continue;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/misskey-js/src/entities.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ModerationLogPayloads } from './consts.js';
import { Announcement, EmojiDetailed, MeDetailed, MeDetailedOnly, Page, User, UserDetailed } from './autogen/models.js';
import { Announcement, EmojiDetailed, MeDetailed, Page, User, UserDetailed } from './autogen/models.js';

export * from './autogen/entities.js';
export * from './autogen/models.js';
Expand Down

0 comments on commit d8d2188

Please sign in to comment.