Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | import { PlanetBuildDtoMeta } from '@contracts/dto/forms/meta/planetBuildDto.meta'; import { PlanetBuildDto } from '@contracts/dto/forms/planetBuildDto'; import { cyrb53 } from '@helpers/hashHelper'; import { getDatabaseService } from '@services/external/database/databaseService'; import { PlanetBuild } from '@services/external/database/xata'; import { IApiModule } from '../../types/baseModule'; import { IPlanetBuildImages, planetBuildFileHandler } from './planetBuildFileHandler'; import { planetBuildDtoWithImageToPersistence, planetBuildPersistenceToDto, } from './planetBuildMapper'; import { planetBuildPublicUrlHandler } from './planetBuildPublicUrlHandler'; import { planetBuildAdditionalPropertiesToDto, planetBuildCreateRelationships, } from './planetBuildRelationshipsHandler'; const getDbTable = () => getDatabaseService().planetBuild(); export const planetBuildModule: IApiModule<PlanetBuildDto, IPlanetBuildImages, PlanetBuild> = { segment: 'planetBuild', dtoMeta: PlanetBuildDtoMeta, sendDiscordMessageOnSubmission: true, getName: (persistence: PlanetBuild) => persistence.name, getIcon: (persistence: PlanetBuild) => persistence.mediaUrls?.[0] ?? '', mapDtoWithImageToPersistence: planetBuildDtoWithImageToPersistence, mapPersistenceToDto: planetBuildPersistenceToDto, mapRecordRelationshipsToDto: planetBuildAdditionalPropertiesToDto, createRecord: (persistence) => getDbTable().create(persistence), createRecordRelationships: planetBuildCreateRelationships, readRecord: (id: string) => getDbTable().read(id), readAllRecords: () => getDbTable().readAll(), updateRecord: (id, persistence) => getDbTable().update(id, persistence), handleFilesInFormData: planetBuildFileHandler, getPublicUrlsOfUploads: planetBuildPublicUrlHandler, calculateCheck: (p) => cyrb53([p.id, p.name, p.planetName, p.contactDetails].join('-')), }; |