feat: support changing quest language

This commit is contained in:
neilchen0812 committed 2026-10-08 02:46:44 +10:30
1 parent 9b8d7109cf
commit 66b0b7ba68
18 files changed
+313 -109

No files matched your search

+7
View File
@@ -16,3 +16,10 @@ export const getSessionsRequestSchema = z.object({
})
export type GetSessionsRequest = z.infer<typeof getSessionsRequestSchema>
export const SUPPORTED_LOCALES = ['zh-TW', 'en'] as const
export const LOCALE_NAME_MAP: Record<string, string> = {
'zh-TW': '繁體中文',
en: 'English',
}
export type QuestLocale = (typeof SUPPORTED_LOCALES)[number]
+8
View File
@@ -1,4 +1,6 @@
import { model, Schema, Types } from 'mongoose'
import type { QuestLocale } from '../constants'
import { SUPPORTED_LOCALES } from '../constants'
export interface INode {
path: string
@@ -27,6 +29,7 @@ export interface ISession {
_id: Types.ObjectId
user: Types.ObjectId
quest: string
locale: QuestLocale
containerId: string | null
containerName: string | null
status: 'active' | 'finished' | 'inactive'
@@ -52,6 +55,11 @@ export const Session = model<ISession>(
ref: 'Quest',
required: true,
},
locale: {
type: String,
enum: SUPPORTED_LOCALES,
required: true,
},
containerId: String,
containerName: String,
status: {