2025-03-18 08:05:00 +00:00
|
|
|
import {
|
|
|
|
|
CreationOptional,
|
|
|
|
|
DataTypes,
|
|
|
|
|
InferAttributes,
|
|
|
|
|
InferCreationAttributes,
|
|
|
|
|
Model,
|
|
|
|
|
NonAttribute,
|
|
|
|
|
Sequelize,
|
|
|
|
|
} from "sequelize";
|
2025-04-01 14:26:15 +00:00
|
|
|
import { InvoiceParticipant_Model } from "./invoiceParticipant.mo.del";
|
2025-03-18 08:05:00 +00:00
|
|
|
|
|
|
|
|
export type TCreationInvoiceParticipantAddress_Model = InferCreationAttributes<
|
|
|
|
|
InvoiceParticipantAddress_Model,
|
|
|
|
|
{ omit: "participant" }
|
|
|
|
|
>;
|
|
|
|
|
|
|
|
|
|
export class InvoiceParticipantAddress_Model extends Model<
|
|
|
|
|
InferAttributes<InvoiceParticipantAddress_Model, { omit: "participant" }>,
|
2025-04-01 14:26:15 +00:00
|
|
|
InferCreationAttributes<InvoiceParticipantAddress_Model, { omit: "participant" }>
|
2025-03-18 08:05:00 +00:00
|
|
|
> {
|
|
|
|
|
static associate(connection: Sequelize) {
|
2025-04-01 14:26:15 +00:00
|
|
|
const { InvoiceParticipantAddress_Model, InvoiceParticipant_Model } = connection.models;
|
2025-03-18 08:05:00 +00:00
|
|
|
InvoiceParticipantAddress_Model.belongsTo(InvoiceParticipant_Model, {
|
|
|
|
|
as: "participant",
|
|
|
|
|
foreignKey: "participant_id",
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
declare address_id: string;
|
|
|
|
|
declare participant_id: string;
|
|
|
|
|
declare type: string;
|
|
|
|
|
declare street: CreationOptional<string>;
|
|
|
|
|
declare postal_code: CreationOptional<string>;
|
|
|
|
|
declare city: CreationOptional<string>;
|
|
|
|
|
declare province: CreationOptional<string>;
|
|
|
|
|
declare country: CreationOptional<string>;
|
|
|
|
|
declare phone: CreationOptional<string>;
|
|
|
|
|
declare email: CreationOptional<string>;
|
|
|
|
|
|
|
|
|
|
declare participant?: NonAttribute<InvoiceParticipant_Model>;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default (sequelize: Sequelize) => {
|
|
|
|
|
InvoiceParticipantAddress_Model.init(
|
|
|
|
|
{
|
|
|
|
|
address_id: {
|
|
|
|
|
type: new DataTypes.UUID(),
|
|
|
|
|
primaryKey: true,
|
|
|
|
|
},
|
|
|
|
|
participant_id: {
|
|
|
|
|
type: new DataTypes.UUID(),
|
|
|
|
|
primaryKey: true,
|
|
|
|
|
},
|
|
|
|
|
type: {
|
|
|
|
|
type: new DataTypes.STRING(),
|
|
|
|
|
allowNull: false,
|
|
|
|
|
},
|
|
|
|
|
street: {
|
|
|
|
|
type: new DataTypes.STRING(),
|
|
|
|
|
allowNull: true,
|
|
|
|
|
},
|
|
|
|
|
postal_code: {
|
|
|
|
|
type: new DataTypes.STRING(),
|
|
|
|
|
allowNull: true,
|
|
|
|
|
},
|
|
|
|
|
city: {
|
|
|
|
|
type: new DataTypes.STRING(),
|
|
|
|
|
allowNull: true,
|
|
|
|
|
},
|
|
|
|
|
province: {
|
|
|
|
|
type: new DataTypes.STRING(),
|
|
|
|
|
allowNull: true,
|
|
|
|
|
},
|
|
|
|
|
country: {
|
|
|
|
|
type: new DataTypes.STRING(),
|
|
|
|
|
allowNull: true,
|
|
|
|
|
},
|
|
|
|
|
email: {
|
|
|
|
|
type: new DataTypes.STRING(),
|
|
|
|
|
allowNull: true,
|
|
|
|
|
},
|
|
|
|
|
phone: {
|
|
|
|
|
type: new DataTypes.STRING(),
|
|
|
|
|
allowNull: true,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
sequelize,
|
|
|
|
|
tableName: "invoice_participant_addresses",
|
2025-04-01 14:26:15 +00:00
|
|
|
}
|
2025-03-18 08:05:00 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
return InvoiceParticipantAddress_Model;
|
|
|
|
|
};
|