95 lines
2.5 KiB
TypeScript
95 lines
2.5 KiB
TypeScript
import {
|
|
CreationOptional,
|
|
DataTypes,
|
|
InferAttributes,
|
|
InferCreationAttributes,
|
|
Model,
|
|
NonAttribute,
|
|
Sequelize,
|
|
} from "sequelize";
|
|
import { CustomerInvoiceParticipant_Model } from "./customer-invoiceParticipant.mo.del.ts.bak";
|
|
|
|
export type TCreationCustomerInvoiceParticipantAddress_Model = InferCreationAttributes<
|
|
CustomerInvoiceParticipantAddress_Model,
|
|
{ omit: "participant" }
|
|
>;
|
|
|
|
export class CustomerInvoiceParticipantAddress_Model extends Model<
|
|
InferAttributes<CustomerInvoiceParticipantAddress_Model, { omit: "participant" }>,
|
|
InferCreationAttributes<CustomerInvoiceParticipantAddress_Model, { omit: "participant" }>
|
|
> {
|
|
static associate(connection: Sequelize) {
|
|
const { CustomerInvoiceParticipantAddress_Model, CustomerInvoiceParticipant_Model } = connection.models;
|
|
CustomerInvoiceParticipantAddress_Model.belongsTo(CustomerInvoiceParticipant_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<CustomerInvoiceParticipant_Model>;
|
|
}
|
|
|
|
export default (sequelize: Sequelize) => {
|
|
CustomerInvoiceParticipantAddress_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: "customerInvoice_participant_addresses",
|
|
}
|
|
);
|
|
|
|
return CustomerInvoiceParticipantAddress_Model;
|
|
};
|