Skip to content

Commit

Permalink
fix: remove language from User
Browse files Browse the repository at this point in the history
  • Loading branch information
evermake committed Apr 7, 2024
1 parent 825ea15 commit 404a6b5
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 8 deletions.
2 changes: 1 addition & 1 deletion backend/src/bot/plugins/translations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export type TranslationsFlavor = {

export const install: InstallFn<TranslationsFlavor & DomainFlavor> = (bot) => {
bot.use((ctx, next) => {
ctx.t = translations[ctx.user?.language as Language] ?? translations.en
ctx.t = translations[ctx.from?.language_code as Language] ?? translations.en
return next()
})
}
4 changes: 0 additions & 4 deletions backend/src/domain/schemas/common.ts

This file was deleted.

1 change: 0 additions & 1 deletion backend/src/domain/schemas/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
export * from './common'
export * from './user'
2 changes: 0 additions & 2 deletions backend/src/domain/schemas/user.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import { z } from 'zod'
import { Language } from './common'

export const User = z.object({
telegramId: z.coerce.number().int(),
createdAt: z.date(),
username: z.string().nullable(),
firstName: z.string(),
lastName: z.string().nullable(),
language: Language.nullable(),
})
export type User = z.infer<typeof User>

0 comments on commit 404a6b5

Please sign in to comment.