mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2025-12-13 07:45:56 +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)
|
validateEventEnd(eventInput.eventStart, eventInput.eventEnd)
|
||||||
params.eventEnd = 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!')
|
throw new UserInputError('Event venue must be present if event location is given!')
|
||||||
}
|
}
|
||||||
params.eventVenue = eventInput.eventVenue
|
params.eventVenue = eventInput.eventVenue
|
||||||
params.eventLocation = eventInput.eventLocation
|
params.eventLocationName = eventInput.eventLocationName
|
||||||
params.eventIsOnline = !!eventInput.eventIsOnline
|
params.eventIsOnline = !!eventInput.eventIsOnline
|
||||||
}
|
}
|
||||||
delete params.eventInput
|
delete params.eventInput
|
||||||
let locationName
|
let locationName
|
||||||
if (params.eventLocation) {
|
if (params.eventLocationName) {
|
||||||
params.eventLocationName = params.eventLocation
|
locationName = params.eventLocationName
|
||||||
locationName = params.eventLocation
|
|
||||||
} else {
|
} else {
|
||||||
params.eventLocationName = null
|
params.eventLocationName = null
|
||||||
locationName = null
|
locationName = null
|
||||||
}
|
}
|
||||||
delete params.eventLocation
|
|
||||||
return locationName
|
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 () => {
|
it('throws an error', async () => {
|
||||||
const now = new Date()
|
const now = new Date()
|
||||||
await expect(
|
await expect(
|
||||||
@ -516,7 +516,7 @@ describe('CreatePost', () => {
|
|||||||
postType: 'Event',
|
postType: 'Event',
|
||||||
eventInput: {
|
eventInput: {
|
||||||
eventStart: new Date(now.getFullYear(), now.getMonth() + 1).toISOString(),
|
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 () => {
|
it('has label "Event" set', async () => {
|
||||||
const now = new Date()
|
const now = new Date()
|
||||||
await expect(
|
await expect(
|
||||||
@ -568,7 +568,7 @@ describe('CreatePost', () => {
|
|||||||
postType: 'Event',
|
postType: 'Event',
|
||||||
eventInput: {
|
eventInput: {
|
||||||
eventStart: new Date(now.getFullYear(), now.getMonth() + 1).toISOString(),
|
eventStart: new Date(now.getFullYear(), now.getMonth() + 1).toISOString(),
|
||||||
eventLocation: 'Leipzig',
|
eventLocationName: 'Leipzig',
|
||||||
eventVenue: 'Connewitzer Kreuz',
|
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 () => {
|
it('throws an error', async () => {
|
||||||
const now = new Date()
|
const now = new Date()
|
||||||
await expect(
|
await expect(
|
||||||
@ -832,7 +832,7 @@ describe('UpdatePost', () => {
|
|||||||
postType: 'Event',
|
postType: 'Event',
|
||||||
eventInput: {
|
eventInput: {
|
||||||
eventStart: new Date(now.getFullYear(), now.getMonth() + 1).toISOString(),
|
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 () => {
|
it('has label "Event" set', async () => {
|
||||||
const now = new Date()
|
const now = new Date()
|
||||||
await expect(
|
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 () => {
|
it('has label "Event" set', async () => {
|
||||||
const now = new Date()
|
const now = new Date()
|
||||||
await expect(
|
await expect(
|
||||||
@ -883,7 +883,7 @@ describe('UpdatePost', () => {
|
|||||||
postType: 'Event',
|
postType: 'Event',
|
||||||
eventInput: {
|
eventInput: {
|
||||||
eventStart: new Date(now.getFullYear(), now.getMonth() + 1).toISOString(),
|
eventStart: new Date(now.getFullYear(), now.getMonth() + 1).toISOString(),
|
||||||
eventLocation: 'Leipzig',
|
eventLocationName: 'Leipzig',
|
||||||
eventVenue: 'Connewitzer Kreuz',
|
eventVenue: 'Connewitzer Kreuz',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@ -194,7 +194,6 @@ input _PostInput {
|
|||||||
input _EventInput {
|
input _EventInput {
|
||||||
eventStart: String!
|
eventStart: String!
|
||||||
eventEnd: String
|
eventEnd: String
|
||||||
eventLocation: String
|
|
||||||
eventVenue: String
|
eventVenue: String
|
||||||
eventLocationName: String
|
eventLocationName: String
|
||||||
eventIsOnline: Boolean
|
eventIsOnline: Boolean
|
||||||
|
|||||||
@ -247,7 +247,7 @@ export default {
|
|||||||
eventLocation: eventLocation || '',
|
eventLocation: eventLocation || '',
|
||||||
eventLocationName: eventLocationName || '',
|
eventLocationName: eventLocationName || '',
|
||||||
eventVenue: eventVenue || '',
|
eventVenue: eventVenue || '',
|
||||||
eventIsOnline: eventIsOnline || true,
|
eventIsOnline: eventIsOnline || false,
|
||||||
},
|
},
|
||||||
formSchema: {
|
formSchema: {
|
||||||
title: { required: true, min: 3, max: 100 },
|
title: { required: true, min: 3, max: 100 },
|
||||||
@ -284,7 +284,6 @@ export default {
|
|||||||
if (this.creatEvent) {
|
if (this.creatEvent) {
|
||||||
return {
|
return {
|
||||||
eventStart: this.formData.eventStart,
|
eventStart: this.formData.eventStart,
|
||||||
eventLocation: this.formData.eventLocation,
|
|
||||||
eventVenue: this.formData.eventVenue,
|
eventVenue: this.formData.eventVenue,
|
||||||
eventEnd: this.formData.eventEnd,
|
eventEnd: this.formData.eventEnd,
|
||||||
eventIsOnline: this.formData.eventIsOnline,
|
eventIsOnline: this.formData.eventIsOnline,
|
||||||
|
|||||||
@ -46,6 +46,7 @@ export default () => {
|
|||||||
}
|
}
|
||||||
eventStart
|
eventStart
|
||||||
eventVenue
|
eventVenue
|
||||||
|
eventLocationName
|
||||||
eventLocation {
|
eventLocation {
|
||||||
lng
|
lng
|
||||||
lat
|
lat
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user