mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-12 23:35:58 +00:00
Backend removed eventLocation, frontend fixes
This commit is contained in:
parent
df86812fc0
commit
5544f453a6
@ -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
|
||||
}
|
||||
|
||||
|
||||
@ -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',
|
||||
},
|
||||
},
|
||||
|
||||
@ -194,7 +194,6 @@ input _PostInput {
|
||||
input _EventInput {
|
||||
eventStart: String!
|
||||
eventEnd: String
|
||||
eventLocation: String
|
||||
eventVenue: String
|
||||
eventLocationName: String
|
||||
eventIsOnline: Boolean
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -46,6 +46,7 @@ export default () => {
|
||||
}
|
||||
eventStart
|
||||
eventVenue
|
||||
eventLocationName
|
||||
eventLocation {
|
||||
lng
|
||||
lat
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user