"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DeparturePresetsRepository = void 0;
const const_1 = require("../../../schema-definitions/const");
const golemio_errors_1 = require("@golemio/core/dist/shared/golemio-errors");
const RopidDeparturesPresetsModel_1 = require("../../../schema-definitions/ropid-departures-presets/models/RopidDeparturesPresetsModel");
const golemio_validator_1 = require("@golemio/core/dist/shared/golemio-validator");
const integration_engine_1 = require("@golemio/core/dist/integration-engine");
class DeparturePresetsRepository extends integration_engine_1.PostgresModel {
    constructor() {
        super("DeparturePresetsRepository", {
            hasTmpTable: true,
            outputSequelizeAttributes: RopidDeparturesPresetsModel_1.RopidDeparturesPresetsModel.attributeModel,
            pgTableName: RopidDeparturesPresetsModel_1.RopidDeparturesPresetsModel.tableName,
            pgSchema: const_1.PG_SCHEMA,
            savingType: "insertOnly",
            addAuditAttributes: true,
        }, new golemio_validator_1.JSONSchemaValidator("DeparturePresetsRepository", RopidDeparturesPresetsModel_1.RopidDeparturesPresetsModel.jsonSchema));
        this.getAll = async () => {
            try {
                return this.sequelizeModel.findAll();
            }
            catch (err) {
                throw new golemio_errors_1.GeneralError("Database error", "DeparturePresetsRepository", err, 500);
            }
        };
    }
}
exports.DeparturePresetsRepository = DeparturePresetsRepository;
//# sourceMappingURL=DeparturePresetsRepository.js.map