Skip to content

Commit 934331d

Browse files
committed
Revert "fix: UUID init. uuid.New() (#58)"
This reverts commit 7031e63.
1 parent 7031e63 commit 934331d

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

backend/internal/chat/repository.go

+18-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ func NewRepository(db *db.Database) Repository {
3434
func (r *repository) CreateChatRoom(ctx context.Context, chatRoom *ChatRoom) (*ChatRoom, error) {
3535

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

6665
// FindChatRoomInfoByID implements Repository.
6766
func (r *repository) FindChatRoomInfoByID(ctx context.Context, chatRoomID uuid.UUID) (*ChatRoomInfo, error) {
68-
67+
/*chatRoomInfo := &ChatRoomInfo{}
68+
query := `
69+
SELECT
70+
uicr.id,
71+
uicr.user_id,
72+
uicr.chat_room_id,
73+
cr.created_at
74+
FROM users_in_chat_rooms AS uicr
75+
INNER JOIN chat_rooms AS cr ON uicr.chat_room_id = cr.id
76+
WHERE cr.id = $1
77+
GROUP BY uicr.id, uicr.user_id, uicr.chat_room_id, cr.created_at
78+
`
79+
rows, err := r.db.Pool.Query(ctx, query, chatRoomID)
80+
if err != nil {
81+
log.Printf("Failed to fetch chat room info, err: %v", err)
82+
return nil, err
83+
}
84+
defer rows.Close() */
6985
sqlcRows, err := r.db.Querier.FindChatRoomInfoByID(ctx, chatRoomID)
7086
if err != nil {
7187
slog.Error("Error finding chat room info by ID", "error", err, "chatRoomID", chatRoomID)

0 commit comments

Comments
 (0)