Skip to content
Snippets Groups Projects
Commit 1ce5afa2 authored by permcu's avatar permcu
Browse files

Pass timezone to backend if recurring personal-event

Also simplify & unify with recurring.
parent f75940f0
No related branches found
No related tags found
1 merge request!1694Resolve "Make timezone field optional in personal event mutations"
......@@ -255,8 +255,11 @@ export default {
datetimeEnd: item.fullDay ? undefined : item.datetimeEnd,
dateStart: item.fullDay ? item.dateStart : undefined,
dateEnd: item.fullDay ? item.dateEnd : undefined,
recurrences: item.recurring === false ? "" : item.recurrences,
timezone: DateTime.local().zoneName,
...(item.recurring ? {
// Add clients timezone only if item is recurring
timezone: DateTime.local().zoneName,
recurrences: item.recurrences,
} : {}),
persons: this.checkPermission(
"core.create_personal_event_with_invitations_rule",
)
......
fragment personalEventFields on PersonalEventType {
id
title
description
location
datetimeStart
datetimeEnd
dateStart
dateEnd
timezone
recurrences
persons {
id
fullName
}
groups {
id
shortName
}
}
mutation createPersonalEvents($input: [BatchCreatePersonalEventInput]!) {
createPersonalEvents(input: $input) {
items: personalEvents {
id
title
description
location
datetimeStart
datetimeEnd
dateStart
dateEnd
recurrences
persons {
id
fullName
}
groups {
id
shortName
}
...personalEventFields
}
}
}
......@@ -33,25 +38,7 @@ mutation deletePersonalEvents($ids: [ID]!) {
mutation updatePersonalEvents($input: [BatchPatchPersonalEventInput]!) {
updatePersonalEvents(input: $input) {
items: personalEvents {
id
title
description
location
datetimeStart
datetimeEnd
dateStart
dateEnd
recurrences
persons {
id
fullName
}
groups {
id
shortName
}
...personalEventFields
}
}
}
......
......@@ -24,15 +24,14 @@ class PersonalEventType(DjangoObjectType):
"location",
"datetime_start",
"datetime_end",
"timezone",
"date_start",
"date_end",
"owner",
"persons",
"groups",
)
convert_choices_to_enum = False
timezone = graphene.String()
recurrences = graphene.String()
......@@ -53,7 +52,8 @@ class PersonalEventBatchCreateMutation(PermissionBatchPatchMixin, BaseBatchCreat
"persons",
"groups",
)
field_types = {"recurrences": graphene.String(), "location": graphene.String()}
field_types = {"timezone": graphene.String(), "recurrences": graphene.String(), "location": graphene.String()}
optional_fields = ("timezone", "recurrences")
@classmethod
def get_permissions(cls, root, info, input) -> Iterable[str]: # noqa
......@@ -102,7 +102,8 @@ class PersonalEventBatchPatchMutation(BaseBatchPatchMutation):
"persons",
"groups",
)
field_types = {"recurrences": graphene.String(), "location": graphene.String()}
field_types = {"timezone": graphene.String(), "recurrences": graphene.String(), "location": graphene.String()}
optional_fields = ("timezone", "recurrences")
@classmethod
def get_permissions(cls, root, info, input, id, obj) -> Iterable[str]: # noqa
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment