---
# System prepended metadata

title: Estaff Module

---

# Estaff Module



**Todo:**

* Confirm format returned for MAJOR rewardusage API
* QR code will now be generated in frontend
    * Backend still must generate encrypted string based on employee id and shared secret?
* Add more tests and exceptions to validate API and database inputs (for reward usage and quota)


**Endpoint:**

1. Usage must be fetched from a 3rd party API provided by MAJOR, for all rewards used by that employee id for current month.

From the following get request the major API is expected to return JSON similar to below, which includes the emplyee id as a parameter

https://828a3e85-a5dc-4231-b6b8-bc9569e5f0ea.mock.pstmn.io?employee_id=000000000000000000

```
[
    {
        "reward_type": "CINEMA",
        "usage": 11
    },
    {
        "reward_type": "BOWLING",
        "usage": 22
    },
    {
        "reward_type": "CONCESSIONS_DISCOUNT",
        "usage": 33
    },
    {
        "reward_type": "ICESKATE",
        "usage": 44
    },
    {
        "reward_type": "KARAOKE",
        "usage": 55
    }
]
```


**Endpoint:**


1. Read only endpoint to display usage
**/api/estaff/quota/?format=json**


**Response**

Based on job_grade of logged in user

```
GET /api/estaff/quota/
HTTP 200 OK
Allow: GET, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

[
    {
        "reward_type": "KARAOKE",
        "quota_amount": 555,
        "usage": 55,
        "left": 500
    },
    {
        "reward_type": "CINEMA",
        "quota_amount": 111,
        "usage": 11,
        "left": 100
    },
    {
        "reward_type": "BOWLING",
        "quota_amount": 222,
        "usage": 22,
        "left": 200
    },
    {
        "reward_type": "CONCESSIONS_DISCOUNT",
        "quota_amount": 333,
        "usage": 33,
        "left": 300
    },
    {
        "reward_type": "ICESKATE",
        "quota_amount": 444,
        "usage": 44,
        "left": 400
    }
]
```


**Endpoint:**

2. Read only endpoint to employee id for use in creating QR barcode, employee id will corrospond to the loged in user

**/api/estaff/qr-code?format=json**

**Response**

HTTP 200 OK
Allow: GET, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

"000000000000000000"

**Response**