Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
f1d1744
Add S3 storage configuration and service
spokonya Jan 26, 2026
124ca04
finished s3 setup and added testing handler and endpoint
spokonya Jan 26, 2026
21ae351
chore: tidy go.mod dependencies
spokonya Jan 26, 2026
3871a29
go.mod tidy pt2
spokonya Jan 26, 2026
03b47ad
github slack workflow
spokonya Jan 30, 2026
b27e859
Delete and upload funcs
spokonya Feb 2, 2026
100ee0e
final photo + User endpoints for presign links and displaying the photo
spokonya Feb 6, 2026
02ae025
Merge branch 'main' into profile-picture-endpoints
spokonya Feb 6, 2026
7e40841
build errors
spokonya Feb 6, 2026
c76f3f2
build + Lint errors
spokonya Feb 6, 2026
9f349c3
didnt stage in last commit
spokonya Feb 6, 2026
44cfe55
removed unused import and added methods
spokonya Feb 6, 2026
69dec3b
removed the check for 'role' in validatecreateuser
spokonya Feb 6, 2026
783235e
revisions
spokonya Mar 11, 2026
dce4786
rewrote import for the changed s3 directory location
spokonya Mar 11, 2026
f58556d
missed import change
spokonya Mar 11, 2026
0d682e1
Merge branch 'main' into profile-picture-endpoints
spokonya Mar 11, 2026
7ac060e
added back strings and time import
spokonya Mar 11, 2026
3cb10d8
Add httpx package import in users.go
spokonya Mar 11, 2026
cbe6b5f
Add ClerkID field to CreateUser model
spokonya Mar 11, 2026
0c333a8
Rename hotelHandler to hotelsHandler for consistency
spokonya Mar 11, 2026
18bdfd5
Fix typo in hotel repository initialization
spokonya Mar 11, 2026
5adea0f
Fix hotelHandler variable name in server.go
spokonya Mar 11, 2026
7a55af1
called validate user and changed tests
spokonya Mar 11, 2026
61d294b
Merge branch 'main' into profile-picture-endpoints
spokonya Mar 24, 2026
72c9d23
Add closing brace to S3Storage interface
spokonya Mar 24, 2026
ae97605
Remove duplicate S3 configuration entry
spokonya Mar 24, 2026
e153f4a
fmt fix
spokonya Mar 24, 2026
f09e01e
addresing cmts
spokonya Mar 27, 2026
5cd3b5e
Merge branch 'main' into profile-picture-endpoints
spokonya Mar 27, 2026
affd3ec
Add UpdateUser method to UsersRepository interface
spokonya Mar 27, 2026
a36a854
format issue and test coverage
spokonya Mar 27, 2026
15c0837
Remove ClerkID field from user model
spokonya Apr 1, 2026
a0ea100
Merge branch 'main' into profile-picture-endpoints
spokonya Apr 1, 2026
a35227a
Revert "Remove ClerkID field from user model"
spokonya Apr 1, 2026
c56f5bd
added s3 store
spokonya Apr 1, 2026
23055b9
pass the correct params
spokonya Apr 1, 2026
a7c6b5c
type check fix
spokonya Apr 1, 2026
9d2ceb2
removed clerkID from users model and edited validation in s3storage
spokonya Apr 2, 2026
f70933c
fix validation
spokonya Apr 4, 2026
97c0e55
Remove clerkID from testing checks
spokonya Apr 4, 2026
608542b
Merge branch 'main' into profile-picture-endpoints
spokonya Apr 4, 2026
5dd59e9
tsconfig
spokonya Apr 4, 2026
403c0c3
make sawgger
spokonya Apr 4, 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
4 changes: 4 additions & 0 deletions backend/.env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ DB_PORT=""
DB_NAME=""
PORT="8080"
APP_LOG_LEVEL="info"
AWS_S3_ACCESS_KEY_ID=""
AWS_S3_SECRET_ACCESS_KEY_ID=""
AWS_S3_REGION=""
AWS_S3_BUCKET_NAME=""

DEV_CLERK_SECRET_KEY="secret"
DEV_CLERK_WEBHOOK_SIGNATURE="secret"
Expand Down
24 changes: 24 additions & 0 deletions backend/cmd/clerk/sync_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"testing"

"github.com/generate/selfserve/internal/models"
storage "github.com/generate/selfserve/internal/service/storage/postgres"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
Expand All @@ -24,6 +25,29 @@ func (m *mockUsersRepositorySync) BulkInsertUsers(ctx context.Context, users []*
return m.bulkInsertFunc(ctx, users)
}

func (m *mockUsersRepositorySync) FindUser(ctx context.Context, id string) (*models.User, error) {
return nil, nil
}

func (m *mockUsersRepositorySync) UpdateProfilePicture(ctx context.Context, userId string, key string) error {
return nil
}

func (m *mockUsersRepositorySync) DeleteProfilePicture(ctx context.Context, userId string) error {
return nil
}

func (m *mockUsersRepositorySync) GetKey(ctx context.Context, userId string) (string, error) {
return "", nil
}

func (m *mockUsersRepositorySync) UpdateUser(ctx context.Context, id string, update *models.UpdateUser) (*models.User, error) {
return nil, nil
}

