feat: 다음 시즌 번호 필드 추가 및 프로필 메타 업데이트 로직 수정
This commit is contained in:
@@ -650,6 +650,7 @@ export const adminRouter = router({
|
|||||||
color: z.string().min(1).max(32).nullable().optional(),
|
color: z.string().min(1).max(32).nullable().optional(),
|
||||||
inGameNotice: z.string().max(4000).nullable().optional(),
|
inGameNotice: z.string().max(4000).nullable().optional(),
|
||||||
profileImageUrl: z.string().max(2048).nullable().optional(),
|
profileImageUrl: z.string().max(2048).nullable().optional(),
|
||||||
|
nextSeasonIdx: z.number().int().min(0).nullable().optional(),
|
||||||
}),
|
}),
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -204,6 +204,7 @@ type AdminClient = {
|
|||||||
color?: string | null;
|
color?: string | null;
|
||||||
inGameNotice?: string | null;
|
inGameNotice?: string | null;
|
||||||
profileImageUrl?: string | null;
|
profileImageUrl?: string | null;
|
||||||
|
nextSeasonIdx?: number | null;
|
||||||
};
|
};
|
||||||
}) => Promise<AdminProfile | null>;
|
}) => Promise<AdminProfile | null>;
|
||||||
};
|
};
|
||||||
@@ -279,6 +280,7 @@ const profileEdits = ref<
|
|||||||
color: string;
|
color: string;
|
||||||
inGameNotice: string;
|
inGameNotice: string;
|
||||||
profileImageUrl: string;
|
profileImageUrl: string;
|
||||||
|
nextSeasonIdx: string;
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
>({});
|
>({});
|
||||||
@@ -398,6 +400,10 @@ const ensureProfileBuffers = (profile: AdminProfile) => {
|
|||||||
color: String(meta.color ?? '#ffffff'),
|
color: String(meta.color ?? '#ffffff'),
|
||||||
inGameNotice: String(meta.inGameNotice ?? ''),
|
inGameNotice: String(meta.inGameNotice ?? ''),
|
||||||
profileImageUrl: String(meta.profileImageUrl ?? ''),
|
profileImageUrl: String(meta.profileImageUrl ?? ''),
|
||||||
|
nextSeasonIdx:
|
||||||
|
typeof meta.nextSeasonIdx === 'number' && Number.isFinite(meta.nextSeasonIdx)
|
||||||
|
? String(Math.floor(meta.nextSeasonIdx))
|
||||||
|
: '',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if (!profileActions.value[profile.profileName]) {
|
if (!profileActions.value[profile.profileName]) {
|
||||||
@@ -624,11 +630,21 @@ const updateProfileMeta = async (profileName: string) => {
|
|||||||
if (!edit) {
|
if (!edit) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
const nextSeasonRaw = edit.nextSeasonIdx.trim();
|
||||||
|
const nextSeasonIdx = nextSeasonRaw === '' ? null : Number(nextSeasonRaw);
|
||||||
|
if (nextSeasonIdx !== null && (!Number.isFinite(nextSeasonIdx) || nextSeasonIdx < 0)) {
|
||||||
|
profileActionStatus.value = {
|
||||||
|
...profileActionStatus.value,
|
||||||
|
[profileName]: '다음 시즌 번호는 0 이상 숫자여야 합니다.',
|
||||||
|
};
|
||||||
|
return;
|
||||||
|
}
|
||||||
const patch = {
|
const patch = {
|
||||||
korName: edit.korName.trim() || null,
|
korName: edit.korName.trim() || null,
|
||||||
color: edit.color.trim() || null,
|
color: edit.color.trim() || null,
|
||||||
inGameNotice: edit.inGameNotice.trim() || null,
|
inGameNotice: edit.inGameNotice.trim() || null,
|
||||||
profileImageUrl: edit.profileImageUrl.trim() || null,
|
profileImageUrl: edit.profileImageUrl.trim() || null,
|
||||||
|
nextSeasonIdx: nextSeasonIdx === null ? null : Math.floor(nextSeasonIdx),
|
||||||
};
|
};
|
||||||
try {
|
try {
|
||||||
const updated = await adminClient.profiles.updateMeta.mutate({
|
const updated = await adminClient.profiles.updateMeta.mutate({
|
||||||
@@ -1372,6 +1388,16 @@ onMounted(() => {
|
|||||||
type="text"
|
type="text"
|
||||||
class="w-full bg-zinc-950 border border-zinc-700 rounded px-3 py-2 text-sm text-white"
|
class="w-full bg-zinc-950 border border-zinc-700 rounded px-3 py-2 text-sm text-white"
|
||||||
/>
|
/>
|
||||||
|
<label class="text-xs text-zinc-400">다음 시즌 번호</label>
|
||||||
|
<input
|
||||||
|
v-model="profileEdits[profile.profileName].nextSeasonIdx"
|
||||||
|
type="number"
|
||||||
|
min="0"
|
||||||
|
step="1"
|
||||||
|
class="w-full bg-zinc-950 border border-zinc-700 rounded px-3 py-2 text-sm text-white"
|
||||||
|
placeholder="예: 12"
|
||||||
|
/>
|
||||||
|
<div class="text-xs text-zinc-500">리셋 시 적용할 시즌 번호를 지정합니다.</div>
|
||||||
<button
|
<button
|
||||||
class="bg-emerald-600 hover:bg-emerald-500 text-black font-semibold px-4 py-2 rounded"
|
class="bg-emerald-600 hover:bg-emerald-500 text-black font-semibold px-4 py-2 rounded"
|
||||||
@click="updateProfileMeta(profile.profileName)"
|
@click="updateProfileMeta(profile.profileName)"
|
||||||
|
|||||||
Reference in New Issue
Block a user