mirror of
https://github.com/michivonah/themepark-assistant.git
synced 2025-12-22 22:16:29 +01:00
improve readme structure
This commit is contained in:
parent
6bb5037eae
commit
60a75f7894
1 changed files with 49 additions and 23 deletions
70
README.md
70
README.md
|
|
@ -1,14 +1,50 @@
|
||||||
# themepark-assistant
|
# themepark-assistant
|
||||||
A tool for improving your trips to themeparks - once developed
|
A tool for improving your trips to themeparks - once developed
|
||||||
|
|
||||||
## Testing
|
## Repo structure
|
||||||
Send request
|
- /api: API implementation
|
||||||
|
- ./: config files
|
||||||
|
- /src: API Code
|
||||||
|
- /db: Database client, schema & migrations
|
||||||
|
- /errors: Error types
|
||||||
|
- index.ts: Exporter for all error classes
|
||||||
|
- /jobs: Background tasks
|
||||||
|
- /lib: Reusable functions
|
||||||
|
- /routes: API Endpoints
|
||||||
|
- /types: Data type definitions
|
||||||
|
- index.ts: Entrypoint for API Requests & background tasks on Cloudflare Workers
|
||||||
|
|
||||||
|
|
||||||
|
## Development
|
||||||
|
### Run enviromnment
|
||||||
|
Run worker locally (without remote d1 access, scheduled tasks not available)
|
||||||
|
```bash
|
||||||
|
npx wrangler dev
|
||||||
|
```
|
||||||
|
|
||||||
|
Run worker locally (without remote d1 access, scheduled tasks available)
|
||||||
|
```bash
|
||||||
|
npx wrangler dev --test-scheduled
|
||||||
|
```
|
||||||
|
|
||||||
|
Run worker locally (with remote connection to d1, scheduled tasks available)
|
||||||
|
```bash
|
||||||
|
npx wrangler dev --remote --test-scheduled
|
||||||
|
```
|
||||||
|
|
||||||
|
### Requests
|
||||||
|
Send request with bearer authentication
|
||||||
```bash
|
```bash
|
||||||
curl -H "Authorization: Bearer insecure-token" http://127.0.0.1:8787/notification/list
|
curl -H "Authorization: Bearer insecure-token" http://127.0.0.1:8787/notification/list
|
||||||
```
|
```
|
||||||
|
|
||||||
## Update cloudflare d1 db
|
Run request with cron expression (for executing background tasks)
|
||||||
|
```bash
|
||||||
|
curl "http://localhost:8787/__scheduled?cron=*+*+*+*+*"
|
||||||
|
```
|
||||||
|
|
||||||
|
### Drizzle DB migrations
|
||||||
|
Update cloudflare d1 db
|
||||||
DB scheme is defined in typescript
|
DB scheme is defined in typescript
|
||||||
|
|
||||||
apply changes
|
apply changes
|
||||||
|
|
@ -21,35 +57,25 @@ export sql statements instead of running migration
|
||||||
npx drizzle-kit export --config=drizzle-dev.config.ts
|
npx drizzle-kit export --config=drizzle-dev.config.ts
|
||||||
```
|
```
|
||||||
|
|
||||||
## SQLite / D1
|
### Useful sql statements for SQLite / D1
|
||||||
Delete view
|
Delete view
|
||||||
```sql
|
```sql
|
||||||
DROP VIEW IF EXISTS attraction_subscriptions;
|
DROP VIEW IF EXISTS attraction_subscriptions;
|
||||||
```
|
```
|
||||||
|
|
||||||
## Cloudflare workers tricks
|
### Cloudflare workers tricks
|
||||||
If types are missing, run:
|
If types are missing, run:
|
||||||
```bash
|
```bash
|
||||||
npx wrangler types
|
npx wrangler types
|
||||||
```
|
```
|
||||||
|
|
||||||
## Testing cronjobs
|
## Authentication endpoints (auth.js)
|
||||||
Run worker locally (without remote d1 access)
|
|
||||||
```bash
|
|
||||||
npx wrangler dev --test-scheduled
|
|
||||||
```
|
|
||||||
|
|
||||||
Run worker locally (with remote connection to d1)
|
|
||||||
```bash
|
|
||||||
npx wrangler dev --remote --test-scheduled
|
|
||||||
```
|
|
||||||
|
|
||||||
Run curl request with cron expression
|
|
||||||
```bash
|
|
||||||
curl "http://localhost:8787/__scheduled?cron=*+*+*+*+*"
|
|
||||||
```
|
|
||||||
|
|
||||||
## Authentication endpoints
|
|
||||||
- /auth/signin -> Login
|
- /auth/signin -> Login
|
||||||
- /auth/signout -> Logout
|
- /auth/signout -> Logout
|
||||||
- /auth/callback/github -> Callback for GitHub OAuth config
|
- /auth/callback/github -> Callback for GitHub OAuth config
|
||||||
|
|
||||||
|
## Contributing
|
||||||
|
TBD
|
||||||
|
|
||||||
|
## License
|
||||||
|
TBD
|
||||||
Loading…
Add table
Add a link
Reference in a new issue