You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
170 lines
3.7 KiB
170 lines
3.7 KiB
const sequelize = require("sequelize") |
|
const db = require("../Config/db") |
|
|
|
const Customer = db.define( |
|
"SIADD", |
|
{ |
|
DB_CODE: { |
|
type: sequelize.STRING, |
|
// primaryKey: true, |
|
// autoIncrement: true |
|
}, |
|
ADD_CODE: { |
|
primaryKey: true, |
|
type: sequelize.STRING, |
|
}, |
|
ADD_LOOKUP: { |
|
type: sequelize.STRING, |
|
}, |
|
ADD_LINE_1: { |
|
type: sequelize.STRING, |
|
}, |
|
ADD_LINE_2: { |
|
type: sequelize.STRING, |
|
}, |
|
ADD_LINE_3: { |
|
type: sequelize.STRING, |
|
}, |
|
ADD_LINE_4: { |
|
type: sequelize.STRING, |
|
}, |
|
ADD_LINE_5: { |
|
type: sequelize.STRING, |
|
}, |
|
ADD_LINE_6: { |
|
type: sequelize.STRING, |
|
}, |
|
ADD_TEL: { |
|
type: sequelize.STRING, |
|
}, |
|
ADD_FAX: { |
|
type: sequelize.STRING, |
|
}, |
|
ADD_EMAIL: { |
|
type: sequelize.STRING, |
|
}, |
|
ADD_WEB: { |
|
type: sequelize.STRING, |
|
}, |
|
ADD_CONT: { |
|
type: sequelize.STRING, |
|
}, |
|
ADD_COM_1: { |
|
type: sequelize.STRING, |
|
}, |
|
ADD_COM_2: { |
|
type: sequelize.STRING, |
|
}, |
|
ADD_STAT: { |
|
type: sequelize.STRING, |
|
}, |
|
ADD_TYPE: { |
|
type: sequelize.STRING, |
|
}, |
|
ADD_LINE_1KH: { |
|
type: sequelize.STRING, |
|
}, |
|
ADD_LINE_2KH: { |
|
type: sequelize.STRING, |
|
}, |
|
ADD_LINE_3KH: { |
|
type: sequelize.STRING, |
|
}, |
|
TRANS_PRES: { |
|
type: sequelize.STRING, |
|
}, |
|
USER_CREA: { |
|
type: sequelize.STRING, |
|
}, |
|
USER_UPDT: { |
|
type: sequelize.STRING, |
|
}, |
|
USER_CODE: { |
|
type: sequelize.STRING, |
|
}, |
|
AREA_ID: { |
|
type: sequelize.STRING, |
|
}, |
|
MARKET_ID: { |
|
type: sequelize.STRING, |
|
}, |
|
STORE: { |
|
type: sequelize.STRING, |
|
}, |
|
GOOGLE_MAP: { |
|
type: sequelize.STRING, |
|
}, |
|
BUSINESS_TYPE: { |
|
type: sequelize.STRING, |
|
}, |
|
CREDIT_LIMIT: { |
|
type: sequelize.FLOAT, |
|
}, |
|
ID_CARD: { |
|
type: sequelize.STRING, |
|
}, |
|
PICTURE_ID: { |
|
type: sequelize.STRING, |
|
}, |
|
SALE_MAN_CODE: { |
|
type: sequelize.STRING, |
|
}, |
|
PICTURE: { |
|
type: sequelize.BLOB, |
|
}, |
|
SEX: { |
|
type: sequelize.STRING, |
|
}, |
|
HOUSE_NO: { |
|
type: sequelize.STRING, |
|
}, |
|
ROAD_NO: { |
|
type: sequelize.STRING, |
|
}, |
|
PROVINCE_ID: { |
|
type: sequelize.STRING, |
|
}, |
|
DISTRICT_ID: { |
|
type: sequelize.STRING, |
|
}, |
|
COMMUNE_ID: { |
|
type: sequelize.STRING, |
|
}, |
|
BANK_ACC: { |
|
type: sequelize.STRING, |
|
}, |
|
CUSTOM_FIELD_1: { |
|
type: sequelize.STRING, |
|
}, |
|
CUSTOM_FIELD_2: { |
|
type: sequelize.STRING, |
|
}, |
|
CUSTOM_FIELD_3: { |
|
type: sequelize.STRING, |
|
}, |
|
CUSTOM_FIELD_4: { |
|
type: sequelize.STRING, |
|
}, |
|
CUSTOM_FIELD_5: { |
|
type: sequelize.STRING, |
|
}, |
|
}, |
|
{ |
|
timestamps: false, |
|
freezeTableName: true, |
|
} |
|
) |
|
|
|
Customer.checkExistedById = async function (id = "") { |
|
var obj = await Customer.findOne( |
|
{ |
|
where: { |
|
ADD_CODE: id |
|
} |
|
} |
|
); |
|
return obj ? true : false; |
|
} |
|
|
|
Customer.removeAttribute("id") |
|
module.exports = Customer
|
|
|