mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-12-03 17:41:51 +00:00
fix date as string
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import { type Opt, type Ref, defineEntity, p, EntityRepository } from '@mikro-orm/core';
|
||||
import { BucketList } from './BucketList.js';
|
||||
import { Places } from './Places.js';
|
||||
import { Trips } from './Trips.js';
|
||||
import { Users } from './Users.js';
|
||||
import { defineEntity, EntityRepository, type Opt, p, type Ref } from '@mikro-orm/core';
|
||||
|
||||
export class DawarichVisitSuggestions {
|
||||
id?: number | null;
|
||||
@@ -38,9 +38,7 @@ export class DawarichVisitSuggestionsRepository extends EntityRepository<Dawaric
|
||||
export const DawarichVisitSuggestionsSchema = defineEntity({
|
||||
class: DawarichVisitSuggestions,
|
||||
repository: () => DawarichVisitSuggestionsRepository,
|
||||
indexes: [
|
||||
{ name: 'idx_dawarich_suggestions_user_state', properties: ['user', 'state'] },
|
||||
],
|
||||
indexes: [{ name: 'idx_dawarich_suggestions_user_state', properties: ['user', 'state'] }],
|
||||
properties: {
|
||||
id: p.integer().primary().autoincrement(),
|
||||
user: () => p.manyToOne(Users).ref().deleteRule('cascade'),
|
||||
@@ -66,7 +64,7 @@ export const DawarichVisitSuggestionsSchema = defineEntity({
|
||||
sourceHash: p.text(),
|
||||
acceptedHash: p.text().nullable(),
|
||||
sourceMissingAt: p.text().nullable(),
|
||||
firstSeenAt: p.text().onCreate(() => new Date()),
|
||||
lastSeenAt: p.text().onCreate(() => new Date()),
|
||||
firstSeenAt: p.text().onCreate(() => new Date().toISOString().replace(/\.\d{3}Z$/, 'Z')),
|
||||
lastSeenAt: p.text().onCreate(() => new Date().toISOString().replace(/\.\d{3}Z$/, 'Z')),
|
||||
},
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { PrimaryKeyProp, type Ref, defineEntity, p, EntityRepository } from '@mikro-orm/core';
|
||||
import { Days } from './Days.js';
|
||||
import { Places } from './Places.js';
|
||||
import { defineEntity, EntityRepository, p, PrimaryKeyProp, type Ref } from '@mikro-orm/core';
|
||||
|
||||
export class RoadtripDayTracks {
|
||||
[PrimaryKeyProp]?: 'day';
|
||||
@@ -19,6 +19,9 @@ export const RoadtripDayTracksSchema = defineEntity({
|
||||
day: () => p.oneToOne(Days).primary().ref().nullable(),
|
||||
place: () => p.manyToOne(Places).ref().deleteRule('cascade').index('idx_roadtrip_day_tracks_place'),
|
||||
strayKm: p.double().nullable(),
|
||||
createdAt: p.text().nullable().onCreate(() => new Date()),
|
||||
createdAt: p
|
||||
.text()
|
||||
.nullable()
|
||||
.onCreate(() => new Date().toISOString().replace(/\.\d{3}Z$/, 'Z')),
|
||||
},
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { type Opt, type Ref, defineEntity, p, EntityRepository } from '@mikro-orm/core';
|
||||
import { Days } from './Days.js';
|
||||
import { defineEntity, EntityRepository, type Opt, p, type Ref } from '@mikro-orm/core';
|
||||
|
||||
export class RoadtripVias {
|
||||
id?: number | null;
|
||||
@@ -29,6 +29,9 @@ export const RoadtripViasSchema = defineEntity({
|
||||
sequence: p.integer(),
|
||||
lat: p.double(),
|
||||
lng: p.double(),
|
||||
createdAt: p.text().nullable().onCreate(() => new Date()),
|
||||
createdAt: p
|
||||
.text()
|
||||
.nullable()
|
||||
.onCreate(() => new Date().toISOString().replace(/\.\d{3}Z$/, 'Z')),
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user