"Code with Certainty, Deliver with Confidence"
Built with the tools and technologies:
- π Overview
- πΎ Features
- π Getting Started
- π° Seed Data
- π API Reference
- π Additional Endpoints
This repository showcases my response to a coding challenge presented by Livefront. The task involved developing an API specification for a new referrals feature.
Feature | Summary | |
---|---|---|
βοΈ | Architecture |
|
π© | Code Quality |
|
π | Documentation |
|
π | Integrations |
|
π§© | Modularity |
|
π§ͺ | Testing |
|
β‘οΈ | Performance |
|
π‘οΈ | Security |
|
Before getting started with LiveFrontCodeChallenge, ensure your runtime environment meets the following requirements:
- Version Control: Git
- Programming Language: CSharp
- Programming Framework: .NET8 SDK
- Package Manager: Nuget
- Container Runtime: Docker Desktop
Install using one of the following methods:
Build from source:
- Clone the repository:
git clone https://github.com/goeke-m/LiveFrontCodeChallenge.git
- Navigate to the project directory:
cd ./LiveFrontCodeChallenge
dotnet restore LiveFrontCodeChallenge.sln
- From the root project directory
docker compose -f "./docker-compose.yml" -f "./docker-compose.override.yml" -p livefrontcodechallenge build
Command Line Interface
Usingdocker
Β This project uses HTTPS for local development. This requires the use of a trusted certificate. Before running the application, the following command will check for an existing certificate or generate a new one.
dotnet dev-certs https --trust
docker compose -f "./docker-compose.yml" -f "./docker-compose.override.yml" -p livefrontcodechallenge up --build
- This will start the API and SQL Server containers.
- API Swagger Endpoint:
https://localhost:8081/swagger/index.html
. - The API will be available at
https://localhost:8081/api/v1/referral
. - The API's liveness can be checked at
https://localhost:8081/api/v1/health
. A 200 response indicates the API is up and running.
Visual Studio
- Open the solution in Visual Studio
- Ensure the Docker-compose is selected as the Startup Item
- Click the Docker Compose run button
- This will generate the containers and then open the swagger url afterwards.
Run the test suite using the following command:
Visual Studio
- Open the solution in Visual Studio
- Build the solution using the build button command
- If the Test Explorer is not open, open it Test -> Test Explorer
- In the Test Explorer click on the 'Run All Tests In View' button
[
{
"referee": {
"firstName": "Marsha",
"lastName": "Mellow",
"phoneNumber": "555-908-4836",
"email": null
},
"id": "143c90ed-83c2-4ca7-9c07-24957cfadddf",
"referralStatus": "Complete",
"referralCode": "X5YGP01"
},
{
"referee": {
"firstName": "Gene",
"lastName": "Pool",
"phoneNumber": null,
"email": "genepool@gmail.com"
},
"id": "d69171d3-5a79-464b-9ac3-6dc220c07e30",
"referralStatus": "Pending",
"referralCode": "X5YGP01"
},
{
"referee": {
"firstName": "Willie",
"lastName": "Makeit",
"phoneNumber": null,
"email": "williemakeit@gmail.com",
"referral": null
},
"id": "24278723-2248-48da-a6f2-c7ba4056a144",
"referralStatus": "Complete",
"referralCode": "X5YGP01"
}
]
The Referrals API is built using ASP.NET Core and provides the following functionality:
- Manage referrals, including creating, retrieving, updating, and deleting referrals.
- Manage referees, including creating, retrieving, updating, and deleting referees.
- Retrieve referrals based on various criteria, such as referral code and referral status.
The API uses Entity Framework Core for data access and SQL Server as the database.
The Referrals API provides the following endpoints:
- Endpoint:
GET /api/v1/referral/getreferrals
- Parameters:
referralCode
(required): The referral code to filter the referrals.referralStatus
(optional): The referral status to filter the referrals to a specific status.
- Response: A list of referrals matching the provided criteria.
- Endpoint:
GET /api/v1/referral/getreferralbyid/{id}
- Parameters:
id
(required): The unique identifier of the referral.
- Response: The details of the referral with the specified ID.
- Endpoint:
POST /api/v1/referral/createreferral
- Request Body:
firstName
(required): The first name of the referee.lastName
(required): The last name of the referee.phoneNumber
: The phone number of the referee. Either phone number or email is required.email
: The email of the referee. Either phone number or email is required.referralStatus
(optional): The status of the referral. This will default to pending status.referralCode
(required): The referral code.
- Response: The details of the created referral.
- Endpoint:
PATCH /api/v1/referral/updatereferralstatus
- Request Body:
referralId
(required): The unique identifier of the referral.referralStatus
(required): The new status of the referral.
- Response: The updated referral details.
- Endpoint:
PUT /api/v1/referral/updatereferral
- Request Body:
referralId
(required): The unique identifier of the referral.firstName
(required): The updated first name of the referee.lastName
(required): The updated last name of the referee.phoneNumber
(required): The updated phone number of the referee.email
(required): The updated email of the referee.referralStatus
(required): The updated status of the referral.referralCode
(required): The updated referral code.
- Response: The updated referral details.
- Endpoint:
GET /api/v1/health
- Response: 200 Status Code if Api is up and running.