// Makes the compiler verify the mock implements the interface
var _ storage.UsersRepository = (*mockUsersRepositorySync)(nil)

func TestSyncUsers(t *testing.T) {
t.Parallel()

Expand Down
2 changes: 1 addition & 1 deletion backend/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package config
type Config struct {
Application `env:",prefix=APP_"`
DB `env:",prefix=DB_"`
S3 `env:",prefix=AWS_S3_"`
LLM `env:",prefix=LLM_"`
Clerk `env:",prefix=CLERK_"`
S3 `env:",prefix=AWS_S3_"`
OpenSearch `env:",prefix=OPENSEARCH_"`
}
238 changes: 235 additions & 3 deletions backend/docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,13 @@ definitions:
description: nil when no more pages
type: string
type: object
internal_handler.UpdateProfilePictureRequest:
description: Request body containing the S3 key after uploading
properties:
key:
example: profile-pictures/user123/1706540000.jpg
type: string
type: object
host: localhost:8080
info:
contact:
Expand Down Expand Up @@ -1246,6 +1253,114 @@ paths:
summary: Get Floors
tags:
- rooms
/s3/presigned-get-url/{key}:
get:
consumes:
- application/json
description: Generates a presigned URL for a file. The key is the full S3 path
(e.g., profile-pictures/user123/image.jpg)
parameters:
- description: File key (full path after /presigned-url/)
in: path
name: key
required: true
type: string
produces:
- application/json
responses:
"200":
description: Presigned URL
schema:
type: string
"400":
description: Bad Request
schema:
additionalProperties:
type: string
type: object
"500":
description: Internal Server Error
schema:
additionalProperties:
type: string
type: object
summary: Generate a presigned URL for a file
tags:
- s3
/s3/presigned-url/{key}:
get:
consumes:
- application/json
description: Generates a presigned URL for a file. The key is the full S3 path
(e.g., profile-pictures/user123/image.jpg)
parameters:
- description: File key (full path after /presigned-url/)
in: path
name: key
required: true
type: string
produces:
- application/json
responses:
"200":
description: Presigned URL
schema:
type: string
"400":
description: Bad Request
schema:
additionalProperties:
type: string
type: object
"500":
description: Internal Server Error
schema:
additionalProperties:
type: string
type: object
summary: Generate a presigned URL for a file
tags:
- s3
/s3/upload-url/{userId}:
get:
description: Generates a presigned S3 URL and unique key for uploading a profile
picture. After uploading to S3, use PUT /users/{userId}/profile-picture to
save the key.
parameters:
- description: User ID
in: path
name: userId
required: true
type: string
- default: jpg
description: File extension (jpg, jpeg, png, webp)
in: query
name: ext
type: string
produces:
- application/json
responses:
"200":
description: Returns presigned_url and key
schema:
additionalProperties:
type: string
type: object
"400":
description: Bad Request
schema:
additionalProperties:
type: string
type: object
"500":
description: Internal Server Error
schema:
additionalProperties:
type: string
type: object
summary: Get presigned URL for profile picture upload
tags:
- s3
/users:
post:
consumes:
Expand Down Expand Up @@ -1320,14 +1435,14 @@ paths:
put:
consumes:
- application/json
description: Updates fields on a user
description: Updates allowed fields on a user
parameters:
- description: User ID
in: path
name: id
required: true
type: string
- description: User update data
- description: Fields to update
in: body
name: request
required: true
Expand Down Expand Up @@ -1360,7 +1475,124 @@ paths:
type: object
security:
- BearerAuth: []
summary: Updates a user
summary: Update user
tags:
- users
/users/{userId}/profile-picture:
delete:
consumes:
- application/json
description: Deletes the user's profile picture from the database
parameters:
- description: User ID
in: path
name: userId
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
additionalProperties:
type: string
type: object
"400":
description: Bad Request
schema:
additionalProperties:
type: string
type: object
"500":
description: Internal Server Error
schema:
additionalProperties:
type: string
type: object
summary: Delete user's profile picture
tags:
- users
get:
consumes:
- application/json
description: Retrieves the user's profile picture key and returns a presigned
URL for display
parameters:
- description: User ID
in: path
name: userId
required: true
type: string
produces:
- application/json
responses:
"200":
description: Returns key and presigned_url if profile picture exists
schema:
additionalProperties:
type: string
type: object
"400":
description: Bad Request
schema:
additionalProperties:
type: string
type: object
"404":
description: No profile picture found
schema:
additionalProperties:
type: string
type: object
"500":
description: Internal Server Error
schema:
additionalProperties:
type: string
type: object
summary: Get user's profile picture
tags:
- users
put:
consumes:
- application/json
description: Saves the S3 key to the user's profile after the image has been
uploaded to S3
parameters:
- description: User ID
in: path
name: userId
required: true
type: string
- description: S3 key from upload
in: body
name: request
required: true
schema:
$ref: '#/definitions/internal_handler.UpdateProfilePictureRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
additionalProperties:
type: string
type: object
"400":
description: Bad Request
schema:
additionalProperties:
type: string
type: object
"500":
description: Internal Server Error
schema:
additionalProperties:
type: string
type: object
summary: Update user's profile picture
tags:
- users
schemes:
Expand Down
Loading
Loading