Skip to content

Commit

Permalink
Changed events API to use slugs
Browse files Browse the repository at this point in the history
  • Loading branch information
geoff-maddock committed Jan 9, 2025
1 parent 62005ca commit a8afa36
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 31 deletions.
16 changes: 0 additions & 16 deletions app/Http/Controllers/EventsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3233,22 +3233,6 @@ public function indexRelatedTo(
}


/**
* Display an event when passed the slug.
*
* @return Response|string
*
* @throws \Throwable
*/
public function indexSlug(string $slug)
{
$event = Event::getBySlug(strtolower($slug))->firstOrFail();

return view('events.show')
->with(compact('event'))
->render();
}

/**
* Display a listing of events that start on the specified day.
*
Expand Down
28 changes: 13 additions & 15 deletions public/postman/schemas/api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1990,18 +1990,16 @@ paths:
description: Successful response
content:
application/json: {}
/api/events/{eventId}:
/api/events/{slug}:
get:
parameters:
- name: eventId
description: The unique identifier of the event
- name: slug
description: The unique identifier of the entity
in: path
required: true
example: 1
schema:
type: integer
readOnly: true
example: 1
type: string
example: cutups-event
tags:
- events
summary: Get Event
Expand All @@ -2015,15 +2013,15 @@ paths:
$ref: "#/components/schemas/EventResponse"
put:
parameters:
- name: eventId
description: The unique identifier of the event
- name: slug
description: A unique string identifier of the event
in: path
required: true
example: 1
schema:
type: integer
type: string
readOnly: true
example: 1
example: cutups-event
tags:
- events
summary: Update Events
Expand All @@ -2042,15 +2040,15 @@ paths:
$ref: "#/components/schemas/EventResponse"
delete:
parameters:
- name: eventId
description: The unique identifier of the event
- name: slug
description: A unique string identifier of the event
in: path
required: true
example: 1
schema:
type: integer
type: string
readOnly: true
example: 1
example: cutups-event
tags:
- events
summary: Delete Event
Expand Down

0 comments on commit a8afa36

Please sign in to comment.