EventController - adkuba/TL-backend GitHub Wiki


Endpoints

Create Event

Path

POST /api/events

Request Body

Event

Parameter Type Description
id String optional, autogenerated ID
title String event's title
timelineId String event's timelineId
description String event's description
pictures List<FileResource> event's images
date LocalDate event's date yyyy-MM-dd

Response

HTTP Status Code Scenario
201 Ok event created
400 Bad Request error

Returns created event.


Create events

Path

POST /api/events/multiple

Request Body
List of Events

Response

HTTP Status Code Scenario
201 Ok events created
400 Bad Request error

Returns created events in list.


Add pictures

Path

POST /api/events/{id}/pictures

Path variable

Variable Type Description
id String event's id

Request param

Parameter Type Description
pictures List<MultipartFile> images to add

consumes "multipart/form-data"

Response

HTTP Status Code Scenario
201 Ok images added to event
400 Bad Request error

Returns event with added pictures. Pictures are now in Google Storage and parsed to URL link in response.


Add pictures URL

Links already uploaded pictures to event. Usefull during event edit.

Path

POST /api/events/{id}/picturesURL

Path variable

Variable Type Description
id String event's id

Request param

Parameter Type Description
picturesURL List<String> imagesURL to add

Response

HTTP Status Code Scenario
201 Ok images added to event
400 Bad Request error

Returns event with added pictures.


Delete event

Path

DELETE /api/events/{id}

Path variable

Variable Type Description
id String event's id

Response

HTTP Status Code Scenario
204 No Content event deleted

Get events by timeline id

Path

GET /api/events/public

Request params

Parameter Type Description
timelineId String main timeline id
view Boolean not required, user statistics by jwt token

Response
List of EventResponse, mapped by eventsMapper.

Event response

{
    "id": "ddggshe34f",
    "title": "myEvent",
    "shortDescription": "my event's short desc",
    "description": "my event's desc",
    "links": [ #hashMap
        {
            "Link's title",
            "link's url"
        }
    ],
    "pictures": [
        "url1",
        "url2"
    ],
    "date": 2020-12-23 #localDate
}

Get all subEvents by main timelineId

Returns all sub events - events linked with additional sub timeline, sub timeline is linked to main timeline.

Path

GET /api/events/allSubEventsByMainTimelineId

Request params

Parameter Type Description
timelineId String main timeline id

Returns List<List<EventResponse>> you can imagine inside list as subTimeline.

⚠️ **GitHub.com Fallback** ⚠️