Challenge Overview

App environment:
- ASP.Net MVC Core Web API

Basic requirements for this challenge:
- Continue update ASP.Net MVC Core Web API based on Swagger for Scheduler, Instructors, Products
- Update and linking all missing endpoints/parameters from previous completed Web API on Reservations section
- Web API need support Unit Testing
- Create/Update sql for sample data based on storyboard content
- Update Postman collections and Configurations
- Check all endpoints working correctly

Challenge Overview
Hoherberg Ski School is very excited to see how the application look on real life based on previous winning design. This web application need build using ASP.Net MVC Core on frontend and backend.

This is the 2nd of a Web API Code Challenge Series to create the Hoherberg Ski School Web API that will be consumed by our frontend application that built using ASP.NET MVC Core.
For this challenge we need you continue updating existing Web API with focus specifically on the Scheduler, Instructors, Products section and code must be follow existing format and standard

Good luck and let's discuss any questions you have. See you in the challenge forum!

Technology Stack
- ASP.Net MVC Core Web API
- MySQL
- Docker
- SMTP Email Server

Deployment environment requirements
- localhost
- Heroku - Create CI/CD from gitlab to Heroku

Challenge Assets:
Ragnar: Check challenge forum to see the url.
Swagger: https://gitlab.com/alta-ski/architecture/tree/master/swagger
Docker: https://gitlab.com/alta-ski/architecture/tree/master/docker
Frontend: https://gitlab.com/alta-ski/frontend
Use this repo as base updates: https://gitlab.com/alta-ski/architecture/tree/master/backend

General Requirements:
- You must use ASP.Net MVC Core Web API for this base of app
- Use MySQL as database source
- Getting started on ASP.Net MVC Core Web API here: https://docs.microsoft.com/en-us/aspnet/core/tutorials/first-web-api?view=aspnetcore-2.1
- Check gitlab architecture repo for completed Docker, MySQL files. You can follow complete data type definitions from the sql-scripts folder.
- We will host our app on Docker with this ASP.Net Core Web API.
- Create CI/CD to do auto deployment from gitlab to Heroku
- Web API need support logging file. Need able to create logging file when running the Web API as WAR format.
- Make sure you submission support unit testings
- The requests and responses should properly list all fields.
- All endpoints must be protected and JWT passed in the request header must be used for authentication.
- Suggest best practices endpoints format for the actual API implementations
- Basically for this challenge we need covered endpoints on this page based on Marvelapp:
a). Reservations: https://marvelapp.com/e683i7j
b). Schedulers: https://marvelapp.com/9dd26a4
c). Products and Instructors: https://marvelapp.com/4gjed11  

Individual Requirements
- You will continue build REST API for these following pages, here is list of endpoints to implement, you can suggest changes but you need to post in forums for confirmation and discussion.
- Please check the detailed swagger file here: https://gitlab.com/alta-ski/architecture/blob/master/swagger/HoherbergSkiSchool_REST_API_v2.yaml
- Some required endpoints as explained below

1). Update existing Reservations endpoints
- Update and linking all missing endpoints/parameters from previous completed Web API on Reservations section
- We need you linked Reservations with completed endpoints from this challenge.
- Some sections that need improved are:

GET: {{url}}/availability
- On Reservations page, this is placed on top of page as Widget Availability
- This need return products with instructor and level information.
- Also if instructor already assigned to some booking, no need to include in the results
- Need able to capture parameters

Anything else?
- Need make this submission returned correct data, to make this fully usable for the next phase.
- Check all endpoints, make sure all of the return correct data with no error
- Let us know if need confirmation.

2). Scheduler
- Need able to pull Scheduler data based on Weekly and Daily view
- Need able to filter based on Instructor name, pods, adult and child skill level, F/P, POD, Skills and TELE
- Need able to select custom range
- Need able to move back  per 1 day and 7 days based on selected day range
- Need add endpoints for multi selected row to add instructors. If conflicts happens, need display the list
- Need quickly re-assign instructor that will pull the available instructors
- Create endpoints to pull Private Lesson instructor Details slip
- On selected instructor need able to pull data for current date white slips
- On selected instructor need able to print current date schedule
- On selected cell, need load the product list selection
- Create endpoints that will return data for Weekly and Daily view.
- When click on cell need display different data for Lesson details
- Return success/error message for related endpoints

