Skip to content

Commit

Permalink
Revert "fix: UUID init. uuid.New() (#58)"
Browse files Browse the repository at this point in the history
This reverts commit 7031e63.
  • Loading branch information
igh9410 committed Sep 17, 2024
1 parent 7031e63 commit 934331d
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions backend/internal/chat/repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ func NewRepository(db *db.Database) Repository {
func (r *repository) CreateChatRoom(ctx context.Context, chatRoom *ChatRoom) (*ChatRoom, error) {

err := r.db.Querier.CreateChatRoom(ctx, sqlc.CreateChatRoomParams{
ID: uuid.New(),
Name: sqlc.StringToPgtype(chatRoom.Name),
CreatedAt: sqlc.TimeToPgtype(time.Now()),
})
Expand Down Expand Up @@ -65,7 +64,24 @@ func (r *repository) FindChatRoomByID(ctx context.Context, id uuid.UUID) (*ChatR

// FindChatRoomInfoByID implements Repository.
func (r *repository) FindChatRoomInfoByID(ctx context.Context, chatRoomID uuid.UUID) (*ChatRoomInfo, error) {

/*chatRoomInfo := &ChatRoomInfo{}
query := `
SELECT
uicr.id,
uicr.user_id,
uicr.chat_room_id,
cr.created_at
FROM users_in_chat_rooms AS uicr
INNER JOIN chat_rooms AS cr ON uicr.chat_room_id = cr.id
WHERE cr.id = $1
GROUP BY uicr.id, uicr.user_id, uicr.chat_room_id, cr.created_at
`
rows, err := r.db.Pool.Query(ctx, query, chatRoomID)
if err != nil {
log.Printf("Failed to fetch chat room info, err: %v", err)
return nil, err
}
defer rows.Close() */
sqlcRows, err := r.db.Querier.FindChatRoomInfoByID(ctx, chatRoomID)
if err != nil {
slog.Error("Error finding chat room info by ID", "error", err, "chatRoomID", chatRoomID)
Expand Down

0 comments on commit 934331d

Please sign in to comment.