Skip to content

Commit 5b2e08c

Browse files
committed
Merge branch 'main' into eric/rooms-list-sort-by-button
2 parents 6bf77c3 + eaa77fe commit 5b2e08c

File tree

28 files changed

+1204
-447
lines changed

28 files changed

+1204
-447
lines changed

backend/.env.sample

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,22 @@
1-
DB_HOST=localhost
2-
DB_PORT=54322
3-
DB_USER=postgres
4-
DB_PASSWORD=postgres
5-
DB_NAME=postgres
6-
DB_MAX_CONNS=8
7-
DB_MAX_CONN_LIFETIME=30s
1+
DB_USER=""
2+
DB_PASSWORD=""
3+
DB_HOST=""
4+
DB_PORT=""
5+
DB_NAME=""
6+
PORT="8080"
7+
APP_LOG_LEVEL="info"
8+
9+
DEV_CLERK_SECRET_KEY="secret"
10+
DEV_CLERK_WEBHOOK_SIGNATURE="secret"
11+
ENV="dev/prod"
12+
13+
NGROK_DOMAIN="your own stable domain"
14+
LLM_SERVER_ADDRESS="http://127.0.0.1:11434"
15+
LLM_MODEL="qwen2.5:7b-instruct"
16+
LLM_TIMEOUT="60"
17+
LLM_MAX_OUTPUT_TOKENS="1024"
18+
LLM_TEMPERATURE="0.2"
19+
20+
# Redis Configuration
21+
REDIS_ADDR=localhost:6379
22+
REDIS_PASSWORD=

backend/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ genkit-run: llm-start db-start
4545
sync-users:
4646
@$(LOAD_ENV) go run ./cmd/clerk/sync.go
4747

48-
rooms-list-seed:
49-
@$(LOAD_ENV) bash scripts/rooms-list-seed.sh
48+
seed:
49+
@$(LOAD_ENV) bash scripts/seed.sh
5050

5151
test:
5252
@$(LOAD_ENV) \

backend/docs/swagger.yaml

