Hard | Topcoder Skill Builder Competition | Java + Springboot + PostgreSQL | Old Train

Key Information

Register
Submit
Competition Timeline

Timezone:Etc/UTC

Registration

Starts

Feb 21, 2021

09:41

Ends

Feb 21, 2022

09:45

Submission

Starts

Feb 21, 2021

09:48

Ends

Feb 21, 2022

09:46

Review

Starts

Feb 21, 2022

09:47

Ends

Feb 23, 2022

09:47

Appeals

Starts

Feb 23, 2022

09:47

Ends

Feb 24, 2022

09:47

Winners Announced

Feb 24, 2022

21:47

Challenge Overview



Old Train

This is the HARD Level Competition
Steve had a great passion for trains right from his childhood and knows every minute details about trains. So, while going through the details about the trains and services being provided, he sees a piece of particular information about a Rapid Transit Trains that was wrong/ so he gets confirmation from his supervisor and receives a go-ahead to edit the description of that train, also his supervisor surprises him about the arrival of the new bullet train and asks him to add the details of that in the inventory.

Solving this problem you learn:
  • Create new endpoint to edit existing train
  • Create new endpoint to create new train
  • Retrieve all trains with updated values
Learning Material: https://bezkoder.com/spring-boot-postgresql-example/

What do you need to do?

IMPORTANT:
  • Follow the exact base API endpoint, automated testers will check the exact same address: http://localhost:8080/api/trains
  • This is continuation competition, please complete previous Easy level before can working on this level
  • Match the exact code status & wording (lowercase) for the returned message.


Task:


1. Create new endpoint to edit existing train by id
  • Method : PUT
  • Url : /api/trains/:id
  • Pull train by id
  • Body request need allow to change all models:
    • name: String
    • description: String
    • distance-between-stop: String
    • max-speed: String
    • sharing-tracks: Boolean
    • grade-crossing: Boolean
    • train-frequency: String
    • amenities: String
  • Response:
    • Success:
      • Need return 200 code and
      • Message “train edited successfully”
    • Error:
      • When edit train that id not exist
        • need return 404 code and
        • {message: “train not found”}
      • When filled with different data types for example: id, sharing-tracks or grade-crossing with other values than boolean.
        • Need return 400 code and
        • {message: “failed when edit train”}

2. Create new endpoint to create a new train
  • Method : POST
  • Url : /api/trains
  • Sample data to add for a new train
    • "id": 6,
    • "name": "Eurostar e320",
    • "description": "Eurostar e320 was created as a single and unified corporate entity owned by SNCF, SNCB and LCR in September 2010. In December, a £700m (approximately $1,076bn) investment to add ten new e320 trains to its fleet and carry out a complete upgrade of its existing 28 trains. It is capable of carrying more than 900 passengers as a result of the 20% capacity boost given to it, compared to the existing 28 Eurostar trains which carry 750 passengers. The entire propulsion system and technical modules are distributed under the floor over the entire length of the train, providing more space for passengers. The train’s roof is equipped with eight pantographs for dealing with Europe’s different power systems and contact line types.",
    • "amenities": "Restroom, business class, cafe car, Wi-Fi, Onboard flat-screens. Reclining seats, flexible reading lamp, a sliding dining table and more luggage areas. Four spaces are provided for wheelchair passengers.",
    • "distance-between-stop": "at least 200 miles",
    • "max-speed": "200 mph",
    • "sharing-tracks": false,
    • "grade-crossing": false,
    • "train-frequency": "12 hours"
  • Important: Please assume all keys and values are required for POST method and must use the correct data type.
  • Response:
    • Success:
      • need return 201 code and
      • {message: “new train added successfully”}
    • Error:
      • When add fields and values that not exists, for example:
        • "id": 11,
        • "name-new": "name ODD",
        • "description-new": "description ODD",
          • need return 400 code and
          • {message: “failed validation”}

Sample Submission: https://drive.google.com/drive/folders/1h_PDXHKdd9TC-eshxydMjUyRUtcx-JQz?usp=sharing
 

Final Submission Guidelines

Topcoder Skill Builder | Java + Springboot + PostgreSQL Levels

Host Challenge & Submission Guideline | Challenge Link: http://www.topcoder.com/challenges/30168990
Easy | Challenge Link: http://www.topcoder.com/challenges/30168991
Medium | Challenge Link: http://www.topcoder.com/challenges/30168980
Hard |  Challenge Link: http://www.topcoder.com/challenges/30168986

ELIGIBLE EVENTS:

2021 Topcoder(R) Open

REVIEW STYLE:

Final Review:

Community Review Board

Approval:

User Sign-Off

SHARE:

ID: 30168986