Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix default daterange value for meeting create #2534

Merged
merged 1 commit into from
Jul 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions client/src/app/gateways/error-mapping/error-map-utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';

import { MeetingAction } from '../repositories/meetings';
import { MotionAction } from '../repositories/motions';

export class MapError {
Expand Down Expand Up @@ -39,6 +40,12 @@ const VoteServiceErrorMap: ErrorMap = new ErrorMap([
]);

const MotionCreateForwardErrorMap: ErrorMap = new ErrorMap([[/(.*)/, input => new MapError(input)]]);
const MeetingCreateErrorMap: ErrorMap = new ErrorMap([
[
/Only one of start_time and end_time is not allowed./,
_(`Start and end time must either both be set or both be empty`)
]
]);

/**
* Finds the correct error map for an action response by the original requests action name
Expand All @@ -47,6 +54,8 @@ const MotionCreateForwardErrorMap: ErrorMap = new ErrorMap([[/(.*)/, input => ne
const getActionErrorMap: (data: any) => ErrorMap | null = data => {
const actionName = Array.isArray(data) && typeof data[0] === `object` ? data[0][`action`] : null;
switch (actionName) {
case MeetingAction.CREATE:
return MeetingCreateErrorMap;
case MotionAction.CREATE_FORWARDED:
return MotionCreateForwardErrorMap;
default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,10 +263,12 @@ export class MeetingEditComponent extends BaseComponent implements OnInit {
const rawForm: { [key: string]: any } = {
name: [``, Validators.required],
location: [``],
daterange: {
start: [currentDate],
end: [currentDate]
},
daterange: [
{
start: currentDate,
end: currentDate
}
],
admin_ids: [[], Validators.minLength(1)],
organization_tag_ids: [[]],
external_id: [``]
Expand Down