mirror of
https://github.com/iptv-org/database.git
synced 2025-05-09 19:20:01 -04:00
31 lines
537 B
TypeScript
31 lines
537 B
TypeScript
import { LanguageData } from '../types/language'
|
|
import { Model } from './model'
|
|
import Joi from 'joi'
|
|
|
|
export class Language extends Model {
|
|
code: string
|
|
name: string
|
|
|
|
constructor(data: LanguageData) {
|
|
super()
|
|
|
|
this.code = data.code
|
|
this.name = data.name
|
|
}
|
|
|
|
data(): LanguageData {
|
|
return {
|
|
code: this.code,
|
|
name: this.name
|
|
}
|
|
}
|
|
|
|
getSchema() {
|
|
return Joi.object({
|
|
code: Joi.string()
|
|
.regex(/^[a-z]{3}$/)
|
|
.required(),
|
|
name: Joi.string().required()
|
|
})
|
|
}
|
|
}
|