update view holiday
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Bernat Exposito Domenech 2020-03-12 10:59:41 +01:00
parent ac2b04d117
commit 6798f9709c
5 changed files with 12 additions and 12 deletions

View File

@ -23,12 +23,12 @@ module.exports = Self => {
beginningYear.setHours(0, 0, 0, 0);
let holidays = await Self.rawSql(
`SELECT lh.dated, chn.name, cht.name, w.id
FROM vn.holiday lh
JOIN vn.workCenter w ON w.id = lh.workcenterFk
LEFT JOIN vn.calendarHolidaysName chn ON chn.id = lh.holidayDetailFk
LEFT JOIN vn.calendarHolidaysType cht ON cht.id = lh.holidayTypeFk
WHERE w.warehouseFk = ? AND lh.dated >= ?`, [warehouseFk, beginningYear]);
`SELECT clh.dated, chn.name, cht.name, w.id
FROM vn.calendarHolidays clh
JOIN vn.workCenter w ON w.id = clh.workcenterFk
LEFT JOIN vn.calendarHolidaysName chn ON chn.id = clh.calendarHolidaysNameFk
LEFT JOIN vn.calendarHolidaysType cht ON cht.id = clh.calendarHolidaysTypeFk
WHERE w.warehouseFk = ? AND clh.dated >= ?`, [warehouseFk, beginningYear]);
return holidays.map(holiday => {
holiday.dated = new Date(holiday.dated);

View File

@ -5,7 +5,7 @@
"Department": {
"dataSource": "vn"
},
"Holiday": {
"CalendarHoliday": {
"dataSource": "vn"
},
"CalendarHolidaysName": {

View File

@ -1,17 +1,17 @@
{
"name": "Holiday",
"name": "CalendarHoliday",
"base": "VnModel",
"options": {
"mysql": {
"table": "holiday"
"table": "calendarHolidays"
}
},
"properties": {
"holidayDetailFk": {
"calendarHolidaysNameFk": {
"id": true,
"type": "Number"
},
"holidayTypeFk": {
"calendarHolidaysTypeFk": {
"id": true,
"type": "Number"
},

View File

@ -23,7 +23,7 @@
},
"holidays": {
"type": "hasMany",
"model": "Holiday",
"model": "CalendarHoliday",
"foreignKey": "workCenterFk"
}
},