mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-21 06:26:26 +00:00
chore(tours): format the ski and winter files
This commit is contained in:
@@ -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,7 +55,8 @@ 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(),
|
||||
@@ -93,7 +94,9 @@ 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'),
|
||||
},
|
||||
});
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
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';
|
||||
@@ -10,6 +9,7 @@ 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,7 +140,8 @@ 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' },
|
||||
],
|
||||
|
||||
@@ -91,7 +91,7 @@ describe('collection tour helpers (LIB-03)', () => {
|
||||
it('LIB3-HLP-007: a kept tour carries what the trip list shows of its type, and its stages', () => {
|
||||
expect(keptTourItem(row)).toMatchObject({
|
||||
bike_profile: 'gravel',
|
||||
ski_discipline: null,
|
||||
ski_discipline: null,
|
||||
run_pace_seconds_per_km: null,
|
||||
stage_count: null,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user