feat: 小项类型加「个人+团体」+ 报名导入拆团体/个人两部分
小项类型: - 迁移 0016 给 events.event_type 的 CHECK 增加 individual_team。SQLite 改不了 CHECK, 而 events 被多张子表引用(含 ON DELETE CASCADE/SET NULL),事务内 DROP 重建会级联删数据, 故用 writable_schema 就地改写建表语句文本(只追加一个枚举值,'match' 在建表语句里仅出现一次, 无副作用),零数据搬动 - domain 加 EventTypeIndividualTeam;管理端下拉加「个人+团体」并提示会同时走两条通道; guards/rules 的 eventType 白名单同步(否则会被降级成 individual) - 注意:该类型目前只解决「能被选出来」,双计的算分语义(个人分不计入单位、团体按队内平均排名) 尚未实现,等口径确认后再动数据模型 报名导入: - 卡片拆成「个人报名 / 团体报名」两个 tab,小项+组别提到 tab 之上共享 - 团体报名 = 从已配置单位清单里多选(默认全不勾,正好表达「部分单位不参加」), 可逐单位为登记队员(0 人即纯单位报名),一次提交为多个单位各建一条报名 - 已报名单位仍可覆盖名单,但会提示「提交将清空原名单」,且「全选」只勾启用中且未报名的单位 自检:服务端 12 包全绿;前端 vue-tsc + build、node --test 117/117;console 16 文件通过。
This commit is contained in:
1 parent
b5f40642ff
commit
592e47aef7
19 files changed
+1318
-117
No files matched your search
@@ -73,7 +73,7 @@ export function oneOf<T extends string>(value: unknown, allowed: readonly T[], f
|
||||
: fallback
|
||||
}
|
||||
|
||||
const EVENT_TYPES = ['individual', 'team', 'match'] as const satisfies readonly EventType[]
|
||||
const EVENT_TYPES = ['individual', 'team', 'match', 'individual_team'] as const satisfies readonly EventType[]
|
||||
const RESULT_MODES = ['auto', 'manual'] as const satisfies readonly ResultMode[]
|
||||
const RESULT_TYPES = ['time', 'distance', 'count', 'score', 'none'] as const satisfies readonly ResultType[]
|
||||
const COMPARE_MODES = ['asc', 'desc', 'none'] as const satisfies readonly CompareMode[]
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
import { test } from 'node:test'
|
||||
import assert from 'node:assert/strict'
|
||||
import { parseEvent } from '../guards'
|
||||
|
||||
// 大屏快照里的 eventType 不能因为不认识新类型就回落到 individual:
|
||||
// 「个人+团体」不是个人项目,降级会让大屏按错误口径展示。
|
||||
test('parseEvent 原样保留 individual_team', () => {
|
||||
const event = parseEvent({
|
||||
id: 1,
|
||||
sportId: 3,
|
||||
code: 'TPULL',
|
||||
name: '团体引体向上(个人+团体)',
|
||||
eventType: 'individual_team',
|
||||
resultMode: 'auto',
|
||||
resultType: 'count',
|
||||
compare: 'desc',
|
||||
scored: true,
|
||||
status: 'pending',
|
||||
})
|
||||
|
||||
assert.equal(event.eventType, 'individual_team')
|
||||
})
|
||||
|
||||
test('parseEvent 仍接受原有三种类型', () => {
|
||||
for (const eventType of ['individual', 'team', 'match'] as const) {
|
||||
const event = parseEvent({ id: 1, sportId: 1, code: 'E', name: '示例', eventType })
|
||||
assert.equal(event.eventType, eventType)
|
||||
}
|
||||
})
|
||||
Reference in new issue
Block a user