Lines changed: 109 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,12 @@ basePath: /api/v1
22
definitions:
33
CreateGuest:
44
properties:
5-
email:
6-
example: jane.doe@example.com
7-
type: string
85
first_name:
96
example: Jane
107
type: string
118
last_name:
129
example: Doe
1310
type: string
14-
notes:
15-
example: VIP
16-
type: string
17-
phone:
18-
example: +1 (617) 012-3456
19-
type: string
20-
preferences:
21-
example: extra pillows
22-
type: string
2311
profile_picture:
2412
example: https://example.com/john.jpg
2513
type: string
@@ -83,9 +71,6 @@ definitions:
8371
created_at:
8472
example: "2024-01-02T00:00:00Z"
8573
type: string
86-
email:
87-
example: jane.doe@example.com
88-
type: string
8974
first_name:
9075
example: Jane
9176
type: string
@@ -95,15 +80,6 @@ definitions:
9580
last_name:
9681
example: Doe
9782
type: string
98-
notes:
99-
example: VIP
100-
type: string
101-
phone:
102-
example: +1 (617) 012-3456
103-
type: string
104-
preferences:
105-
example: extra pillows
106-
type: string
10783
profile_picture:
10884
example: https://example.com/john.jpg
10985
type: string
@@ -114,6 +90,51 @@ definitions:
11490
example: "2024-01-02T00:00:00Z"
11591
type: string
11692
type: object
93+
GuestBooking:
94+
properties:
95+
arrival_date:
96+
type: string
97+
departure_date:
98+
type: string
99+
guest:
100+
$ref: '#/definitions/Guest'
101+
hotel_id:
102+
example: 521e8400-e458-41d4-a716-446655440000
103+
type: string
104+
id:
105+
example: f353ca91-4fc5-49f2-9b9e-304f83d11914
106+
type: string
107+
room:
108+
$ref: '#/definitions/Room'
109+
status:
110+
$ref: '#/definitions/github_com_generate_selfserve_internal_models.BookingStatus'
111+
type: object
112+
GuestFilters:
113+
properties:
114+
cursor:
115+
type: string
116+
floors:
117+
items:
118+
type: integer
119+
type: array
120+
hotel_id:
121+
type: string
122+
limit:
123+
maximum: 100
124+
minimum: 1
125+
type: integer
126+
required:
127+
- hotel_id
128+
type: object
129+
GuestPage:
130+
properties:
131+
data:
132+
items:
133+
$ref: '#/definitions/GuestWithBooking'
134+
type: array
135+
next_cursor:
136+
type: string
137+
type: object
117138
GuestWithBooking:
118139
properties:
119140
first_name:
@@ -126,6 +147,12 @@ definitions:
126147
type: string
127148
room_number:
128149
type: integer
150+
required:
151+
- first_name
152+
- floor
153+
- id
154+
- last_name
155+
- room_number
129156
type: object
130157
GuestWithStays:
131158
properties:
@@ -159,9 +186,11 @@ definitions:
159186
example: extra pillows
160187
type: string
161188
required:
189+
- current_stays
162190
- first_name
163191
- id
164192
- last_name
193+
- past_stays
165194
type: object
166195
Hotel:
167196
properties:
@@ -293,6 +322,17 @@ definitions:
293322
example: 521ee400-e458-41d4-a716-446655440000
294323
type: string
295324
type: object
325+
Room:
326+
properties:
327+
floor:
328+
type: integer
329+
room_number:
330+
type: integer
331+
room_status:
332+
type: string
333+
suite_type:
334+
type: string
335+
type: object
296336
RoomWithOptionalGuestBooking:
297337
properties:
298338
booking_status:
@@ -420,78 +460,44 @@ info:
420460
version: "1.0"
421461
paths:
422462
/api/v1/guests:
423-
get:
424-
description: Retrieves guests optionally filtered by floor in which they are
425-
staying
463+
post:
464+
consumes:
465+
- application/json
466+
description: Retrieves guests optionally filtered by floor
426467
parameters:
427468
- description: Hotel ID (UUID)
428469
in: header
429470
name: X-Hotel-ID
430471
required: true
431472
type: string
432-
- description: Floor
433-
in: query
434-
name: number
435-
type: string
436-
produces:
437-
- application/json
438-
responses:
439-
"200":
440-
description: OK
441-
schema:
442-
items:
443-
$ref: '#/definitions/GuestWithBooking'
444-
type: array
445-
"400":
446-
description: Bad Request
447-
schema:
448-
additionalProperties:
449-
type: string
450-
type: object
451-
"500":
452-
description: Internal Server Error
453-
schema:
454-
additionalProperties:
455-
type: string
456-
type: object
457-
security:
458-
- BearerAuth: []
459-
summary: Get Guests
460-
tags:
461-
- guests
462-
post:
463-
consumes:
464-
- application/json
465-
description: Creates a guest with the given data
466-
parameters:
467-
- description: Guest data
473+
- description: Guest filters
468474
in: body
469-
name: request
475+
name: body
470476
required: true
471477
schema:
472-
$ref: '#/definitions/CreateGuest'
478+
$ref: '#/definitions/GuestFilters'
473479
produces:
474480
- application/json
475481
responses:
476482
"200":
477483
description: OK
478484
schema:
479-
$ref: '#/definitions/Guest'
485+
$ref: '#/definitions/GuestPage'
480486
"400":
481-
description: Invalid guest body format
487+
description: Bad Request
482488
schema:
483489
additionalProperties:
484490
type: string
485491
type: object
486492
"500":
487-
description: Internal server error
493+
description: Internal Server Error
488494
schema:
489495
additionalProperties:
490496
type: string
491497
type: object
492498
security:
493499
- BearerAuth: []
494-
summary: Creates a guest
500+
summary: Get Guests
495501
tags:
496502
- guests
497503
/api/v1/guests/{id}:
@@ -720,6 +726,40 @@ paths:
720726
summary: Get developer member
721727
tags:
722728
- devs
729+
/guest_bookings/floor:
730+
get:
731+
description: Retrieves multiple guest bookings whose booked rooms are in the
732+
provided floors array
733+
parameters:
734+
- description: Comma-separated floor numbers
735+
in: query
736+
name: floors
737+
required: true
738+
type: string
739+
produces:
740+
- application/json
741+
responses:
742+
"200":
743+
description: OK
744+
schema:
745+
items:
746+
$ref: '#/definitions/GuestBooking'
747+
type: array
748+
"400":
749+
description: Bad Request
750+
schema:
751+
additionalProperties:
752+
type: string
753+
type: object
754+
"500":
755+
description: Internal Server Error
756+
schema:
757+
additionalProperties:
758+
type: string
759+
type: object
760+
summary: Get guest Bookings By Floor
761+
tags:
762+
- guest-bookings
723763
/hello:
724764
get:
725765
consumes:

