mirror of
https://github.com/michivonah/themepark-assistant.git
synced 2025-12-22 14:06:29 +01:00
begin basic app structure
This commit is contained in:
parent
b3dad47df1
commit
09d1925cc0
5 changed files with 98 additions and 3 deletions
|
|
@ -1,2 +1,9 @@
|
||||||
# themepark-assistant
|
# themepark-assistant
|
||||||
A tool for improving your trips to themepark - once developed
|
A tool for improving your trips to themepark - once developed
|
||||||
|
|
||||||
|
## Testing
|
||||||
|
Send request
|
||||||
|
|
||||||
|
```bash
|
||||||
|
curl -H "Authorization: Bearer insecure-token" http://127.0.0.1:8787/notification/list
|
||||||
|
```
|
||||||
54
api.md
Normal file
54
api.md
Normal file
|
|
@ -0,0 +1,54 @@
|
||||||
|
# API structure
|
||||||
|
|
||||||
|
## Required endpoints
|
||||||
|
- authentication (via GitHub OAuth?)
|
||||||
|
- login
|
||||||
|
- logout
|
||||||
|
- list all available themeparks
|
||||||
|
- list all attractions per themepark
|
||||||
|
- notification
|
||||||
|
- list all configured targets
|
||||||
|
- add webhook target
|
||||||
|
- remove webhook target
|
||||||
|
- enable notifications for target
|
||||||
|
- disable notifications for target
|
||||||
|
- subscribe attraction
|
||||||
|
- unsubscribe attraction
|
||||||
|
- logbook
|
||||||
|
- list all entries
|
||||||
|
- option to filter by date (via request parameters)
|
||||||
|
- option to filter by themepark (via request parameters)
|
||||||
|
- or both (via request parameters)
|
||||||
|
- add entry
|
||||||
|
- remove entry
|
||||||
|
- user settings
|
||||||
|
- delete account
|
||||||
|
|
||||||
|
## Concept
|
||||||
|
- /auth -> for authentication purposes
|
||||||
|
- /themepark/list -> list all themeparks
|
||||||
|
- /themepark/list/attraction -> list all attractions from a themepark
|
||||||
|
- parameters: themepark
|
||||||
|
- /attraction
|
||||||
|
- /<ID>/subscribe -> subscribe notifications
|
||||||
|
- /<ID>/unsubscribe -> unsubscribe notifications
|
||||||
|
- /notification
|
||||||
|
- /list
|
||||||
|
- parameters: date, themepark
|
||||||
|
- /add-target
|
||||||
|
- parameters: name, url
|
||||||
|
- /remove-target
|
||||||
|
- parmeters: target-id
|
||||||
|
- /enable-notification
|
||||||
|
- /disable-notification
|
||||||
|
- /logbook
|
||||||
|
- /list
|
||||||
|
- parameters: date, themepark -> both optional
|
||||||
|
- /add-entry
|
||||||
|
- parameters: attraction, expected-waittime, real-waittime, unix-timestamp
|
||||||
|
- /edit-entry -> optional, if it makes sense
|
||||||
|
- parameters: entry-id, attraction, expected-waittime, real-waittime
|
||||||
|
- /remove-entry
|
||||||
|
- parameters: entry-id
|
||||||
|
- /user
|
||||||
|
- /delete-account -> deletes current account & all associated data instantly
|
||||||
|
|
@ -1,9 +1,17 @@
|
||||||
import { Hono } from 'hono'
|
import { Hono } from 'hono'
|
||||||
|
import { bearerAuth } from 'hono/bearer-auth'
|
||||||
|
import notification from './notification'
|
||||||
|
import logbook from './logbook'
|
||||||
|
|
||||||
|
// create app
|
||||||
const app = new Hono()
|
const app = new Hono()
|
||||||
|
|
||||||
app.get('/', (c) => {
|
// add bearer authentication
|
||||||
return c.text('Hello Hono!')
|
const token = 'insecure-token'
|
||||||
})
|
|
||||||
|
|
||||||
|
app.use('/*', bearerAuth({ token }))
|
||||||
|
|
||||||
|
// define routes & export app
|
||||||
|
app.route('/notification', notification)
|
||||||
|
app.route('/logbook', logbook)
|
||||||
export default app
|
export default app
|
||||||
|
|
|
||||||
13
themepark-assistant/src/logbook.ts
Normal file
13
themepark-assistant/src/logbook.ts
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
import { Hono } from 'hono'
|
||||||
|
|
||||||
|
const app = new Hono()
|
||||||
|
|
||||||
|
app.get('/list', (c) => {
|
||||||
|
return c.json(
|
||||||
|
{
|
||||||
|
message: 'List all logbook entries'
|
||||||
|
}
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
|
export default app
|
||||||
13
themepark-assistant/src/notification.ts
Normal file
13
themepark-assistant/src/notification.ts
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
import { Hono } from 'hono'
|
||||||
|
|
||||||
|
const app = new Hono()
|
||||||
|
|
||||||
|
app.get('/list', (c) => {
|
||||||
|
return c.json(
|
||||||
|
{
|
||||||
|
message: 'List all notification methods'
|
||||||
|
}
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
|
export default app
|
||||||
Loading…
Add table
Add a link
Reference in a new issue