diff --git a/README.md b/README.md index ea19717..b823835 100644 --- a/README.md +++ b/README.md @@ -102,27 +102,6 @@ go run main.go Make sure PostgreSQL is running and reachable using the values in your `.env` file (`POSTGRES_HOST`, `POSTGRES_PORT`, `POSTGRES_USER`, `POSTGRES_PASSWORD`, `POSTGRES_DB`). -### Running database migrations - -```bash -cd server -psql "postgres://$POSTGRES_USER:$POSTGRES_PASSWORD@$POSTGRES_HOST:$POSTGRES_PORT/$POSTGRES_DB" \ -for migration in /app/migrations/*_up.sql; do - filename=$(basename "$migration") - already_applied=$(psql "${DB_URL}" -tAc \ - "SELECT COUNT(*) FROM schema_migrations WHERE filename = '${filename}'") - if [ "$already_applied" = "0" ]; then - echo "Applying ${filename}..." - psql "${DB_URL}" -f "$migration" - psql "${DB_URL}" -c \ - "INSERT INTO schema_migrations (filename) VALUES ('${filename}')" - echo "${filename} applied." - else - echo "${filename} already applied, skipping." - fi -done -``` - ### Running the mobile app ```bash @@ -146,6 +125,13 @@ flutter run | `ARGON_MEMORY` | Argon2id memory cost (KB) | `65536` | | `ARGON_ITERATIONS` | Argon2id iteration count | `3` | | `ARGON_PARALLELISM` | Argon2id parallelism degree | `2` | +|`GOOGLE_CLIENT_ID`| Google OAuth client ID| — | +| `GOOGLE_CLIENT_SECRET` | Google OAuth client secrett | — | +| `GOOGLE_REDIRECT_URL` | Google OAuth redirect callback URL | `http://HOST:PORT/api/auth/google/callback` | +| `GITHUB_CLIENT_ID` | GitHub OAuth client ID | — | +| `GITHUB_CLIENT_SECRET` | GitHub OAuth client secret | — | +| `GITHUB_REDIRECT_URL` | GitHub OAuth redirect callback URL | `http://HOST:PORT/api/auth/github/callback` | + See `.env.example` for a starting template. diff --git a/docs/API_CONTRACTS.md b/docs/API_CONTRACTS.md index ddf2c08..bb8f13f 100644 --- a/docs/API_CONTRACTS.md +++ b/docs/API_CONTRACTS.md @@ -17,13 +17,25 @@ | POST | [/api/auth/login](#2-login-user) | Log in and receive a token pair | | POST | [/api/auth/refresh](#3-refresh) | Exchange a refresh token for a new token pair | | GET | [/api/users/me](#1-user-me) | Get the authenticated user's profile | -| GET | [/api/users/:id](#2-search-user-by-id) | Search users by username or display name | -| GET | [/api/users/search?q=&page=&limit=](#3-search-user-by-username-and-display-name) | Get a public user profile | -| GET | [/ws](#websocket-endpoints) | WebSocket upgrade endpoint (JWT required) | +| GET | [/api/users/:id](#2-search-user-by-id) | Search users by User id | +| GET | [/api/users/search?q=&page=&limit=](#3-search-user-by-username-and-display-name) | Search user by username and display name | +| GET | [/ws](#1-connect-to-websocket) | WebSocket upgrade endpoint (JWT required) | +| WS | [Client to Server](#2-client-to-server-messages) | Client to Server Websocket | +| WS | [Server to Client](#3-server-to-client-messages) | Server to Client Websocket | | POST | [/api/messages](#1-send-message) | Send a message (REST fallback) | | GET | [/api/messages?with=&before=&limit=](#2-message-history) | Paginated message history | +| GET | [/api/messages/conversations](#3-conversations) | Get user conversatiosn | +| POST | [/api/messages/read](#4-read) | Get read mark | +| POST | [/api/groups/](#1-create-group) | Create Group | +| GET | [/api/groups/](#2-get-groups) | Get all groups of user | +| GET | [/api/group/{id}](#3-get-group-by-group-id) | Get group by group id | +| GET | [/api/groups/{id}/messages](#4-get-messages-of-group) | Get message of a group | +| GET | [/api/groups/{id}/members](#5-group-members) | Get group members | +| POST | [/api/groups/{id}/leave](#6-leave-group) | Leave a group | +| PATCH | [/api/groups/{id}/](#7-update-group-details) | Update Group Details | +| POST | [/api/groups/{id}/members](#8-add-member-to-group) | Add members to group | +| DELETE | [/api/groups/{id}/members/{user_id}](#9-remove-user-from-group) | Remove member from group | -All endpoints except `/api/health`, `/api/auth/register`, and `/api/auth/login` require a `Bearer` token in the `Authorization` header. ## Health Endpoint @@ -45,7 +57,7 @@ Returned when the server runtime is healthy and can successfully execute a ping "success": true, "data": { "postgres": "up", - "timestamp": "