---
# System prepended metadata

title: Hunt Backend Progress

---

# Hunt Backend Tracker
## Core Flow
```
|Input ClueHash -> Get Next Clue| -> 
(User finds answer for the clue) -> 
|Input Answer -> Get Next CluesHash| -> repeat
```

GET /questions/\<q_no\>/next : `|Input ClueHash -> Get Next Clue|`

POST /questions/\<q_no\>/validate : `|Input Answer -> Get Next CluesHash|`

NOTE: 
1. `<q_no>` is the same as `ordinal` in the schema
2. **The endpoint names are tentative and subject to change**



## Endpoints

### User

```sql
create table if not exists users (
  id INTEGER not null primary key autoincrement,
  name varchar(100) not null,
  email varchar(100) not null,
  uuid varchar(100) not null,
  pwd_hash varchar(100) not null,
  created_timestamp datetime not null default (datetime(CURRENT_TIMESTAMP, 'localtime'))
);
```

**User Details endpoints**
✅ GET  "/users/"
❌ GET  "/users/<:id>"
✅ PUT "/users/<:id>"
✅ DELETE "/users/<:id>"

**User Administration Endpoints**

🟡 POST "/register"

- **TODO**: Generate the Progress Row for This User
- **TODO**: Generate All the HintKeys for this User

✅ POST "/login"

- **TODO**:  Get Session TtlMinutes param from the env

❌ POST "/logout"

<hr>


### Question

```sql
create table if not exists questions (
  id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
  question_text varchar(100) not null,
  hint_text varchar(100) not null,
  answer_text varchar(100) not null,
  ordinal INTEGER not null unique,
  created_timestamp datetime not null default (datetime(CURRENT_TIMESTAMP, 'localtime'))
);
```

✅ GET /questions
✅ POST /questions/
✅ GET /questions/pub

(Pub qns only contain qn no and qn text, priv qns contain all attributes incl. answer and hints)

❌ GET /questions/<:id>
❌ POST /questions/<:id>
✅ PUT /questions/<:id>
✅ DELETE /questions/<:id>

**TODO:** Auth All Endpoints - They are already JWT authed so dk what this means??

<hr>

### Utils

✅ GET /ping
✅ GET /dbtest/priv - Get all priv qns
✅ GET /dbtest - Get all pub qns
✅ POST /dbtest - CreateQuestion
✅ PUT /dbtest/:id - UpdateQuestion
✅ DELETE /dbtest/:id - DeleteQuestion by :id: 

<hr>