Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
1af0eb1
feat: link frontend to backend for guests
zaydaanjahangir Mar 27, 2026
ec72610
fix: Update group size filtering, date rendering, added tests
zaydaanjahangir Mar 31, 2026
eb2c315
Merge remote-tracking branch 'origin/main' into feat/129-link-geusts-…
zaydaanjahangir Mar 31, 2026
fb5acc9
style: Fix linting
zaydaanjahangir Mar 31, 2026
75fe730
Merge remote-tracking branch 'origin/main' into feat/129-link-geusts-…
zaydaanjahangir Apr 1, 2026
e1a7e85
Merge remote-tracking branch 'origin/main' into feat/129-link-geusts-…
zaydaanjahangir Apr 1, 2026
586f926
feat: Clean up code, add sorting on guest stays, notes handling
zaydaanjahangir Apr 4, 2026
d3b67d3
Merge branch 'main' into feat/129-link-geusts-frontend-to-backend
zaydaanjahangir Apr 4, 2026
410418f
style: Fix styling
zaydaanjahangir Apr 4, 2026
8dd6492
Merge branch 'feat/129-link-geusts-frontend-to-backend' of https://gi…
zaydaanjahangir Apr 4, 2026
e36b3f9
style: Fix styling
zaydaanjahangir Apr 4, 2026
3303821
Merge branch 'main' into feat/129-link-geusts-frontend-to-backend
zaydaanjahangir Apr 4, 2026
4a918d2
Merge remote-tracking branch 'origin/main' into feat/129-link-geusts-…
zaydaanjahangir Apr 9, 2026
cb15a74
feat: fix the stay-history scan, sort stay slices
zaydaanjahangir Apr 9, 2026
0c1cb80
feat: Update guestsContent with a plain if statement
zaydaanjahangir Apr 9, 2026
da8494a
feat: Wire filters to backend, update guests list display
zaydaanjahangir Apr 9, 2026
3c59258
feat: Persist notes
zaydaanjahangir Apr 9, 2026
cfd8367
feat: fix failed to get get guests bug
zaydaanjahangir Apr 9, 2026
9ad49e5
style: fix styling
zaydaanjahangir Apr 9, 2026
4c599fe
style: fix styling
zaydaanjahangir Apr 9, 2026
bf4c3ba
fix: fix failing test
zaydaanjahangir Apr 9, 2026
5761385
feat: Update param names and fix assistance marshalling
zaydaanjahangir Apr 10, 2026
3a1bc37
Merge branch 'main' into feat/129-link-geusts-frontend-to-backend
zaydaanjahangir Apr 10, 2026
096b961
fix: remove duplicate hotelID
zaydaanjahangir Apr 10, 2026
06514b3
fix: Remove extra tick
zaydaanjahangir Apr 10, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
112 changes: 95 additions & 17 deletions backend/docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -168,16 +168,12 @@ definitions:
items:
type: integer
type: array
hotel_id:
type: string
limit:
maximum: 100
minimum: 1
type: integer
search:
type: string
required:
- hotel_id
type: object
GuestPage:
properties:
Expand Down Expand Up @@ -216,18 +212,25 @@ definitions:
GuestWithBooking:
properties:
first_name:
example: Jane
type: string
floor:
example: 3
type: integer
group_size:
example: 2
type: integer
id:
example: 530e8400-e458-41d4-a716-446655440000
type: string
last_name:
example: Doe
type: string
preferred_name:
example: Jane
type: string
room_number:
example: 301
type: integer
required:
- first_name
Expand Down Expand Up @@ -644,41 +647,36 @@ paths:
post:
consumes:
- application/json
description: Retrieves guests optionally filtered by floor
description: Creates a guest with the given data
parameters:
- description: Hotel ID (UUID)
in: header
name: X-Hotel-ID
required: true
type: string
- description: Guest filters
- description: Guest data
in: body
name: body
name: request
required: true
schema:
$ref: '#/definitions/GuestFilters'
$ref: '#/definitions/CreateGuest'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/GuestPage'
$ref: '#/definitions/Guest'
"400":
description: Bad Request
description: Invalid guest body format
schema:
additionalProperties:
type: string
type: object
"500":
description: Internal Server Error
description: Internal server error
schema:
additionalProperties:
type: string
type: object
security:
- BearerAuth: []
summary: Get Guests
summary: Creates a guest
tags:
- guests
/api/v1/guests/{id}:
Expand Down Expand Up @@ -766,6 +764,86 @@ paths:
summary: Updates a guest
tags:
- guests
/api/v1/guests/search:
post:
consumes:
- application/json
description: Retrieves guests optionally filtered by floor
parameters:
- description: Hotel ID (UUID)
in: header
name: X-Hotel-ID
required: true
type: string
- description: Guest filters
in: body
name: body
required: true
schema:
$ref: '#/definitions/GuestFilters'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/GuestPage'
"400":
description: Bad Request
schema:
additionalProperties:
type: string
type: object
"500":
description: Internal Server Error
schema:
additionalProperties:
type: string
type: object
security:
- BearerAuth: []
summary: Get Guests
tags:
- guests
/api/v1/guests/stays/{id}:
get:
consumes:
- application/json
description: Retrieves a single guest with previous stays given an id
parameters:
- description: Guest ID (UUID)
in: path
name: id
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/GuestWithStays'
"400":
description: Invalid guest ID format
schema:
additionalProperties:
type: string
type: object
"404":
description: Guest not found
schema:
$ref: '#/definitions/github_com_generate_selfserve_internal_errs.HTTPError'
"500":
description: Internal server error
schema:
additionalProperties:
type: string
type: object
security:
- BearerAuth: []
summary: Gets a guest with previous stays
tags:
- guests
/api/v1/hotels:
post:
consumes:
Expand Down
5 changes: 3 additions & 2 deletions backend/internal/handler/guests.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ func (h *GuestsHandler) GetGuest(c *fiber.Ctx) error {
// @Failure 404 {object} errs.HTTPError "Guest not found"
// @Failure 500 {object} map[string]string "Internal server error"
// @Security BearerAuth
// @Router /guests/stays/{id} [get]
// @Router /api/v1/guests/stays/{id} [get]
func (h *GuestsHandler) GetGuestWithStays(c *fiber.Ctx) error {
id := c.Params("id")
if !validUUID(id) {
Expand All @@ -116,6 +116,7 @@ func (h *GuestsHandler) GetGuestWithStays(c *fiber.Ctx) error {
return errs.NotFound("guest", "id", id)

}
slog.Error("failed to get guest with stays", "id", id, "error", err)
return errs.InternalServerError()
}
return c.JSON(guest)
Expand Down Expand Up @@ -177,7 +178,7 @@ func (h *GuestsHandler) UpdateGuest(c *fiber.Ctx) error {
// @Failure 400 {object} map[string]string
// @Failure 500 {object} map[string]string
// @Security BearerAuth
// @Router /api/v1/guests [post]
// @Router /api/v1/guests/search [post]
func (h *GuestsHandler) GetGuests(c *fiber.Ctx) error {
hotelID := c.Get("X-Hotel-ID")
var filters models.GuestFilters
Expand Down
20 changes: 10 additions & 10 deletions backend/internal/models/guests.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ type Guest struct {
} //@name Guest

type GuestFilters struct {
HotelID string `json:"hotel_id" validate:"required,startswith=org_"`
HotelID string `json:"hotel_id" validate:"required,startswith=org_" swaggerignore:"true"`
Floors []int `json:"floors"`
GroupSize []int `json:"group_size"`
Search string `json:"search"`
Expand All @@ -65,13 +65,13 @@ type GuestPage struct {
} // @name GuestPage

type GuestWithBooking struct {
ID string `json:"id" validate:"required"`
FirstName string `json:"first_name" validate:"required"`
LastName string `json:"last_name" validate:"required"`
PreferredName string `json:"preferred_name"`
Floor int `json:"floor" validate:"required"`
RoomNumber int `json:"room_number" validate:"required"`
GroupSize *int `json:"group_size" validate:"required"`
ID string `json:"id" validate:"required" example:"530e8400-e458-41d4-a716-446655440000"`
FirstName string `json:"first_name" validate:"required" example:"Jane"`
LastName string `json:"last_name" validate:"required" example:"Doe"`
PreferredName string `json:"preferred_name" validate:"required" example:"Jane"`
Floor int `json:"floor" validate:"required" example:"3"`
RoomNumber int `json:"room_number" validate:"required" example:"301"`
GroupSize *int `json:"group_size" example:"2"`
} // @name GuestWithBooking

type GuestWithStays struct {
Expand All @@ -83,8 +83,8 @@ type GuestWithStays struct {
Preferences *string `json:"preferences,omitempty" example:"extra pillows"`
Notes *string `json:"notes,omitempty" example:"VIP"`
Pronouns *string `json:"pronouns,omitempty" example:"she/her"`
DoNotDisturbStart *time.Time `json:"do_not_disturb_start,omitempty" example:"17:00:00"`
DoNotDisturbEnd *time.Time `json:"do_not_disturb_end,omitempty" example:"07:00:00"`
DoNotDisturbStart *string `json:"do_not_disturb_start,omitempty" example:"17:00:00"`
DoNotDisturbEnd *string `json:"do_not_disturb_end,omitempty" example:"07:00:00"`
HousekeepingCadence *string `json:"housekeeping_cadence,omitempty" example:"daily"`
Assistance *Assistance `json:"assistance,omitempty"`
CurrentStays []Stay `json:"current_stays" validate:"required"`
Expand Down
Loading
Loading