diff --git a/.claude/skills/add-contest-table-provider/instructions.md b/.claude/skills/add-contest-table-provider/instructions.md index 5c3ee8062..8fbdd838d 100644 --- a/.claude/skills/add-contest-table-provider/instructions.md +++ b/.claude/skills/add-contest-table-provider/instructions.md @@ -33,16 +33,16 @@ Step 0 (seed check) is already done. Confirm the following before touching code: > Skip when an existing ContestType already covers this contest family (e.g. `AOJ_JAG` for JAG Prelim). - [ ] Add to `prisma/schema.prisma` ContestType enum → `pnpm exec prisma generate` -- [ ] Add to `ContestType` in `src/lib/types/contest.ts` (same position as schema) +- [ ] Add to `ContestType` in `src/lib/contests/types/contest.ts` (same position as schema) - [ ] `pnpm check` — confirm error resolved ## Layer 3 — Contest utilities (TDD) ### Tests first -- [ ] Add exports to `src/test/lib/utils/test_cases/contest_type.ts` and `contest_name_labels.ts` -- [ ] Add 3 `describe` blocks to `src/test/lib/utils/contest.test.ts`: classify / priority / name label -- [ ] `pnpm test:unit src/test/lib/utils/contest.test.ts` — **RED** +- [ ] Add exports to `src/lib/contests/fixtures/contest_type.ts` and `contest_name_labels.ts` +- [ ] Add 3 `describe` blocks to `src/lib/contests/utils/contest.test.ts`: classify / priority / name label +- [ ] `pnpm test:unit src/lib/contests/utils/contest.test.ts` — **RED** ### Implement diff --git a/docs/guides/architecture.md b/docs/guides/architecture.md index e78ccd92f..db684468c 100644 --- a/docs/guides/architecture.md +++ b/docs/guides/architecture.md @@ -158,6 +158,7 @@ src/lib/ ├── clients/ # 外部 API クライアント(AtCoder Problems, AOJ) ├── components/ # 共通 UI コンポーネント(GradeLabel, TaskGradeList, TaskList, FormWrapper 等) ├── constants/ # アプリ定数 +├── contests/ # コンテスト分類・ラベル生成・優先度(types/, utils/, fixtures/) ├── server/ # サーバー専用の共有インフラ │ ├── database.ts # Prisma クライアント(14+ サービスが依存) │ ├── tasks/ # cache.ts など複数 feature 共有のサーバ処理 diff --git a/docs/guides/how-to-add-contest-table-provider.md b/docs/guides/how-to-add-contest-table-provider.md index a8c68d045..70ef94fa9 100644 --- a/docs/guides/how-to-add-contest-table-provider.md +++ b/docs/guides/how-to-add-contest-table-provider.md @@ -6,8 +6,8 @@ ## 事前確認 -- [ ] `ContestType`(`src/lib/types/contest.ts`)— 既存で対応できるか?複数 contest_id を統一表示するなら複合型 -- [ ] `classifyContest()`(`src/lib/utils/contest.ts`)— 新 contest_id に正しい ContestType を返すか +- [ ] `ContestType`(`src/lib/contests/types/contest.ts`)— 既存で対応できるか?複数 contest_id を統一表示するなら複合型 +- [ ] `classifyContest()`(`src/lib/contests/utils/contest.ts`)— 新 contest_id に正しい ContestType を返すか - [ ] `prisma/tasks.ts` にデータが存在するか(複合型は `prisma/contest_task_pairs.ts` も) - [ ] 実装パターン判定(後述4パターン) - [ ] JOI: 2026 年より `joi{YYYY}ho` → `joi{YYYY}sf`。regex は `(ho|sf)` 対応済み diff --git a/prisma/seed.ts b/prisma/seed.ts index 9574a68ce..68a498fa3 100755 --- a/prisma/seed.ts +++ b/prisma/seed.ts @@ -24,7 +24,7 @@ import { hashPassword } from '../src/features/auth/server/password'; import { getTaskGrade } from '../src/lib/types/task'; import type { PlacementCreate } from '../src/features/workbooks/types/workbook_placement'; -import { classifyContest } from '../src/lib/utils/contest'; +import { classifyContest } from '../src/lib/contests/utils/contest'; import { users, USER_PASSWORD_FOR_SEED } from './users'; import { tasks } from './tasks'; diff --git a/src/features/tasks/types/contest-table/contest_table_provider.ts b/src/features/tasks/types/contest-table/contest_table_provider.ts index 54b3ff251..83cc676e7 100644 --- a/src/features/tasks/types/contest-table/contest_table_provider.ts +++ b/src/features/tasks/types/contest-table/contest_table_provider.ts @@ -1,4 +1,4 @@ -import type { ContestType } from '$lib/types/contest'; +import type { ContestType } from '$lib/contests/types/contest'; import type { TaskResults, TaskResult } from '$lib/types/task'; /** diff --git a/src/features/tasks/utils/contest-table/abc_providers.test.ts b/src/features/tasks/utils/contest-table/abc_providers.test.ts index ab0f1594f..651e00df5 100644 --- a/src/features/tasks/utils/contest-table/abc_providers.test.ts +++ b/src/features/tasks/utils/contest-table/abc_providers.test.ts @@ -1,6 +1,6 @@ import { describe, test, expect } from 'vitest'; -import { ContestType } from '$lib/types/contest'; +import { ContestType } from '$lib/contests/types/contest'; import type { TaskResult, TaskResults } from '$lib/types/task'; import { diff --git a/src/features/tasks/utils/contest-table/abc_providers.ts b/src/features/tasks/utils/contest-table/abc_providers.ts index 2dea3fbc6..6dd8d795f 100644 --- a/src/features/tasks/utils/contest-table/abc_providers.ts +++ b/src/features/tasks/utils/contest-table/abc_providers.ts @@ -4,7 +4,7 @@ import { } from '$features/tasks/types/contest-table/contest_table_provider'; import type { TaskResult } from '$lib/types/task'; -import { classifyContest, getContestNameLabel } from '$lib/utils/contest'; +import { classifyContest, getContestNameLabel } from '$lib/contests/utils/contest'; import { ContestTableProviderBase, parseContestRound } from './contest_table_provider_base'; diff --git a/src/features/tasks/utils/contest-table/abs_provider.test.ts b/src/features/tasks/utils/contest-table/abs_provider.test.ts index e86775812..54def4c19 100644 --- a/src/features/tasks/utils/contest-table/abs_provider.test.ts +++ b/src/features/tasks/utils/contest-table/abs_provider.test.ts @@ -1,6 +1,6 @@ import { describe, test, expect } from 'vitest'; -import { ContestType } from '$lib/types/contest'; +import { ContestType } from '$lib/contests/types/contest'; import type { TaskResults } from '$lib/types/task'; import { ABSProvider } from './abs_provider'; diff --git a/src/features/tasks/utils/contest-table/abs_provider.ts b/src/features/tasks/utils/contest-table/abs_provider.ts index cf527e21a..12b9669e4 100644 --- a/src/features/tasks/utils/contest-table/abs_provider.ts +++ b/src/features/tasks/utils/contest-table/abs_provider.ts @@ -4,7 +4,7 @@ import { } from '$features/tasks/types/contest-table/contest_table_provider'; import type { TaskResult } from '$lib/types/task'; -import { classifyContest } from '$lib/utils/contest'; +import { classifyContest } from '$lib/contests/utils/contest'; import { ContestTableProviderBase } from './contest_table_provider_base'; diff --git a/src/features/tasks/utils/contest-table/acl_providers.test.ts b/src/features/tasks/utils/contest-table/acl_providers.test.ts index 6cdc37388..c2c4b4826 100644 --- a/src/features/tasks/utils/contest-table/acl_providers.test.ts +++ b/src/features/tasks/utils/contest-table/acl_providers.test.ts @@ -1,6 +1,6 @@ import { describe, test, expect } from 'vitest'; -import { ContestType } from '$lib/types/contest'; +import { ContestType } from '$lib/contests/types/contest'; import type { TaskResults } from '$lib/types/task'; import { ACLPracticeProvider, ACLBeginnerProvider, ACLProvider } from './acl_providers'; diff --git a/src/features/tasks/utils/contest-table/acl_providers.ts b/src/features/tasks/utils/contest-table/acl_providers.ts index 2235e0f9d..86ae9572f 100644 --- a/src/features/tasks/utils/contest-table/acl_providers.ts +++ b/src/features/tasks/utils/contest-table/acl_providers.ts @@ -4,7 +4,7 @@ import { } from '$features/tasks/types/contest-table/contest_table_provider'; import type { TaskResult } from '$lib/types/task'; -import { classifyContest } from '$lib/utils/contest'; +import { classifyContest } from '$lib/contests/utils/contest'; import { ContestTableProviderBase } from './contest_table_provider_base'; diff --git a/src/features/tasks/utils/contest-table/agc_provider.test.ts b/src/features/tasks/utils/contest-table/agc_provider.test.ts index 83c91d730..c11600c68 100644 --- a/src/features/tasks/utils/contest-table/agc_provider.test.ts +++ b/src/features/tasks/utils/contest-table/agc_provider.test.ts @@ -1,6 +1,6 @@ import { describe, test, expect } from 'vitest'; -import { ContestType } from '$lib/types/contest'; +import { ContestType } from '$lib/contests/types/contest'; import type { TaskResults } from '$lib/types/task'; import { AGC001OnwardsProvider } from './agc_provider'; diff --git a/src/features/tasks/utils/contest-table/agc_provider.ts b/src/features/tasks/utils/contest-table/agc_provider.ts index 93e0e0922..efb7703af 100644 --- a/src/features/tasks/utils/contest-table/agc_provider.ts +++ b/src/features/tasks/utils/contest-table/agc_provider.ts @@ -1,7 +1,7 @@ import { type ContestTableMetaData } from '$features/tasks/types/contest-table/contest_table_provider'; import type { TaskResult } from '$lib/types/task'; -import { classifyContest, getContestNameLabel } from '$lib/utils/contest'; +import { classifyContest, getContestNameLabel } from '$lib/contests/utils/contest'; import { ContestTableProviderBase, parseContestRound } from './contest_table_provider_base'; diff --git a/src/features/tasks/utils/contest-table/aoj_icpc_providers.test.ts b/src/features/tasks/utils/contest-table/aoj_icpc_providers.test.ts index ad709e1a2..046db0b88 100644 --- a/src/features/tasks/utils/contest-table/aoj_icpc_providers.test.ts +++ b/src/features/tasks/utils/contest-table/aoj_icpc_providers.test.ts @@ -1,6 +1,6 @@ import { describe, test, expect, beforeEach, afterEach } from 'vitest'; -import { ContestType } from '$lib/types/contest'; +import { ContestType } from '$lib/contests/types/contest'; import type { TaskResults } from '$lib/types/task'; import { AOJ_LABEL_OVERRIDES } from './aoj_labels'; diff --git a/src/features/tasks/utils/contest-table/aoj_icpc_providers.ts b/src/features/tasks/utils/contest-table/aoj_icpc_providers.ts index acd295bbf..92df296e4 100644 --- a/src/features/tasks/utils/contest-table/aoj_icpc_providers.ts +++ b/src/features/tasks/utils/contest-table/aoj_icpc_providers.ts @@ -1,4 +1,4 @@ -import { ContestType } from '$lib/types/contest'; +import { ContestType } from '$lib/contests/types/contest'; import type { TaskResult, TaskResults } from '$lib/types/task'; import { type ContestTableMetaData, diff --git a/src/features/tasks/utils/contest-table/aoj_jag_providers.test.ts b/src/features/tasks/utils/contest-table/aoj_jag_providers.test.ts index d92f82509..5828d6025 100644 --- a/src/features/tasks/utils/contest-table/aoj_jag_providers.test.ts +++ b/src/features/tasks/utils/contest-table/aoj_jag_providers.test.ts @@ -1,6 +1,6 @@ import { describe, test, expect } from 'vitest'; -import { ContestType } from '$lib/types/contest'; +import { ContestType } from '$lib/contests/types/contest'; import type { TaskResults } from '$lib/types/task'; import { JagPrelimProvider } from './aoj_jag_providers'; diff --git a/src/features/tasks/utils/contest-table/aoj_jag_providers.ts b/src/features/tasks/utils/contest-table/aoj_jag_providers.ts index 55bbfaf9b..e004f7193 100644 --- a/src/features/tasks/utils/contest-table/aoj_jag_providers.ts +++ b/src/features/tasks/utils/contest-table/aoj_jag_providers.ts @@ -1,4 +1,4 @@ -import { ContestType } from '$lib/types/contest'; +import { ContestType } from '$lib/contests/types/contest'; import type { TaskResult, TaskResults } from '$lib/types/task'; import { type ContestTableMetaData, diff --git a/src/features/tasks/utils/contest-table/arc_providers.test.ts b/src/features/tasks/utils/contest-table/arc_providers.test.ts index 4a5ac472f..4acb3938e 100644 --- a/src/features/tasks/utils/contest-table/arc_providers.test.ts +++ b/src/features/tasks/utils/contest-table/arc_providers.test.ts @@ -1,6 +1,6 @@ import { describe, test, expect } from 'vitest'; -import { ContestType } from '$lib/types/contest'; +import { ContestType } from '$lib/contests/types/contest'; import type { TaskResult, TaskResults } from '$lib/types/task'; import { diff --git a/src/features/tasks/utils/contest-table/arc_providers.ts b/src/features/tasks/utils/contest-table/arc_providers.ts index 2de4b2490..4751de367 100644 --- a/src/features/tasks/utils/contest-table/arc_providers.ts +++ b/src/features/tasks/utils/contest-table/arc_providers.ts @@ -4,7 +4,7 @@ import { } from '$features/tasks/types/contest-table/contest_table_provider'; import type { TaskResult } from '$lib/types/task'; -import { classifyContest, getContestNameLabel } from '$lib/utils/contest'; +import { classifyContest, getContestNameLabel } from '$lib/contests/utils/contest'; import { ContestTableProviderBase, parseContestRound } from './contest_table_provider_base'; diff --git a/src/features/tasks/utils/contest-table/awc_provider.test.ts b/src/features/tasks/utils/contest-table/awc_provider.test.ts index 6306f96fa..99bd4e4b8 100644 --- a/src/features/tasks/utils/contest-table/awc_provider.test.ts +++ b/src/features/tasks/utils/contest-table/awc_provider.test.ts @@ -1,6 +1,6 @@ import { describe, test, expect } from 'vitest'; -import { ContestType } from '$lib/types/contest'; +import { ContestType } from '$lib/contests/types/contest'; import type { TaskResults } from '$lib/types/task'; import { AWCRangeProvider, AWCSpecialContestProvider } from './awc_provider'; diff --git a/src/features/tasks/utils/contest-table/awc_provider.ts b/src/features/tasks/utils/contest-table/awc_provider.ts index 0a32cc731..0c9293ff6 100644 --- a/src/features/tasks/utils/contest-table/awc_provider.ts +++ b/src/features/tasks/utils/contest-table/awc_provider.ts @@ -2,10 +2,10 @@ import { type ContestTableMetaData, type ContestTableDisplayConfig, } from '$features/tasks/types/contest-table/contest_table_provider'; -import { ContestType } from '$lib/types/contest'; +import { ContestType } from '$lib/contests/types/contest'; import type { TaskResult } from '$lib/types/task'; -import { classifyContest, getContestNameLabel } from '$lib/utils/contest'; +import { classifyContest, getContestNameLabel } from '$lib/contests/utils/contest'; import { ContestTableProviderBase, parseContestRound } from './contest_table_provider_base'; diff --git a/src/features/tasks/utils/contest-table/axc_like_provider.test.ts b/src/features/tasks/utils/contest-table/axc_like_provider.test.ts index 845bcaad6..3fba7b855 100644 --- a/src/features/tasks/utils/contest-table/axc_like_provider.test.ts +++ b/src/features/tasks/utils/contest-table/axc_like_provider.test.ts @@ -1,6 +1,6 @@ import { describe, test, expect } from 'vitest'; -import { ContestType } from '$lib/types/contest'; +import { ContestType } from '$lib/contests/types/contest'; import type { TaskResults } from '$lib/types/task'; import { ABCLikeProvider } from './axc_like_provider'; diff --git a/src/features/tasks/utils/contest-table/axc_like_provider.ts b/src/features/tasks/utils/contest-table/axc_like_provider.ts index a46980471..d411d8be5 100644 --- a/src/features/tasks/utils/contest-table/axc_like_provider.ts +++ b/src/features/tasks/utils/contest-table/axc_like_provider.ts @@ -4,7 +4,7 @@ import { } from '$features/tasks/types/contest-table/contest_table_provider'; import type { TaskResult } from '$lib/types/task'; -import { classifyContest } from '$lib/utils/contest'; +import { classifyContest } from '$lib/contests/utils/contest'; import { ContestTableProviderBase } from './contest_table_provider_base'; diff --git a/src/features/tasks/utils/contest-table/contest_table_provider_base.test.ts b/src/features/tasks/utils/contest-table/contest_table_provider_base.test.ts index c30191607..5dbdb797d 100644 --- a/src/features/tasks/utils/contest-table/contest_table_provider_base.test.ts +++ b/src/features/tasks/utils/contest-table/contest_table_provider_base.test.ts @@ -1,6 +1,6 @@ import { describe, test, expect } from 'vitest'; -import { ContestType } from '$lib/types/contest'; +import { ContestType } from '$lib/contests/types/contest'; import { ABSProvider } from './contest_table_provider'; import { taskResultsForABS } from '$features/tasks/fixtures/contest-table/contest_table_provider'; diff --git a/src/features/tasks/utils/contest-table/contest_table_provider_base.ts b/src/features/tasks/utils/contest-table/contest_table_provider_base.ts index ef41ae617..fb36f1545 100644 --- a/src/features/tasks/utils/contest-table/contest_table_provider_base.ts +++ b/src/features/tasks/utils/contest-table/contest_table_provider_base.ts @@ -5,7 +5,7 @@ import { type ContestTableDisplayConfig, type ProviderKey, } from '$features/tasks/types/contest-table/contest_table_provider'; -import { ContestType } from '$lib/types/contest'; +import { ContestType } from '$lib/contests/types/contest'; import type { TaskResults, TaskResult } from '$lib/types/task'; import { getTaskTableHeaderName } from '$lib/utils/task'; diff --git a/src/features/tasks/utils/contest-table/contest_table_provider_group.test.ts b/src/features/tasks/utils/contest-table/contest_table_provider_group.test.ts index 46ce4d599..ac7aaeded 100644 --- a/src/features/tasks/utils/contest-table/contest_table_provider_group.test.ts +++ b/src/features/tasks/utils/contest-table/contest_table_provider_group.test.ts @@ -1,6 +1,6 @@ import { describe, test, expect } from 'vitest'; -import { ContestType } from '$lib/types/contest'; +import { ContestType } from '$lib/contests/types/contest'; import { ABSProvider, diff --git a/src/features/tasks/utils/contest-table/contest_table_provider_group.ts b/src/features/tasks/utils/contest-table/contest_table_provider_group.ts index e16580a12..781b812bf 100644 --- a/src/features/tasks/utils/contest-table/contest_table_provider_group.ts +++ b/src/features/tasks/utils/contest-table/contest_table_provider_group.ts @@ -1,5 +1,5 @@ import { type ContestTablesMetaData } from '$features/tasks/types/contest-table/contest_table_provider'; -import { ContestType } from '$lib/types/contest'; +import { ContestType } from '$lib/contests/types/contest'; import { ContestTableProviderBase } from './contest_table_provider_base'; diff --git a/src/features/tasks/utils/contest-table/contest_table_provider_groups.test.ts b/src/features/tasks/utils/contest-table/contest_table_provider_groups.test.ts index 77372acb4..f879b1efd 100644 --- a/src/features/tasks/utils/contest-table/contest_table_provider_groups.test.ts +++ b/src/features/tasks/utils/contest-table/contest_table_provider_groups.test.ts @@ -1,6 +1,6 @@ import { describe, test, expect } from 'vitest'; -import { ContestType } from '$lib/types/contest'; +import { ContestType } from '$lib/contests/types/contest'; import { TESSOKU_SECTIONS } from '$features/tasks/types/contest-table/contest_table_provider'; diff --git a/src/features/tasks/utils/contest-table/contest_table_provider_groups.ts b/src/features/tasks/utils/contest-table/contest_table_provider_groups.ts index ea311d973..98e7da299 100644 --- a/src/features/tasks/utils/contest-table/contest_table_provider_groups.ts +++ b/src/features/tasks/utils/contest-table/contest_table_provider_groups.ts @@ -1,4 +1,4 @@ -import { ContestType } from '$lib/types/contest'; +import { ContestType } from '$lib/contests/types/contest'; import { ABSProvider } from './abs_provider'; import { diff --git a/src/features/tasks/utils/contest-table/dp_providers.test.ts b/src/features/tasks/utils/contest-table/dp_providers.test.ts index 92cc9407c..c88cd189c 100644 --- a/src/features/tasks/utils/contest-table/dp_providers.test.ts +++ b/src/features/tasks/utils/contest-table/dp_providers.test.ts @@ -1,6 +1,6 @@ import { describe, test, expect } from 'vitest'; -import { ContestType } from '$lib/types/contest'; +import { ContestType } from '$lib/contests/types/contest'; import type { TaskResults } from '$lib/types/task'; import { EDPCProvider, TDPCProvider, NDPCProvider } from './dp_providers'; diff --git a/src/features/tasks/utils/contest-table/dp_providers.ts b/src/features/tasks/utils/contest-table/dp_providers.ts index 8ee49b01f..9936ec050 100644 --- a/src/features/tasks/utils/contest-table/dp_providers.ts +++ b/src/features/tasks/utils/contest-table/dp_providers.ts @@ -4,7 +4,7 @@ import { } from '$features/tasks/types/contest-table/contest_table_provider'; import type { TaskResult } from '$lib/types/task'; -import { classifyContest } from '$lib/utils/contest'; +import { classifyContest } from '$lib/contests/utils/contest'; import { ContestTableProviderBase } from './contest_table_provider_base'; diff --git a/src/features/tasks/utils/contest-table/fps24_provider.test.ts b/src/features/tasks/utils/contest-table/fps24_provider.test.ts index b1aeb2f0a..a520a86ae 100644 --- a/src/features/tasks/utils/contest-table/fps24_provider.test.ts +++ b/src/features/tasks/utils/contest-table/fps24_provider.test.ts @@ -1,6 +1,6 @@ import { describe, test, expect } from 'vitest'; -import { ContestType } from '$lib/types/contest'; +import { ContestType } from '$lib/contests/types/contest'; import type { TaskResults } from '$lib/types/task'; import { FPS24Provider } from './fps24_provider'; diff --git a/src/features/tasks/utils/contest-table/fps24_provider.ts b/src/features/tasks/utils/contest-table/fps24_provider.ts index 48b5decee..488669c77 100644 --- a/src/features/tasks/utils/contest-table/fps24_provider.ts +++ b/src/features/tasks/utils/contest-table/fps24_provider.ts @@ -4,7 +4,7 @@ import { } from '$features/tasks/types/contest-table/contest_table_provider'; import type { TaskResult } from '$lib/types/task'; -import { classifyContest } from '$lib/utils/contest'; +import { classifyContest } from '$lib/contests/utils/contest'; import { ContestTableProviderBase } from './contest_table_provider_base'; diff --git a/src/features/tasks/utils/contest-table/joi_providers.test.ts b/src/features/tasks/utils/contest-table/joi_providers.test.ts index 16e18ae21..46e7cfd99 100644 --- a/src/features/tasks/utils/contest-table/joi_providers.test.ts +++ b/src/features/tasks/utils/contest-table/joi_providers.test.ts @@ -1,6 +1,6 @@ import { describe, test, expect } from 'vitest'; -import { ContestType } from '$lib/types/contest'; +import { ContestType } from '$lib/contests/types/contest'; import type { TaskResults } from '$lib/types/task'; import { @@ -81,7 +81,7 @@ describe('JOIFirstQualRoundProvider', () => { test('expects to handle invalid contest IDs gracefully', () => { const provider = new JOIFirstQualRoundProvider(ContestType.JOI); - expect(provider.getContestRoundLabel('invalid-id')).toBe('INVALID-ID'); // See: getContestNameLabel() in src/lib/utils/contest.ts + expect(provider.getContestRoundLabel('invalid-id')).toBe('INVALID-ID'); // See: getContestNameLabel() in src/lib/contests/utils/contest.ts expect(provider.getContestRoundLabel('joi2024yo1d')).toBe('2024d'); // 'd' doesn't match valid round (a|b|c) }); diff --git a/src/features/tasks/utils/contest-table/joi_providers.ts b/src/features/tasks/utils/contest-table/joi_providers.ts index 9e78c1257..950ae6841 100644 --- a/src/features/tasks/utils/contest-table/joi_providers.ts +++ b/src/features/tasks/utils/contest-table/joi_providers.ts @@ -4,10 +4,10 @@ import { JOI_SECOND_QUAL_ROUND_SECTIONS, JOI_FINAL_ROUND_SECTIONS, } from '$features/tasks/types/contest-table/contest_table_provider'; -import { ContestType } from '$lib/types/contest'; +import { ContestType } from '$lib/contests/types/contest'; import type { TaskResult } from '$lib/types/task'; -import { classifyContest, getContestNameLabel } from '$lib/utils/contest'; +import { classifyContest, getContestNameLabel } from '$lib/contests/utils/contest'; import { ContestTableProviderBase } from './contest_table_provider_base'; diff --git a/src/features/tasks/utils/contest-table/math_and_algorithm_provider.test.ts b/src/features/tasks/utils/contest-table/math_and_algorithm_provider.test.ts index 2471ddae6..c972d89da 100644 --- a/src/features/tasks/utils/contest-table/math_and_algorithm_provider.test.ts +++ b/src/features/tasks/utils/contest-table/math_and_algorithm_provider.test.ts @@ -1,6 +1,6 @@ import { describe, test, expect } from 'vitest'; -import { ContestType } from '$lib/types/contest'; +import { ContestType } from '$lib/contests/types/contest'; import type { TaskResults } from '$lib/types/task'; import { MathAndAlgorithmProvider } from './math_and_algorithm_provider'; diff --git a/src/features/tasks/utils/contest-table/math_and_algorithm_provider.ts b/src/features/tasks/utils/contest-table/math_and_algorithm_provider.ts index ed51c2248..51e175562 100644 --- a/src/features/tasks/utils/contest-table/math_and_algorithm_provider.ts +++ b/src/features/tasks/utils/contest-table/math_and_algorithm_provider.ts @@ -4,7 +4,7 @@ import { } from '$features/tasks/types/contest-table/contest_table_provider'; import type { TaskResult } from '$lib/types/task'; -import { classifyContest } from '$lib/utils/contest'; +import { classifyContest } from '$lib/contests/utils/contest'; import { ContestTableProviderBase } from './contest_table_provider_base'; diff --git a/src/features/tasks/utils/contest-table/tessoku_book_providers.test.ts b/src/features/tasks/utils/contest-table/tessoku_book_providers.test.ts index 2bf3dc1d7..68241da1d 100644 --- a/src/features/tasks/utils/contest-table/tessoku_book_providers.test.ts +++ b/src/features/tasks/utils/contest-table/tessoku_book_providers.test.ts @@ -1,6 +1,6 @@ import { describe, test, expect } from 'vitest'; -import { ContestType } from '$lib/types/contest'; +import { ContestType } from '$lib/contests/types/contest'; import type { TaskResults } from '$lib/types/task'; import { diff --git a/src/features/tasks/utils/contest-table/tessoku_book_providers.ts b/src/features/tasks/utils/contest-table/tessoku_book_providers.ts index 4a32554cc..c11ae6e78 100644 --- a/src/features/tasks/utils/contest-table/tessoku_book_providers.ts +++ b/src/features/tasks/utils/contest-table/tessoku_book_providers.ts @@ -3,10 +3,10 @@ import { type ContestTableDisplayConfig, TESSOKU_SECTIONS, } from '$features/tasks/types/contest-table/contest_table_provider'; -import { ContestType } from '$lib/types/contest'; +import { ContestType } from '$lib/contests/types/contest'; import type { TaskResult } from '$lib/types/task'; -import { classifyContest } from '$lib/utils/contest'; +import { classifyContest } from '$lib/contests/utils/contest'; import { ContestTableProviderBase } from './contest_table_provider_base'; diff --git a/src/features/tasks/utils/contest-table/typical90_provider.test.ts b/src/features/tasks/utils/contest-table/typical90_provider.test.ts index 6b03018df..a81473674 100644 --- a/src/features/tasks/utils/contest-table/typical90_provider.test.ts +++ b/src/features/tasks/utils/contest-table/typical90_provider.test.ts @@ -1,6 +1,6 @@ import { describe, test, expect } from 'vitest'; -import { ContestType } from '$lib/types/contest'; +import { ContestType } from '$lib/contests/types/contest'; import type { TaskResults } from '$lib/types/task'; import { Typical90Provider } from './typical90_provider'; diff --git a/src/features/tasks/utils/contest-table/typical90_provider.ts b/src/features/tasks/utils/contest-table/typical90_provider.ts index 86d5b9009..9afd35298 100644 --- a/src/features/tasks/utils/contest-table/typical90_provider.ts +++ b/src/features/tasks/utils/contest-table/typical90_provider.ts @@ -4,7 +4,7 @@ import { } from '$features/tasks/types/contest-table/contest_table_provider'; import type { TaskResult } from '$lib/types/task'; -import { classifyContest } from '$lib/utils/contest'; +import { classifyContest } from '$lib/contests/utils/contest'; import { ContestTableProviderBase } from './contest_table_provider_base'; diff --git a/src/features/workbooks/components/detail/WorkBookTasksTable.svelte b/src/features/workbooks/components/detail/WorkBookTasksTable.svelte index 1e2d32bf0..71d62dccd 100644 --- a/src/features/workbooks/components/detail/WorkBookTasksTable.svelte +++ b/src/features/workbooks/components/detail/WorkBookTasksTable.svelte @@ -14,7 +14,7 @@ import GradeLabel from '$lib/components/GradeLabel.svelte'; import ExternalLinkWrapper from '$lib/components/ExternalLinkWrapper.svelte'; - import { addContestNameToTaskIndex } from '$lib/utils/contest'; + import { addContestNameToTaskIndex } from '$lib/contests/utils/contest'; import { getTaskUrl, removeTaskIndexFromTitle } from '$lib/utils/task'; import type { diff --git a/src/lib/clients/aizu_online_judge/clients.test.ts b/src/lib/clients/aizu_online_judge/clients.test.ts index ed66b1228..0c1039688 100644 --- a/src/lib/clients/aizu_online_judge/clients.test.ts +++ b/src/lib/clients/aizu_online_judge/clients.test.ts @@ -11,7 +11,7 @@ import { Cache } from '$lib/clients/cache'; import { AojCoursesApiClient, AojChallengesApiClient } from './clients'; -import type { ContestsForImport } from '$lib/types/contest'; +import type { ContestsForImport } from '$lib/contests/types/contest'; import type { TasksForImport } from '$lib/types/task'; import type { AOJCourseAPI, AOJChallengeContestAPI, AOJTaskAPIs } from './types'; diff --git a/src/lib/clients/aizu_online_judge/clients.ts b/src/lib/clients/aizu_online_judge/clients.ts index 33fbc44e9..9af340fdd 100644 --- a/src/lib/clients/aizu_online_judge/clients.ts +++ b/src/lib/clients/aizu_online_judge/clients.ts @@ -2,7 +2,7 @@ import { HttpRequestClient } from '$lib/clients/http_client'; import { ContestTaskCache } from '$lib/clients/cache_strategy'; import { getCachedOrFetchContests, getCachedOrFetchTasks } from '$lib/clients/contest_task_fetcher'; -import type { ContestsForImport } from '$lib/types/contest'; +import type { ContestsForImport } from '$lib/contests/types/contest'; import type { TasksForImport } from '$lib/types/task'; import type { diff --git a/src/lib/clients/aizu_online_judge/utils.ts b/src/lib/clients/aizu_online_judge/utils.ts index 149464eb4..cb22863f7 100644 --- a/src/lib/clients/aizu_online_judge/utils.ts +++ b/src/lib/clients/aizu_online_judge/utils.ts @@ -1,4 +1,4 @@ -import type { ContestForImport } from '$lib/types/contest'; +import type { ContestForImport } from '$lib/contests/types/contest'; import { PENDING } from './types'; import type { AOJTaskAPI } from './types'; diff --git a/src/lib/clients/atcoder/atcoder_problems.test.ts b/src/lib/clients/atcoder/atcoder_problems.test.ts index 8652495a7..9b78df8be 100644 --- a/src/lib/clients/atcoder/atcoder_problems.test.ts +++ b/src/lib/clients/atcoder/atcoder_problems.test.ts @@ -5,7 +5,7 @@ vi.mock('$lib/utils/time', () => ({ delay: vi.fn().mockResolvedValue(undefined), })); -import type { ContestsForImport } from '$lib/types/contest'; +import type { ContestsForImport } from '$lib/contests/types/contest'; import type { TasksForImport } from '$lib/types/task'; import { AtCoderProblemsApiClient } from '$lib/clients/atcoder/atcoder_problems'; diff --git a/src/lib/clients/atcoder/atcoder_problems.ts b/src/lib/clients/atcoder/atcoder_problems.ts index b05b17a59..653509a57 100644 --- a/src/lib/clients/atcoder/atcoder_problems.ts +++ b/src/lib/clients/atcoder/atcoder_problems.ts @@ -1,6 +1,6 @@ import { HttpRequestClient } from '$lib/clients/http_client'; -import type { ContestsForImport } from '$lib/types/contest'; +import type { ContestsForImport } from '$lib/contests/types/contest'; import type { TasksForImport } from '$lib/types/task'; import { ATCODER_PROBLEMS_API_BASE_URL } from '$lib/constants/urls'; diff --git a/src/lib/clients/cache_strategy.ts b/src/lib/clients/cache_strategy.ts index 220343f74..3b9657536 100644 --- a/src/lib/clients/cache_strategy.ts +++ b/src/lib/clients/cache_strategy.ts @@ -1,6 +1,6 @@ import { Cache } from '$lib/clients/cache'; -import type { ContestsForImport } from '$lib/types/contest'; +import type { ContestsForImport } from '$lib/contests/types/contest'; import type { TasksForImport } from '$lib/types/task'; export class ContestTaskCache { diff --git a/src/lib/clients/contest_task_fetcher.ts b/src/lib/clients/contest_task_fetcher.ts index 4fd25fbef..1310d669c 100644 --- a/src/lib/clients/contest_task_fetcher.ts +++ b/src/lib/clients/contest_task_fetcher.ts @@ -1,6 +1,6 @@ import type { HttpRequestClient } from '$lib/clients/http_client'; import type { ContestTaskCache } from '$lib/clients/cache_strategy'; -import type { ContestsForImport } from '$lib/types/contest'; +import type { ContestsForImport } from '$lib/contests/types/contest'; import type { TasksForImport } from '$lib/types/task'; type FetchContestsConfig = { diff --git a/src/lib/clients/http_client.ts b/src/lib/clients/http_client.ts index beb9d0c3c..a01d7bdd0 100644 --- a/src/lib/clients/http_client.ts +++ b/src/lib/clients/http_client.ts @@ -1,4 +1,4 @@ -import type { ContestsForImport } from '$lib/types/contest'; +import type { ContestsForImport } from '$lib/contests/types/contest'; import type { TasksForImport } from '$lib/types/task'; import { delay } from '$lib/utils/time'; diff --git a/src/lib/clients/index.ts b/src/lib/clients/index.ts index 1e4fa29f0..5b9c229d2 100644 --- a/src/lib/clients/index.ts +++ b/src/lib/clients/index.ts @@ -8,7 +8,7 @@ import { AojChallengesApiClient, } from '$lib/clients/aizu_online_judge/clients'; -import type { ContestsForImport } from '$lib/types/contest'; +import type { ContestsForImport } from '$lib/contests/types/contest'; import type { TasksForImport } from '$lib/types/task'; import type { ChallengeParams } from '$lib/clients/aizu_online_judge/types'; diff --git a/src/lib/components/SubmissionStatus/UpdatingModal.svelte b/src/lib/components/SubmissionStatus/UpdatingModal.svelte index ed2fd4a12..74d94fe74 100644 --- a/src/lib/components/SubmissionStatus/UpdatingModal.svelte +++ b/src/lib/components/SubmissionStatus/UpdatingModal.svelte @@ -8,7 +8,7 @@ import { submission_statuses } from '$lib/services/submission_status'; import { errorMessageStore } from '$lib/stores/error_message'; - import { getContestNameLabel } from '$lib/utils/contest'; + import { getContestNameLabel } from '$lib/contests/utils/contest'; import InputFieldWrapper from '$lib/components/InputFieldWrapper.svelte'; interface Props { diff --git a/src/lib/components/TagForm.svelte b/src/lib/components/TagForm.svelte index ac007fe98..5561c6145 100644 --- a/src/lib/components/TagForm.svelte +++ b/src/lib/components/TagForm.svelte @@ -14,7 +14,7 @@ import type { Task } from '$lib/types/task'; import type { Tag } from '$lib/types/tag'; - import { getContestNameLabel } from '$lib/utils/contest'; + import { getContestNameLabel } from '$lib/contests/utils/contest'; import { ATCODER_BASE_CONTEST_URL } from '$lib/constants/urls'; interface Props { diff --git a/src/lib/components/TaskForm.svelte b/src/lib/components/TaskForm.svelte index 7badafcb1..1951a4746 100644 --- a/src/lib/components/TaskForm.svelte +++ b/src/lib/components/TaskForm.svelte @@ -10,7 +10,7 @@ Label, Button, } from 'flowbite-svelte'; - import { addContestNameToTaskIndex } from '$lib/utils/contest'; + import { addContestNameToTaskIndex } from '$lib/contests/utils/contest'; import { taskGradeValues, type Task } from '$lib/types/task'; import { getTaskGradeLabel, removeTaskIndexFromTitle } from '$lib/utils/task'; diff --git a/src/lib/components/TaskList.svelte b/src/lib/components/TaskList.svelte index f0fd84c4f..d74a8df7d 100644 --- a/src/lib/components/TaskList.svelte +++ b/src/lib/components/TaskList.svelte @@ -21,7 +21,7 @@ import { getBackgroundColorFrom } from '$lib/services/submission_status'; - import { addContestNameToTaskIndex } from '$lib/utils/contest'; + import { addContestNameToTaskIndex } from '$lib/contests/utils/contest'; import { countAcceptedTasks, countAllTasks, diff --git a/src/lib/components/TaskListSorted.svelte b/src/lib/components/TaskListSorted.svelte index 2264053b6..0c2a2f286 100644 --- a/src/lib/components/TaskListSorted.svelte +++ b/src/lib/components/TaskListSorted.svelte @@ -12,7 +12,7 @@ } from 'flowbite-svelte'; import type { TaskResults } from '$lib/types/task'; - import { addContestNameToTaskIndex } from '$lib/utils/contest'; + import { addContestNameToTaskIndex } from '$lib/contests/utils/contest'; import { removeTaskIndexFromTitle } from '$lib/utils/task'; interface Props { diff --git a/src/test/lib/utils/test_cases/contest_name_and_task_index.ts b/src/lib/contests/fixtures/contest_name_and_task_index.ts similarity index 99% rename from src/test/lib/utils/test_cases/contest_name_and_task_index.ts rename to src/lib/contests/fixtures/contest_name_and_task_index.ts index df459adc5..23d75007e 100644 --- a/src/test/lib/utils/test_cases/contest_name_and_task_index.ts +++ b/src/lib/contests/fixtures/contest_name_and_task_index.ts @@ -1,4 +1,4 @@ -import { createTestCase, zip } from '../../common/test_helpers'; +import { createTestCase, zip } from '../../../test/lib/common/test_helpers'; import { getPastContestLabel, getJoiContestLabel, @@ -6,7 +6,7 @@ import { getAojContestLabel, PAST_TRANSLATIONS, AOJ_COURSES, -} from '$lib/utils/contest'; +} from '$lib/contests/utils/contest'; export type TestCaseForContestNameAndTaskIndex = { contestId: string; diff --git a/src/test/lib/utils/test_cases/contest_name_labels.ts b/src/lib/contests/fixtures/contest_name_labels.ts similarity index 99% rename from src/test/lib/utils/test_cases/contest_name_labels.ts rename to src/lib/contests/fixtures/contest_name_labels.ts index 766b93ef6..fc7dad54f 100644 --- a/src/test/lib/utils/test_cases/contest_name_labels.ts +++ b/src/lib/contests/fixtures/contest_name_labels.ts @@ -1,4 +1,4 @@ -import { createTestCase } from '../../common/test_helpers'; +import { createTestCase } from '../../../test/lib/common/test_helpers'; export type TestCaseForContestNameLabel = { contestId: string; diff --git a/src/test/lib/utils/test_cases/contest_type.ts b/src/lib/contests/fixtures/contest_type.ts similarity index 99% rename from src/test/lib/utils/test_cases/contest_type.ts rename to src/lib/contests/fixtures/contest_type.ts index cb5118fd8..bb6a0de05 100644 --- a/src/test/lib/utils/test_cases/contest_type.ts +++ b/src/lib/contests/fixtures/contest_type.ts @@ -1,5 +1,5 @@ -import { createTestCase } from '../../common/test_helpers'; -import { ContestType } from '$lib/types/contest'; +import { createTestCase } from '../../../test/lib/common/test_helpers'; +import { ContestType } from '$lib/contests/types/contest'; export type TestCaseForContestType = { contestId: string; @@ -615,7 +615,7 @@ export const atCoderMainOfficialOnsite = [ ]; // See: -// getPrefixForAojCourses() in src/lib/utils/contest.ts +// getPrefixForAojCourses() in src/lib/contests/utils/contest.ts const aojCoursesData = [ { name: 'AOJ Courses, ITP1', contestId: 'ITP1' }, { name: 'AOJ Courses, ALDS1', contestId: 'ALDS1' }, diff --git a/src/lib/types/contest.ts b/src/lib/contests/types/contest.ts similarity index 100% rename from src/lib/types/contest.ts rename to src/lib/contests/types/contest.ts diff --git a/src/test/lib/utils/contest.test.ts b/src/lib/contests/utils/contest.test.ts similarity index 97% rename from src/test/lib/utils/contest.test.ts rename to src/lib/contests/utils/contest.test.ts index f22d1e5a2..eb1600212 100644 --- a/src/test/lib/utils/contest.test.ts +++ b/src/lib/contests/utils/contest.test.ts @@ -1,13 +1,13 @@ import { expect } from 'vitest'; -import { ContestType } from '$lib/types/contest'; -import { runTests } from '../common/test_helpers'; -import * as TestCasesForContestType from './test_cases/contest_type'; -import { type TestCaseForContestType } from './test_cases/contest_type'; -import * as TestCasesForContestNameLabel from './test_cases/contest_name_labels'; -import { type TestCaseForContestNameLabel } from './test_cases/contest_name_labels'; -import * as TestCasesForContestNameAndTaskIndex from './test_cases/contest_name_and_task_index'; -import { type TestCaseForContestNameAndTaskIndex } from './test_cases/contest_name_and_task_index'; +import { ContestType } from '$lib/contests/types/contest'; +import { runTests } from '../../../test/lib/common/test_helpers'; +import * as TestCasesForContestType from '$lib/contests/fixtures/contest_type'; +import { type TestCaseForContestType } from '$lib/contests/fixtures/contest_type'; +import * as TestCasesForContestNameLabel from '$lib/contests/fixtures/contest_name_labels'; +import { type TestCaseForContestNameLabel } from '$lib/contests/fixtures/contest_name_labels'; +import * as TestCasesForContestNameAndTaskIndex from '$lib/contests/fixtures/contest_name_and_task_index'; +import { type TestCaseForContestNameAndTaskIndex } from '$lib/contests/fixtures/contest_name_and_task_index'; import { classifyContest, getContestPriority, @@ -15,7 +15,7 @@ import { getContestNameLabel, addContestNameToTaskIndex, getAtCoderUniversityContestLabel, -} from '$lib/utils/contest'; +} from '$lib/contests/utils/contest'; describe('Contest', () => { describe('classify contest', () => { diff --git a/src/lib/utils/contest.ts b/src/lib/contests/utils/contest.ts similarity index 99% rename from src/lib/utils/contest.ts rename to src/lib/contests/utils/contest.ts index 3da6df5a2..5ec61cbef 100644 --- a/src/lib/utils/contest.ts +++ b/src/lib/contests/utils/contest.ts @@ -1,4 +1,8 @@ -import { ContestType, type ContestPrefix, type ContestLabelTranslations } from '$lib/types/contest'; +import { + ContestType, + type ContestPrefix, + type ContestLabelTranslations, +} from '$lib/contests/types/contest'; export const regexForJag = /^JAG(Prelim|Regional|Summer|Winter|Spring)\d{4}(-day\d+)?[A-Z]?$/; export const regexForAojUniversity = /^AOJ-[A-Z]+PC\d{4}/; diff --git a/src/lib/services/tasks.ts b/src/lib/services/tasks.ts index 81a8017e6..7b5e828db 100644 --- a/src/lib/services/tasks.ts +++ b/src/lib/services/tasks.ts @@ -3,7 +3,7 @@ import { default as db } from '$lib/server/database'; import { getContestTaskPairs } from '$lib/services/contest_task_pairs'; -import { ContestType } from '$lib/types/contest'; +import { ContestType } from '$lib/contests/types/contest'; import type { Task, Tasks, TaskGrade } from '$lib/types/task'; import type { ContestTaskPair, @@ -18,7 +18,7 @@ import { } from '$lib/server/tasks/cache'; import { invalidateVoteCaches } from '$features/votes/server/cache'; -import { classifyContest } from '$lib/utils/contest'; +import { classifyContest } from '$lib/contests/utils/contest'; import { createContestTaskPairKey } from '$lib/utils/contest_task_pair'; // See: diff --git a/src/lib/types/task.ts b/src/lib/types/task.ts index d32dc6ea3..2ab3dbef9 100644 --- a/src/lib/types/task.ts +++ b/src/lib/types/task.ts @@ -1,6 +1,6 @@ // Import original enum as type. import type { TaskGrade as TaskGradeOrigin } from '@prisma/client'; -import type { ContestType } from '$lib/types/contest'; +import type { ContestType } from '$lib/contests/types/contest'; export interface Task { contest_type?: ContestType; diff --git a/src/lib/utils/task.ts b/src/lib/utils/task.ts index 3827cf94b..f67755165 100644 --- a/src/lib/utils/task.ts +++ b/src/lib/utils/task.ts @@ -1,4 +1,4 @@ -import { ContestType } from '$lib/types/contest'; +import { ContestType } from '$lib/contests/types/contest'; import { type TaskResult, type TaskResults, TaskGrade, type TaskGrades } from '$lib/types/task'; import type { UrlGenerator, UrlGenerators } from '$lib/types/url'; @@ -10,7 +10,7 @@ import { getContestPriority, regexForAojUniversity, regexForJag, -} from '$lib/utils/contest'; +} from '$lib/contests/utils/contest'; // TODO: Codeforces、yukicoder、BOJなどに対応できるようにする /** @@ -89,7 +89,7 @@ export function compareByContestIdAndTaskId( // 1. コンテスト種類別の優先度(昇順) // // See: - // contestTypePriorities in src/lib/utils/contest.ts + // contestTypePriorities in src/lib/contests/utils/contest.ts if (firstContestPriority !== secondContestPriority) { return firstContestPriority - secondContestPriority; } diff --git a/src/lib/utils/task_filter.ts b/src/lib/utils/task_filter.ts index ef08bd7ab..c011c4ef6 100644 --- a/src/lib/utils/task_filter.ts +++ b/src/lib/utils/task_filter.ts @@ -1,4 +1,4 @@ -import { getContestNameLabel } from '$lib/utils/contest'; +import { getContestNameLabel } from '$lib/contests/utils/contest'; import { getTaskUrl } from '$lib/utils/task'; type SearchableTask = { diff --git a/src/routes/(admin)/tasks/+page.server.ts b/src/routes/(admin)/tasks/+page.server.ts index fa4d081f2..4f070c7f0 100644 --- a/src/routes/(admin)/tasks/+page.server.ts +++ b/src/routes/(admin)/tasks/+page.server.ts @@ -1,6 +1,6 @@ import { fail, type Actions } from '@sveltejs/kit'; -import type { Contests, ContestForImport, ContestsForImport } from '$lib/types/contest'; +import type { Contests, ContestForImport, ContestsForImport } from '$lib/contests/types/contest'; import { type Task, type Tasks, type TaskForImport, type TasksForImport } from '$lib/types/task'; import * as taskService from '$lib/services/tasks'; @@ -8,7 +8,7 @@ import { validateAdminAccess } from '$features/auth/services/admin_access'; import { fetchContests, fetchTasks, isContestTaskImportSource } from '$lib/clients'; -import { classifyContest } from '$lib/utils/contest'; +import { classifyContest } from '$lib/contests/utils/contest'; import { sha256 } from '$lib/utils/hash'; import { BAD_REQUEST, INTERNAL_SERVER_ERROR } from '$lib/constants/http-response-status-codes'; diff --git a/src/routes/(admin)/tasks/+page.svelte b/src/routes/(admin)/tasks/+page.svelte index 950adf07c..9df4e1ec4 100644 --- a/src/routes/(admin)/tasks/+page.svelte +++ b/src/routes/(admin)/tasks/+page.svelte @@ -5,7 +5,7 @@ import { Select, Label, Button, PaginationNav } from 'flowbite-svelte'; - import type { Contests } from '$lib/types/contest'; + import type { Contests } from '$lib/contests/types/contest'; import { importSourceEntries, type ContestTaskImportSource } from '$lib/clients'; diff --git a/src/routes/(admin)/tasks/_components/TaskTableForImport.svelte b/src/routes/(admin)/tasks/_components/TaskTableForImport.svelte index 9df142602..0bc03db98 100644 --- a/src/routes/(admin)/tasks/_components/TaskTableForImport.svelte +++ b/src/routes/(admin)/tasks/_components/TaskTableForImport.svelte @@ -13,9 +13,9 @@ Label, } from 'flowbite-svelte'; - import type { Contests } from '$lib/types/contest'; + import type { Contests } from '$lib/contests/types/contest'; import type { ContestTaskImportSource } from '$lib/clients'; - import { getContestNameLabel } from '$lib/utils/contest'; + import { getContestNameLabel } from '$lib/contests/utils/contest'; import { newline } from '$lib/utils/newline'; interface Props { diff --git a/src/routes/(admin)/tasks/_utils/contests.test.ts b/src/routes/(admin)/tasks/_utils/contests.test.ts index ba497de31..aab04a36a 100644 --- a/src/routes/(admin)/tasks/_utils/contests.test.ts +++ b/src/routes/(admin)/tasks/_utils/contests.test.ts @@ -1,6 +1,6 @@ import { describe, test, expect } from 'vitest'; import { filterContests } from './contests'; -import type { Contests } from '$lib/types/contest'; +import type { Contests } from '$lib/contests/types/contest'; const contests: Contests = [ { diff --git a/src/routes/(admin)/tasks/_utils/contests.ts b/src/routes/(admin)/tasks/_utils/contests.ts index 3486cc3cd..a02ed0f29 100644 --- a/src/routes/(admin)/tasks/_utils/contests.ts +++ b/src/routes/(admin)/tasks/_utils/contests.ts @@ -1,4 +1,4 @@ -import type { Contests } from '$lib/types/contest'; +import type { Contests } from '$lib/contests/types/contest'; export function filterContests(contests: Contests, query: string): Contests { const hasNoQuery = !query || query.trim() === ''; diff --git a/src/routes/(admin)/tasks/grade/_components/TaskGradeTable.svelte b/src/routes/(admin)/tasks/grade/_components/TaskGradeTable.svelte index adebfdfc8..3a55a777f 100644 --- a/src/routes/(admin)/tasks/grade/_components/TaskGradeTable.svelte +++ b/src/routes/(admin)/tasks/grade/_components/TaskGradeTable.svelte @@ -19,7 +19,7 @@ import { taskGradeValues, TaskGrade } from '$lib/types/task'; import type { TaskWithVoteInfo } from '$features/votes/services/vote_statistics'; - import { addContestNameToTaskIndex } from '$lib/utils/contest'; + import { addContestNameToTaskIndex } from '$lib/contests/utils/contest'; import { getTaskGradeLabel, compareByContestIdAndTaskId, diff --git a/src/routes/votes/+page.svelte b/src/routes/votes/+page.svelte index 68af64e74..358d80f05 100644 --- a/src/routes/votes/+page.svelte +++ b/src/routes/votes/+page.svelte @@ -20,7 +20,7 @@ import { TaskGrade } from '$lib/types/task'; import { MIN_VOTES_FOR_PROVISIONAL_GRADE } from '$features/votes/constants/statistics'; - import { getContestNameLabel } from '$lib/utils/contest'; + import { getContestNameLabel } from '$lib/contests/utils/contest'; import { getTaskUrl, compareByContestIdAndTaskId } from '$lib/utils/task'; import { filterTasksBySearch } from '$lib/utils/task_filter'; import { resolveDisplayGrade } from '$features/votes/utils/grade_options'; diff --git a/src/routes/workbooks/[slug]/+page.svelte b/src/routes/workbooks/[slug]/+page.svelte index 9863ee84d..a490ebb13 100644 --- a/src/routes/workbooks/[slug]/+page.svelte +++ b/src/routes/workbooks/[slug]/+page.svelte @@ -20,7 +20,7 @@ import CommentAndHint from '$features/workbooks/components/detail/CommentAndHint.svelte'; import { getBackgroundColorFrom } from '$lib/services/submission_status'; - import { addContestNameToTaskIndex } from '$lib/utils/contest'; + import { addContestNameToTaskIndex } from '$lib/contests/utils/contest'; import { getTaskUrl, removeTaskIndexFromTitle } from '$lib/utils/task'; import type { TaskResult } from '$lib/types/task'; diff --git a/src/test/lib/services/fixtures/task_results.ts b/src/test/lib/services/fixtures/task_results.ts index c4f63d289..cd17bee92 100644 --- a/src/test/lib/services/fixtures/task_results.ts +++ b/src/test/lib/services/fixtures/task_results.ts @@ -1,4 +1,4 @@ -import { ContestType } from '$lib/types/contest'; +import { ContestType } from '$lib/contests/types/contest'; import { TaskGrade } from '$lib/types/task'; type MockedSubmissionStatus = { diff --git a/src/test/lib/utils/task.test.ts b/src/test/lib/utils/task.test.ts index f069db06a..8e8a3144e 100644 --- a/src/test/lib/utils/task.test.ts +++ b/src/test/lib/utils/task.test.ts @@ -13,7 +13,7 @@ import { } from './test_cases/task_results'; import { taskResultsForTaskTableHeaderName } from './test_cases/task_table_header_name'; -import { ContestType } from '$lib/types/contest'; +import { ContestType } from '$lib/contests/types/contest'; import { type TaskResult, type TaskResults } from '$lib/types/task'; import type { WorkBookTaskBase } from '$features/workbooks/types/workbook';