@golemio/pid
Version:
Golemio PID Module
33 lines (32 loc) • 1.98 kB
TypeScript
import { JISInfotextsPresetsModel } from "../../../schema-definitions/jis/models/JISInfotextsPresetsModel";
import { IJISInfotextsPresets } 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 JISInfotextsPresetsRepository extends AbstractValidatableRepository {
validator: JSONSchemaValidator;
schema: string;
tableName: string;
private sequelizeModel;
constructor(connector: IDatabaseConnector, logger: ILogger);
/**
* 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: IJISInfotextsPresets[], options?: RepositoryOptions): ReturnType<ModelStatic<JISInfotextsPresetsModel>["bulkCreate"]>;
/**
* 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>;
deleteAll(options?: RepositoryOptions): Promise<number>;
private getUpdateAttributes;
}
export {};