Skip to content

Commit

Permalink
fix: fixed XML response for sync
Browse files Browse the repository at this point in the history
  • Loading branch information
titanism committed Jul 17, 2024
1 parent 10ca160 commit d95dc5b
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions routes/calendar/calendar/get.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const { setMissingMethod } = require('../../../common/response');
const winston = require('../../../common/winston');
const { response, status } = require('../../../common/x-build');

module.exports = function (options) {
const log = winston({ ...options, label: 'calendar/get' });
Expand All @@ -13,7 +14,16 @@ module.exports = function (options) {
fullData: true
});

return options.data.buildICS(ctx, events, calendar);
// return options.data.buildICS(ctx, events, calendar);
const ics = await options.data.buildICS(ctx, events, calendar);
return response(ctx.url, status[200], [
{
'D:getetag': options.data.getETag(ctx, calendar)
},
{
'CAL:calendar-data': ics
}
]);
}

const event = await options.data.getEvent(ctx, {
Expand All @@ -29,7 +39,18 @@ module.exports = function (options) {
return;
}

return options.data.buildICS(ctx, event, calendar);
// return options.data.buildICS(ctx, event, calendar);
const ics = await options.data.buildICS(ctx, event, calendar);
return response(ctx.url, status[200], [
{
// TODO: should E-Tag here be of calendar or event?
// 'D:getetag': options.data.getETag(ctx, calendar)
'D:getetag': options.data.getETag(ctx, calendar)
},
{
'CAL:calendar-data': ics
}
]);
};

return {
Expand Down

0 comments on commit d95dc5b

Please sign in to comment.