fix(tours): give the tour entities back their generated form

The format run rewrote two files that check:entities holds byte for byte
to the generator's output; .prettierignore excludes them for that reason.
This commit is contained in:
Maurice
2026-10-20 19:07:12 +02:00
parent de043cfb58
commit 57f0e2f263
2 changed files with 6 additions and 10 deletions
@@ -1,9 +1,9 @@
import { EntityRepositoryType, type Opt, type Ref, defineEntity, p } from '@mikro-orm/core';
import { CollectionToursRepository } from '../repositories/CollectionTours.repository';
import { DbTimestampType } from '../types';
import { Collections } from './Collections.entity';
import { TourTypes } from './TourTypes.entity';
import { Users } from './Users.entity';
import { EntityRepositoryType, type Opt, type Ref, defineEntity, p } from '@mikro-orm/core';
export class CollectionTours {
[EntityRepositoryType]?: CollectionToursRepository;
@@ -55,8 +55,7 @@ export const CollectionToursSchema = defineEntity({
repository: () => CollectionToursRepository,
properties: {
id: p.integer().primary(),
collection: () =>
p.manyToOne(Collections).ref().deleteRule('cascade').hidden().index('idx_collection_tours_collection'),
collection: () => p.manyToOne(Collections).ref().deleteRule('cascade').hidden().index('idx_collection_tours_collection'),
collection_id: p.integer().persist(false).index('idx_collection_tours_collection'),
saved_by: p.integer().nullable().persist(false).index('idx_collection_tours_saved_by'),
name: p.text(),
@@ -94,9 +93,7 @@ export const CollectionToursSchema = defineEntity({
source_trip_title: p.text(),
source_tour_name: p.text(),
created_at: p.type(DbTimestampType).defaultRaw(`CURRENT_TIMESTAMP`),
tourTypeRef: () =>
p.manyToOne(TourTypes).ref().joinColumn('tour_type').hidden().index('idx_collection_tours_tour_type'),
savedByRef: () =>
p.manyToOne(Users).ref().joinColumn('saved_by').nullable().hidden().index('idx_collection_tours_saved_by'),
tourTypeRef: () => p.manyToOne(TourTypes).ref().joinColumn('tour_type').hidden().index('idx_collection_tours_tour_type'),
savedByRef: () => p.manyToOne(Users).ref().joinColumn('saved_by').nullable().hidden().index('idx_collection_tours_saved_by'),
},
});
+2 -3
View File
@@ -1,3 +1,4 @@
import { Collection, EntityRepositoryType, type Opt, PrimaryKeyProp, type Ref, defineEntity, p } from '@mikro-orm/core';
import { ToursRepository } from '../repositories/Tours.repository';
import { DbTimestampType } from '../types';
import { Places } from './Places.entity';
@@ -9,7 +10,6 @@ import { TourPackingLinks } from './TourPackingLinks.entity';
import { TourSources } from './TourSources.entity';
import { TourTypes } from './TourTypes.entity';
import { TourWaypoints } from './TourWaypoints.entity';
import { Collection, EntityRepositoryType, type Opt, PrimaryKeyProp, type Ref, defineEntity, p } from '@mikro-orm/core';
export class Tours {
[EntityRepositoryType]?: ToursRepository;
@@ -140,8 +140,7 @@ export const ToursSchema = defineEntity({
checks: [
{
name: 'tours_run_pace_seconds_per_km_check',
expression:
'run_pace_seconds_per_km IS NULL OR (run_pace_seconds_per_km >= 120 AND run_pace_seconds_per_km <= 1200)',
expression: 'run_pace_seconds_per_km IS NULL OR (run_pace_seconds_per_km >= 120 AND run_pace_seconds_per_km <= 1200)',
},
{ name: 'tours_revision_check', expression: 'revision >= 1' },
],