diff --git a/backend/src/schema/resolvers/helpers/events.js b/backend/src/schema/resolvers/helpers/events.js index 6f3eda3d4..84e64299d 100644 --- a/backend/src/schema/resolvers/helpers/events.js +++ b/backend/src/schema/resolvers/helpers/events.js @@ -9,23 +9,21 @@ export const validateEventParams = (params) => { validateEventEnd(eventInput.eventStart, eventInput.eventEnd) params.eventEnd = eventInput.eventEnd } - if (eventInput.eventLocation && !eventInput.eventVenue) { + if (eventInput.eventLocationName && !eventInput.eventVenue) { throw new UserInputError('Event venue must be present if event location is given!') } params.eventVenue = eventInput.eventVenue - params.eventLocation = eventInput.eventLocation + params.eventLocationName = eventInput.eventLocationName params.eventIsOnline = !!eventInput.eventIsOnline } delete params.eventInput let locationName - if (params.eventLocation) { - params.eventLocationName = params.eventLocation - locationName = params.eventLocation + if (params.eventLocationName) { + locationName = params.eventLocationName } else { params.eventLocationName = null locationName = null } - delete params.eventLocation return locationName } diff --git a/backend/src/schema/resolvers/posts.spec.js b/backend/src/schema/resolvers/posts.spec.js index d3936d034..87d09e262 100644 --- a/backend/src/schema/resolvers/posts.spec.js +++ b/backend/src/schema/resolvers/posts.spec.js @@ -505,7 +505,7 @@ describe('CreatePost', () => { }) }) - describe('event location is given but event venue is missing', () => { + describe('event location name is given but event venue is missing', () => { it('throws an error', async () => { const now = new Date() await expect( @@ -516,7 +516,7 @@ describe('CreatePost', () => { postType: 'Event', eventInput: { eventStart: new Date(now.getFullYear(), now.getMonth() + 1).toISOString(), - eventLocation: 'Berlin', + eventLocationName: 'Berlin', }, }, }), @@ -557,7 +557,7 @@ describe('CreatePost', () => { }) }) - describe('valid event input with location', () => { + describe('valid event input with location name', () => { it('has label "Event" set', async () => { const now = new Date() await expect( @@ -568,7 +568,7 @@ describe('CreatePost', () => { postType: 'Event', eventInput: { eventStart: new Date(now.getFullYear(), now.getMonth() + 1).toISOString(), - eventLocation: 'Leipzig', + eventLocationName: 'Leipzig', eventVenue: 'Connewitzer Kreuz', }, }, @@ -821,7 +821,7 @@ describe('UpdatePost', () => { }) }) - describe('event location is given but event venue is missing', () => { + describe('event location name is given but event venue is missing', () => { it('throws an error', async () => { const now = new Date() await expect( @@ -832,7 +832,7 @@ describe('UpdatePost', () => { postType: 'Event', eventInput: { eventStart: new Date(now.getFullYear(), now.getMonth() + 1).toISOString(), - eventLocation: 'Berlin', + eventLocationName: 'Berlin', }, }, }), @@ -846,7 +846,7 @@ describe('UpdatePost', () => { }) }) - describe('valid event input without location', () => { + describe('valid event input without location name', () => { it('has label "Event" set', async () => { const now = new Date() await expect( @@ -872,7 +872,7 @@ describe('UpdatePost', () => { }) }) - describe('valid event input with location', () => { + describe('valid event input with location name', () => { it('has label "Event" set', async () => { const now = new Date() await expect( @@ -883,7 +883,7 @@ describe('UpdatePost', () => { postType: 'Event', eventInput: { eventStart: new Date(now.getFullYear(), now.getMonth() + 1).toISOString(), - eventLocation: 'Leipzig', + eventLocationName: 'Leipzig', eventVenue: 'Connewitzer Kreuz', }, }, diff --git a/backend/src/schema/types/type/Post.gql b/backend/src/schema/types/type/Post.gql index ae35bd39d..5a5d57b9a 100644 --- a/backend/src/schema/types/type/Post.gql +++ b/backend/src/schema/types/type/Post.gql @@ -194,7 +194,6 @@ input _PostInput { input _EventInput { eventStart: String! eventEnd: String - eventLocation: String eventVenue: String eventLocationName: String eventIsOnline: Boolean diff --git a/webapp/components/ContributionForm/ContributionForm.vue b/webapp/components/ContributionForm/ContributionForm.vue index 7d3d1bc23..584e3597a 100644 --- a/webapp/components/ContributionForm/ContributionForm.vue +++ b/webapp/components/ContributionForm/ContributionForm.vue @@ -247,7 +247,7 @@ export default { eventLocation: eventLocation || '', eventLocationName: eventLocationName || '', eventVenue: eventVenue || '', - eventIsOnline: eventIsOnline || true, + eventIsOnline: eventIsOnline || false, }, formSchema: { title: { required: true, min: 3, max: 100 }, @@ -284,7 +284,6 @@ export default { if (this.creatEvent) { return { eventStart: this.formData.eventStart, - eventLocation: this.formData.eventLocation, eventVenue: this.formData.eventVenue, eventEnd: this.formData.eventEnd, eventIsOnline: this.formData.eventIsOnline, diff --git a/webapp/graphql/PostMutations.js b/webapp/graphql/PostMutations.js index b4ec6731c..6b71b86b9 100644 --- a/webapp/graphql/PostMutations.js +++ b/webapp/graphql/PostMutations.js @@ -46,6 +46,7 @@ export default () => { } eventStart eventVenue + eventLocationName eventLocation { lng lat