backend/go.mod

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ require (
1111
github.com/firebase/genkit/go v1.4.0
1212
github.com/go-playground/validator/v10 v10.30.1
1313
github.com/gofiber/adaptor/v2 v2.2.1
14+
github.com/redis/go-redis/v9 v9.17.3
1415
github.com/sethvargo/go-envconfig v1.3.0
1516
github.com/stretchr/testify v1.11.1
1617
github.com/swaggo/http-swagger v1.3.4
@@ -36,9 +37,11 @@ require (
3637
github.com/aws/smithy-go v1.24.0 // indirect
3738
github.com/bahlo/generic-list-go v0.2.0 // indirect
3839
github.com/buger/jsonparser v1.1.1 // indirect
40+
github.com/cespare/xxhash/v2 v2.3.0 // indirect
3941
github.com/clipperhouse/stringish v0.1.1 // indirect
4042
github.com/clipperhouse/uax29/v2 v2.3.0 // indirect
4143
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
44+
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
4245
github.com/gabriel-vasile/mimetype v1.4.12 // indirect
4346
github.com/go-jose/go-jose/v3 v3.0.4 // indirect
4447
github.com/go-logr/logr v1.4.3 // indirect

backend/go.sum

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,14 @@ github.com/aws/smithy-go v1.24.0 h1:LpilSUItNPFr1eY85RYgTIg5eIEPtvFbskaFcmmIUnk=
4242
github.com/aws/smithy-go v1.24.0/go.mod h1:LEj2LM3rBRQJxPZTB4KuzZkaZYnZPnvgIhb4pu07mx0=
4343
github.com/bahlo/generic-list-go v0.2.0 h1:5sz/EEAK+ls5wF+NeqDpk5+iNdMDXrh3z3nPnH1Wvgk=
4444
github.com/bahlo/generic-list-go v0.2.0/go.mod h1:2KvAjgMlE5NNynlg/5iLrrCCZ2+5xWbdbCW3pNTGyYg=
45+
github.com/bsm/ginkgo/v2 v2.12.0 h1:Ny8MWAHyOepLGlLKYmXG4IEkioBysk6GpaRTLC8zwWs=
46+
github.com/bsm/ginkgo/v2 v2.12.0/go.mod h1:SwYbGRRDovPVboqFv0tPTcG1sN61LM1Z4ARdbAV9g4c=
47+
github.com/bsm/gomega v1.27.10 h1:yeMWxP2pV2fG3FgAODIY8EiRE3dy0aeFYt4l7wh6yKA=
48+
github.com/bsm/gomega v1.27.10/go.mod h1:JyEr/xRbxbtgWNi8tIEVPUYZ5Dzef52k01W3YH0H+O0=
4549
github.com/buger/jsonparser v1.1.1 h1:2PnMjfWD7wBILjqQbt530v576A/cAbQvEW9gGIpYMUs=
4650
github.com/buger/jsonparser v1.1.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0=
51+
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
52+
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
4753
github.com/clerk/clerk-sdk-go/v2 v2.5.1 h1:RsakGNW6ie83b9KIRtKzqDXBJ//cURy9SJUbGhrsIKg=
4854
github.com/clerk/clerk-sdk-go/v2 v2.5.1/go.mod h1:ncFmsPwmD5WpGCNW5bJve862j/HQfpkzsshXYV/quJ8=
4955
github.com/clipperhouse/stringish v0.1.1 h1:+NSqMOr3GR6k1FdRhhnXrLfztGzuG+VuFDfatpWHKCs=
@@ -53,6 +59,8 @@ github.com/clipperhouse/uax29/v2 v2.3.0/go.mod h1:Wn1g7MK6OoeDT0vL+Q0SQLDz/KpfsV
5359
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
5460
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
5561
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
62+
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78=
63+
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc=
5664
github.com/firebase/genkit/go v1.4.0 h1:CP1hNWk7z0hosyY53zMH6MFKFO1fMLtj58jGPllQo6I=
5765
github.com/firebase/genkit/go v1.4.0/go.mod h1:HX6m7QOaGc3MDNr/DrpQZrzPLzxeuLxrkTvfFtCYlGw=
5866
github.com/gabriel-vasile/mimetype v1.4.12 h1:e9hWvmLYvtp846tLHam2o++qitpguFiYCKbn0w9jyqw=
@@ -147,6 +155,8 @@ github.com/mbleigh/raymond v0.0.0-20250414171441-6b3a58ab9e0a/go.mod h1:Y6ghKH+Z
147155
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
148156
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
149157
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
158+
github.com/redis/go-redis/v9 v9.17.3 h1:fN29NdNrE17KttK5Ndf20buqfDZwGNgoUr9qjl1DQx4=
159+
github.com/redis/go-redis/v9 v9.17.3/go.mod h1:u410H11HMLoB+TP67dz8rL9s6QW2j76l0//kSOd3370=
150160
github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ=
151161
github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc=
152162
github.com/sethvargo/go-envconfig v1.3.0 h1:gJs+Fuv8+f05omTpwWIu6KmuseFAXKrIaOZSh8RMt0U=

0 commit comments

Comments
 (0)