feat: 오픈 게임 취소와 유산 정산 경로 추가
별도 최고위험 권한으로 실행되는 원자적 취소 작업을 추가한다. 버려진 게임과 장수 기록의 보존·삭제 옵션, 오픈 원금 전액 환급 및 획득 포인트 보전율, 취소 상태와 관리자·과거기록 UI를 함께 반영한다.
This commit is contained in:
@@ -25,7 +25,11 @@ const auth: GameSessionTokenPayload = {
|
||||
sanctions: {},
|
||||
};
|
||||
|
||||
const context = (session: GameSessionTokenPayload | null, includeLegacy = false): GameApiContext => {
|
||||
const context = (
|
||||
session: GameSessionTokenPayload | null,
|
||||
includeLegacy = false,
|
||||
includeCancellation = false
|
||||
): GameApiContext => {
|
||||
const db = {
|
||||
$queryRaw: async (query: { strings?: readonly string[] }) => {
|
||||
if (!includeLegacy) return [];
|
||||
@@ -236,10 +240,27 @@ const context = (session: GameSessionTokenPayload | null, includeLegacy = false)
|
||||
season: 1,
|
||||
scenario: 100,
|
||||
scenarioName: '테스트',
|
||||
status: 'COMPLETED',
|
||||
env: {},
|
||||
},
|
||||
],
|
||||
},
|
||||
gameCancellation: {
|
||||
findMany: async () =>
|
||||
includeCancellation
|
||||
? [
|
||||
{
|
||||
id: 'cancel-fixture',
|
||||
serverId: 'che_legacy_1',
|
||||
originalSeason: 1,
|
||||
scenario: 100,
|
||||
scenarioName: '테스트',
|
||||
openedAt: new Date('2025-01-02T00:00:00.000Z'),
|
||||
cancelledAt: new Date('2025-01-03T00:00:00.000Z'),
|
||||
},
|
||||
]
|
||||
: [],
|
||||
},
|
||||
oldNation: {
|
||||
findMany: async () => [
|
||||
{
|
||||
@@ -359,6 +380,21 @@ describe('archive.myPastPlays', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('labels a retained cancellation as an unnumbered abandoned game without a dynasty link', async () => {
|
||||
const result = await appRouter.createCaller(context(auth, false, true)).archive.myPastPlays();
|
||||
|
||||
expect(result.seasons).toEqual([
|
||||
expect.objectContaining({
|
||||
serverId: 'che_legacy_1',
|
||||
season: null,
|
||||
status: 'ABANDONED',
|
||||
cancellationId: 'cancel-fixture',
|
||||
cancelledAt: '2025-01-03T00:00:00.000Z',
|
||||
dynastyId: null,
|
||||
}),
|
||||
]);
|
||||
});
|
||||
|
||||
it('returns normalized previous-server detail from the dedicated archive without exposing raw data', async () => {
|
||||
const caller = appRouter.createCaller(context(auth, true));
|
||||
const list = await caller.archive.myPastPlays();
|
||||
|
||||
Reference in New Issue
Block a user