Loading backend/src/app.module.ts +2 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ import { ServeStaticModule } from '@nestjs/serve-static'; import { join } from 'path'; import { Town } from './town/entities/town.entity'; import { TownModule } from './town/town.module'; import { TownTraduction } from './town/entities/town-traduction.entity'; @Module({ imports: [ TypeOrmModule.forRoot({ Loading @@ -25,7 +26,7 @@ import { TownModule } from './town/town.module'; username: DbConstants.DB_USER, password: DbConstants.DB_PASSWORD, database: DbConstants.DB_NAME, entities: [Admin, User, State, Town], entities: [Admin, User, State, Town, TownTraduction], synchronize: DbConstants.DB_SYNC, }), AuthAdminModule, Loading backend/src/enum/languages.enum.ts 0 → 100644 +4 −0 Original line number Diff line number Diff line export enum LANGUAGES { EN = 'en', ES = 'es', } backend/src/town/dto/create-town-trad.dto.ts 0 → 100644 +8 −0 Original line number Diff line number Diff line import { LANGUAGES } from 'src/enum/languages.enum'; export class CreateTownTraductionDto { townId: number; language: LANGUAGES; name: string; description: string; } backend/src/town/dto/create-town.dto.ts +12 −2 Original line number Diff line number Diff line Loading @@ -3,8 +3,18 @@ import { ApiProperty } from '@nestjs/swagger'; export class CreateTownDto { @ApiProperty() name: string; @ApiProperty() description: string; @ApiProperty({ type: String, description: 'Language content for Spanish (es)', }) descriptionES: string; @ApiProperty({ type: String, description: 'Language content for English (en)', }) descriptionEN: string; imageName: string = 'default.jpg'; @ApiProperty() state: number; Loading backend/src/town/entities/town-traduction.entity.ts 0 → 100644 +14 −0 Original line number Diff line number Diff line import { Entity, Column, OneToOne, PrimaryColumn } from 'typeorm'; import { Town } from './town.entity'; import { LANGUAGES } from 'src/enum/languages.enum'; @Entity() export class TownTraduction { @PrimaryColumn() @OneToOne(() => Town, (town) => town.townId) townId: number; @PrimaryColumn() language: LANGUAGES; @Column() description: string; } Loading
backend/src/app.module.ts +2 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ import { ServeStaticModule } from '@nestjs/serve-static'; import { join } from 'path'; import { Town } from './town/entities/town.entity'; import { TownModule } from './town/town.module'; import { TownTraduction } from './town/entities/town-traduction.entity'; @Module({ imports: [ TypeOrmModule.forRoot({ Loading @@ -25,7 +26,7 @@ import { TownModule } from './town/town.module'; username: DbConstants.DB_USER, password: DbConstants.DB_PASSWORD, database: DbConstants.DB_NAME, entities: [Admin, User, State, Town], entities: [Admin, User, State, Town, TownTraduction], synchronize: DbConstants.DB_SYNC, }), AuthAdminModule, Loading
backend/src/enum/languages.enum.ts 0 → 100644 +4 −0 Original line number Diff line number Diff line export enum LANGUAGES { EN = 'en', ES = 'es', }
backend/src/town/dto/create-town-trad.dto.ts 0 → 100644 +8 −0 Original line number Diff line number Diff line import { LANGUAGES } from 'src/enum/languages.enum'; export class CreateTownTraductionDto { townId: number; language: LANGUAGES; name: string; description: string; }
backend/src/town/dto/create-town.dto.ts +12 −2 Original line number Diff line number Diff line Loading @@ -3,8 +3,18 @@ import { ApiProperty } from '@nestjs/swagger'; export class CreateTownDto { @ApiProperty() name: string; @ApiProperty() description: string; @ApiProperty({ type: String, description: 'Language content for Spanish (es)', }) descriptionES: string; @ApiProperty({ type: String, description: 'Language content for English (en)', }) descriptionEN: string; imageName: string = 'default.jpg'; @ApiProperty() state: number; Loading
backend/src/town/entities/town-traduction.entity.ts 0 → 100644 +14 −0 Original line number Diff line number Diff line import { Entity, Column, OneToOne, PrimaryColumn } from 'typeorm'; import { Town } from './town.entity'; import { LANGUAGES } from 'src/enum/languages.enum'; @Entity() export class TownTraduction { @PrimaryColumn() @OneToOne(() => Town, (town) => town.townId) townId: number; @PrimaryColumn() language: LANGUAGES; @Column() description: string; }