Create a new virtual environment
python3 -m venv drf
Activate virtual environment
source drf/bin/activate
Install the dependencies from requirements.txt and run the command in back-end
directory.
$ python3 manage.py makemigrations
$ python3 manage.py migrate
$ python3 manage.py runserver
Install angular cli globally.
npm install -g @angular/cli
cd
into front-end
directory and install the dependencies.
npm install
Set apiUrl
in environment.ts
to the port where server is running, default api url is http://localhost:8080
.
To preview the app, run the following command and navigate to http://localhost:4200/
.
ng serve
Landing |
---|
A user id will be required to acquire tickets which can be then used to participate in luck draws and win rewards.
/users/
["POST"]
Register a new user.
Format
{
"username":"t2",
"email":"t2@t.com",
"password":"testing321",
"is_staff": false
}
Setting the is_staff
field to true enables staff login in front-end and allows user to compute winners of lucky draws.
/users/login/
["POST"]
Sign in as existing user
Format
{
"username":"t2",
"password":"testing321"
}
Get Tickets |
---|
User can buy a single ticket or multiple tickets in one request.
/tickets/
["POST"]
/tickets/?amount={{x}}
["POST"]
Format
{
"user":"3"
}
All | Immediate |
---|---|
-
/luckydraws/{{pk}}
["GET"]
rewards
attribute of a lucky draw contains all upcoming rewards and their announce date. -
/luckydraws/{{pk}}/nextevent
["GET"]
Immediate upcoming active event for a lucky draw
Participate | Tickets |
---|---|
/luckydraws/{{pk}}/register/
["POST"]
Register in a lucky draw using raffle ticket.
Format
{
"ticket_id":"4"
}
List Winners |
---|
Get all winners or specify span
query parameter ( = 7) to get all winners in specified duration.
/winners
["GET"]
/winners/span={{x}}
["GET"]
Compute Winners |
---|
/luckydraws/{{pk}}/compute/
["POST"]
Announce the winner of a lucky draw event
Format
{
"redeem_date": "2021-11-23"
}
- Securing admin endpoints using authentication and permissions in back-end and corresponding routes using auth guard in front-end.
- Enhancing application logic and interface based on PRD details.
- Unit tests for both front-end and back-end