mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-05-23 01:44:10 +02:00
wip
This commit is contained in:
@@ -7,32 +7,26 @@ import { Inject, Injectable } from '@nestjs/common';
|
||||
import * as Redis from 'ioredis';
|
||||
import { In } from 'typeorm';
|
||||
import { ModuleRef } from '@nestjs/core';
|
||||
import * as Reversi from 'misskey-reversi';
|
||||
import type {
|
||||
MiReversiGame,
|
||||
MiRole,
|
||||
MiRoleAssignment,
|
||||
ReversiGamesRepository,
|
||||
ReversiMatchingsRepository,
|
||||
RoleAssignmentsRepository,
|
||||
RolesRepository,
|
||||
UsersRepository,
|
||||
} from '@/models/_.js';
|
||||
import { MemoryKVCache, MemorySingleCache } from '@/misc/cache.js';
|
||||
import type { MiUser } from '@/models/User.js';
|
||||
import { DI } from '@/di-symbols.js';
|
||||
import { bindThis } from '@/decorators.js';
|
||||
import { MetaService } from '@/core/MetaService.js';
|
||||
import { CacheService } from '@/core/CacheService.js';
|
||||
import type { RoleCondFormulaValue } from '@/models/Role.js';
|
||||
import { UserEntityService } from '@/core/entities/UserEntityService.js';
|
||||
import type { GlobalEvents } from '@/core/GlobalEventService.js';
|
||||
import { GlobalEventService } from '@/core/GlobalEventService.js';
|
||||
import { IdService } from '@/core/IdService.js';
|
||||
import { ModerationLogService } from '@/core/ModerationLogService.js';
|
||||
import type { Packed } from '@/misc/json-schema.js';
|
||||
import { FanoutTimelineService } from '@/core/FanoutTimelineService.js';
|
||||
import { NotificationService } from '@/core/NotificationService.js';
|
||||
import { ReversiMatchingEntityService } from '@/core/entities/ReversiMatchingEntityService.js';
|
||||
import { ReversiGameEntityService } from './entities/ReversiGameEntityService.js';
|
||||
import type { OnApplicationShutdown, OnModuleInit } from '@nestjs/common';
|
||||
|
||||
@Injectable()
|
||||
@@ -64,6 +58,7 @@ export class ReversiService implements OnApplicationShutdown, OnModuleInit {
|
||||
private cacheService: CacheService,
|
||||
private userEntityService: UserEntityService,
|
||||
private globalEventService: GlobalEventService,
|
||||
private reversiGameEntityService: ReversiGameEntityService,
|
||||
private reversiMatchingsEntityService: ReversiMatchingEntityService,
|
||||
private idService: IdService,
|
||||
) {
|
||||
@@ -96,18 +91,18 @@ export class ReversiService implements OnApplicationShutdown, OnModuleInit {
|
||||
isStarted: false,
|
||||
isEnded: false,
|
||||
logs: [],
|
||||
map: eighteight.data,
|
||||
map: Reversi.maps.eighteight.data,
|
||||
bw: 'random',
|
||||
isLlotheo: false,
|
||||
}).then(x => this.reversiGamesRepository.findOneByOrFail(x.identifiers[0]));
|
||||
|
||||
publishReversiStream(exist.parentId, 'matched', await ReversiGames.pack(game, { id: exist.parentId }));
|
||||
publishReversiStream(exist.parentId, 'matched', await this.reversiGameEntityService.pack(game, { id: exist.parentId }));
|
||||
|
||||
const other = await this.reversiMatchingsRepository.countBy({
|
||||
childId: me.id,
|
||||
});
|
||||
|
||||
if (other == 0) {
|
||||
if (other === 0) {
|
||||
publishMainStream(me.id, 'reversiNoInvites');
|
||||
}
|
||||
|
||||
@@ -133,6 +128,18 @@ export class ReversiService implements OnApplicationShutdown, OnModuleInit {
|
||||
}
|
||||
}
|
||||
|
||||
@bindThis
|
||||
public async matchCancel(user: MiUser) {
|
||||
await this.reversiMatchingsRepository.delete({
|
||||
parentId: user.id,
|
||||
});
|
||||
}
|
||||
|
||||
@bindThis
|
||||
public async get(id: MiReversiGame['id']) {
|
||||
return this.reversiGamesRepository.findOneBy({ id });
|
||||
}
|
||||
|
||||
@bindThis
|
||||
public dispose(): void {
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user