mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-05 19:20:12 +08:00
feat: support changing quest language
This commit is contained in:
1 parent
9b8d7109cf
commit
66b0b7ba68
18 files changed
+313
-109
No files matched your search
@@ -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]
|
||||
@@ -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: {
|
||||
|
||||
Reference in new issue
Block a user