brew install golang-migrate
Générer des identifiants de type "compte de service" depuis la console Google Cloud.
Récupérer le fichier de credentials, account_service.json
, à mettre à la racine.
Démarrer Postgres via Docker Compose
docker compose up -d
Configurer l'environnement
export DATABASE_URL="postgres://postgres:password@localhost:5432/groom?sslmode=disable"
export GROOM_API_KEY="your_api_key_here"
export GOOGLE_API_KEY="<your_google_api_key>"
export GOOGLE_CLIENT_ID="<your_google_client_id>"
export GOOGLE_CLIENT_SECRET="<your_google_client_secret>"
export GOOGLE_REDIRECT_URL="https://example.test/auth/callback"
export GOOGLE_WORKSPACE_DOMAIN="example.test"
export GOOGLE_SERVICE_ACCOUNT_IMPERSONATED_USER="service-account@example.test"
export GOOGLE_SERVICE_ACCOUNT_CREDENTIALS_FILE="./service_account.json"
Initialiser le projet
go mod init groom
To add module requirements and sums:
go mod tidy
Lancer l'application
go run ./cmd/groom
# Afficher la liste des rooms
http://localhost:3000
# Accéder à une room
http://localhost:3000/ma-room
# Lister les rooms avec statut d'occupation et nombre de participants
curl http://localhost:3000/api/user/rooms --cookie "session_cookie"
# Ajouter une room aux favoris
curl -X POST http://localhost:3000/api/user/rooms/1/star --cookie "session_cookie"
# Retirer une room des favoris
curl -X DELETE http://localhost:3000/api/user/rooms/1/star --cookie "session_cookie"
# Basculer le statut favori d'une room
curl -X POST http://localhost:3000/api/user/rooms/1/toggle-star --cookie "session_cookie"
# Ajouter une room
curl -X POST http://localhost:3000/api/rooms -d '{"slug":"nouvelle-salle"}' -H "Content-Type: application/json" -H "X-API-KEY: your_api_key_here"
# Modifiez une room existante
curl -X PUT http://localhost:3000/api/rooms/2 -d '{"slug":"salle-existante", "space_id":"xxx-yyyy-zzz"}' -H "Content-Type: application/json" -H "X-API-KEY: your_api_key_here"
# Supprimez une room
curl -X DELETE http://localhost:3000/api/rooms/1 -H "X-API-KEY: your_api_key_here"
# Vérifier l'état de santé du système
curl http://localhost:3000/healthz
migrate -path ./migrations -database ${DATABASE_URL} up
migrate -path ./migrations -database ${DATABASE_URL} down [1]