UNPKG

@golemio/pid

Version:
33 lines (32 loc) 2.02 kB
import { JISInfotextsRopidGTFSStopsModel } from "../../../schema-definitions/jis/models/JISInfotextsRopidGTFSStopsModel"; import { IJISInfotextsRopidGTFSStops } from "../../../schema-definitions/jis/models/interfaces"; import { ILogger } from "@golemio/core/dist/helpers"; import { IDatabaseConnector } from "@golemio/core/dist/helpers/data-access/postgres/IDatabaseConnector"; import { AbstractValidatableRepository } from "@golemio/core/dist/helpers/data-access/postgres/repositories/AbstractValidatableRepository"; import { JSONSchemaValidator } from "@golemio/core/dist/shared/golemio-validator"; import { ModelStatic, Transaction } from "@golemio/core/dist/shared/sequelize"; type RepositoryOptions = { transaction?: Transaction; }; export declare class JISInfotextsRopidGTFSStopsRepository extends AbstractValidatableRepository { validator: JSONSchemaValidator; schema: string; tableName: string; private sequelizeModel; constructor(connector: IDatabaseConnector, logger: ILogger); /** * Removes rows that were not touched during the current refresh cycle — any row whose `updated_at` * predates `dateTime` was absent from the latest feed and is considered stale. * Call this after `upsertAll` with the timestamp captured at the start of the save to clean up vanished entries. */ deleteAllLastUpdatedBefore(dateTime: Date, options?: RepositoryOptions): Promise<number>; /** * Inserts new rows or updates existing ones. On conflict, all columns except `created_at` are overwritten — * `created_at` is intentionally preserved to track when a row was first seen, while `updated_at` advances * each cycle so stale-record cleanup can identify entries missing from the latest feed. */ upsertAll(data: IJISInfotextsRopidGTFSStops[], options?: RepositoryOptions): ReturnType<ModelStatic<JISInfotextsRopidGTFSStopsModel>["bulkCreate"]>; private getUpdateAttributes; deleteAll(options?: RepositoryOptions): Promise<number>; } export {};