[mod] date formatting [mod] caldav resource integration
This commit is contained in:
parent
cde912392c
commit
c9b882edbe
7 changed files with 42 additions and 22 deletions
|
@ -33,6 +33,7 @@ namespace _zeitbild.api
|
|||
data : {
|
||||
url : string;
|
||||
read_only : boolean;
|
||||
from_fucked_up_wordpress : boolean;
|
||||
};
|
||||
}
|
||||
);
|
||||
|
@ -79,6 +80,7 @@ namespace _zeitbild.api
|
|||
"data": {
|
||||
"url": stuff.input.resource.data.url,
|
||||
"read_only": stuff.input.resource.data.read_only,
|
||||
"from_fucked_up_wordpress": stuff.input.resource.data.from_fucked_up_wordpress,
|
||||
}
|
||||
};
|
||||
break;
|
||||
|
|
|
@ -168,27 +168,31 @@ namespace _zeitbild.api
|
|||
user_id
|
||||
)
|
||||
.then(
|
||||
(data) => Promise.resolve({
|
||||
"status_code": 200,
|
||||
"data": (
|
||||
data
|
||||
.map(
|
||||
(entry) => ({
|
||||
"calendar_id": entry.calendar_id,
|
||||
"calendar_name": entry.calendar_name,
|
||||
"access_level": _zeitbild.api.access_level_encode(entry.access_level),
|
||||
"event_id": entry.event_id,
|
||||
"event_object": entry.event_object,
|
||||
})
|
||||
)
|
||||
),
|
||||
})
|
||||
(data) => Promise.resolve(
|
||||
{
|
||||
"status_code": 200,
|
||||
"data": (
|
||||
data
|
||||
.map(
|
||||
(entry) => ({
|
||||
"calendar_id": entry.calendar_id,
|
||||
"calendar_name": entry.calendar_name,
|
||||
"access_level": _zeitbild.api.access_level_encode(entry.access_level),
|
||||
"event_id": entry.event_id,
|
||||
"event_object": entry.event_object,
|
||||
})
|
||||
)
|
||||
),
|
||||
}
|
||||
)
|
||||
)
|
||||
.catch(
|
||||
(reason) => Promise.resolve({
|
||||
"status_code": 403,
|
||||
"data": String(reason),
|
||||
})
|
||||
(reason) => Promise.resolve(
|
||||
{
|
||||
"status_code": 403,
|
||||
"data": String(reason),
|
||||
}
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ namespace _zeitbild.database
|
|||
/**
|
||||
*/
|
||||
const _compatible_revisions : Array<string> = [
|
||||
"r3",
|
||||
"r4",
|
||||
];
|
||||
|
||||
|
||||
|
|
|
@ -40,6 +40,7 @@ type type_data = {
|
|||
data : {
|
||||
url : string;
|
||||
read_only : boolean;
|
||||
from_fucked_up_wordpress ?: boolean;
|
||||
};
|
||||
}
|
||||
);
|
||||
|
@ -109,6 +110,7 @@ async function data_init(
|
|||
"data": {
|
||||
"url": calendar_raw.resource.data.url,
|
||||
"read_only": calendar_raw.resource.data.read_only,
|
||||
"from_fucked_up_wordpress": (calendar_raw.resource.data.from_fucked_up_wordpress ?? false),
|
||||
}
|
||||
};
|
||||
resource_id = await _zeitbild.service.resource.add(
|
||||
|
|
|
@ -366,6 +366,7 @@ namespace _zeitbild.repository.resource
|
|||
"data": {
|
||||
"url": dataset_extra_caldav["url"],
|
||||
"read_only": dataset_extra_caldav["read_only"],
|
||||
"from_fucked_up_wordpress": dataset_extra_caldav["from_fucked_up_wordpress"],
|
||||
}
|
||||
}
|
||||
);
|
||||
|
@ -409,6 +410,7 @@ namespace _zeitbild.repository.resource
|
|||
{
|
||||
"url": resource_object.data.url,
|
||||
"read_only": resource_object.data.read_only,
|
||||
"from_fucked_up_wordpress": resource_object.data.from_fucked_up_wordpress,
|
||||
}
|
||||
);
|
||||
const resource_id : _zeitbild.type_resource_id = await get_resource_core_store().create(
|
||||
|
|
|
@ -348,11 +348,20 @@ namespace _zeitbild.service.calendar
|
|||
{
|
||||
}
|
||||
);
|
||||
const vcalendar : lib_plankton.ical.type_vcalendar = lib_plankton.ical.ics_decode(
|
||||
http_response.body.toString(),
|
||||
const ics_raw : string = http_response.body.toString();
|
||||
const vcalendar_list : Array<lib_plankton.ical.type_vcalendar> = lib_plankton.ical.ics_decode_multi(
|
||||
ics_raw,
|
||||
{
|
||||
"ignore_unhandled_instruction_keys": resource_object.data.from_fucked_up_wordpress,
|
||||
"from_fucked_up_wordpress": resource_object.data.from_fucked_up_wordpress,
|
||||
}
|
||||
);
|
||||
const vcalendar : lib_plankton.ical.type_vcalendar = {
|
||||
// required
|
||||
"version": vcalendar_list[0].version,
|
||||
"prodid": vcalendar_list[0].prodid,
|
||||
"vevents": vcalendar_list.map(x => x.vevents).reduce((x, y) => x.concat(y), []),
|
||||
};
|
||||
return Promise.resolve(
|
||||
vcalendar.vevents
|
||||
.map(
|
||||
|
|
|
@ -86,6 +86,7 @@ namespace _zeitbild
|
|||
data : {
|
||||
url : string;
|
||||
read_only : boolean;
|
||||
from_fucked_up_wordpress : boolean;
|
||||
};
|
||||
}
|
||||
);
|
||||
|
|
Loading…
Add table
Reference in a new issue