3). Daily Assignment
- This will display current day instructor assignment, grouped by the product type

4). Unassigned Privates
- This will pull list for unassigned lessons
- Need able to filter based on date, age, skier level, start time, and p-code
- Display additional skier list
- Need support single and multi day
- There will endpoints to pull the suggested instructors with parameters: show all, tentative and option to email details to instructor.
- Need able to assign the selected date.

5). Products
- Need able to select the instructor from the list for edit endpoint
- Follow fields based on storyboard
- Notice Scheduling pattern and Assignment Grouping have different options. Capture them
- Need able to add more than 1 days
- Need able to add more than 1 assigned instructors
- Need able to pull the scheduling conflicts
- Need support CRUD operations for Instructor
- Return success/error message when create new data

6). Products Category
- Need able to pull the list of current category
- Follow field from storyboard screens
- Need able to link to parent pod
- Need support CRUD operation

7). Instructors
- Need able to select the instructor from the list for edit endpoint
- Follow fields based on storyboard
- Need able to add more than 1 range & skills
- Need support CRUD operations for Instructor
- Return success/error message when create new data

8). Instructors Category (POD Management)
- Need able to pull the list of current category
- Follow field from storyboard screens
- Need able to link to parent pod
- Need support CRUD operation

Filtering
The parameters should be returned in the response with the total count of matching records as well, It is preferred if the default values are configurable.

Pagination
We need to add pagination when user scrolling the page, these endpoint should have the following parameters :
- offset (default 0)
- limit (default 20)
The parameters should be returned in the response with the total count of matching records as well, It is preferred if the default values are configurable.

Validation
Perform the following validation in each API endpoint :

Path parameters :
- They usually represents the ID of existing objects, a validation should be done that the entity with ID exists, otherwise return error.
- Required input parameters in create endpoints must be present. For update endpoints we can pass only the fields that should be updated.
- Required input parameters should be validated against their expected type.
- Optional input parameters should be validated against their expected type if provided.
- Foreign keys must be validated.
- Validation between callbacks must be performed.

Errors should be in json format with three fields :
- code : http status code
- status : success/failed
- message : reason of failure

Request and Response
- GET endpoints parameters will accept parameters as query strings, in key/value format.
- Create/Update endpoint parameters will accept input as JSON format.
- Exclude file upload endpoints which cannot work with application/json content type.
- Response should be in json format always.

Unit Testing
All of your code should be test covered. You must cover at least +90% of the code.
You need to test all cases and in test case assertion you need to assert accuracy of all fields.

Hosting
- It is preferred if you provide scripts and steps to deploy the application in Heroku
- Need support CI/CD from gitlab to Heroku

Documentation
- Provide a detailed README documentation for how to setup and configure the application.

Configurations
- You are expected to use environment variables to store sensitive information and environment-specific configurations.   

Scripts
- Provide scripts for create all tables/collection
- Provide script to insert default users.
- Provide script to insert sample data

Postman Client
- Create postman environment and collection file that will listing all calls and sample data.
- Group each routes on Postman collection into separate folder
- Provide description for endpoints
- Get Started with Postman : http://www.getpostman.com/

Deliverables
- All required source code.
- Updated postman collections and configuration
- Updated Sample init data sql
- .gitlab-ci.yml (CI/CD Deployment)
- Any other document(s) that you think will help developer have better understand how to use the Web API
 

Final Submission Guidelines

Deliverables
- All required source code.
- Postman collections and configuration
- Sample init data sql
- .gitlab-ci.yml (CI/CD Deployment)
- Any other document(s) that you think will help developer have better understand how to use the Web API

ELIGIBLE EVENTS:

Topcoder Open 2019

Review style

Final Review

Community Review Board

Approval

User Sign-Off

ID: 30072167