릴리스: v1.3.49 템플릿 요청 저장 흐름과 관리자 미리보기 정리
This commit is contained in:
@@ -67,7 +67,6 @@ const templateRequestSchema = z.object({
|
||||
thumbnailSrc: z.string().max(255).optional().default(''),
|
||||
isPublic: z.boolean().optional().default(false),
|
||||
showCharacterNames: z.boolean().optional().default(false),
|
||||
saveToMyTierList: z.boolean().optional().default(true),
|
||||
groups: z.array(
|
||||
z.object({
|
||||
id: z.string().min(1),
|
||||
@@ -243,31 +242,14 @@ router.post('/template-request', requireAuth, async (req, res) => {
|
||||
if (sourceTierList.authorId !== req.session.userId) return res.status(403).json({ error: 'forbidden' })
|
||||
}
|
||||
|
||||
let savedTierList = null
|
||||
if (payload.saveToMyTierList) {
|
||||
savedTierList = await saveTierList({
|
||||
id: sourceTierList?.id || undefined,
|
||||
authorId: req.session.userId,
|
||||
gameId: payload.gameId,
|
||||
title: payload.requestTitle,
|
||||
thumbnailSrc: payload.thumbnailSrc || '',
|
||||
description: payload.requestDescription || '',
|
||||
isPublic: !!payload.isPublic,
|
||||
showCharacterNames: !!payload.showCharacterNames,
|
||||
sourceTierListId: sourceTierList?.sourceTierListId || '',
|
||||
sourceSnapshotTitle: sourceTierList?.sourceSnapshotTitle || '',
|
||||
sourceSnapshotAuthor: sourceTierList?.sourceSnapshotAuthor || '',
|
||||
groups: payload.groups,
|
||||
pool: normalizedBoardItems,
|
||||
})
|
||||
}
|
||||
if (!payload.sourceTierListId) return res.status(400).json({ error: 'source_tierlist_required' })
|
||||
|
||||
try {
|
||||
const request = await createTemplateRequest({
|
||||
id: nanoid(),
|
||||
type: payload.type,
|
||||
requesterId: req.session.userId,
|
||||
sourceTierListId: savedTierList?.id || sourceTierList?.id || '',
|
||||
sourceTierListId: sourceTierList?.id || '',
|
||||
sourceGameId: payload.gameId,
|
||||
targetGameId: payload.type === 'update' ? payload.gameId : '',
|
||||
title: payload.requestTitle,
|
||||
@@ -278,7 +260,7 @@ router.post('/template-request', requireAuth, async (req, res) => {
|
||||
boardItems: normalizedBoardItems,
|
||||
showCharacterNames: !!payload.showCharacterNames,
|
||||
})
|
||||
return res.json({ request, savedTierList: savedTierList ? normalizeTierList(savedTierList) : null })
|
||||
return res.json({ request })
|
||||
} catch (e) {
|
||||
if (e?.code === 'TEMPLATE_REQUEST_EXISTS') {
|
||||
return res.status(409).json({ error: 'template_request_exists' })
|
||||
|
||||
Reference in New Issue
Block a user