@@ -34,7 +34,6 @@ func NewRepository(db *db.Database) Repository {
34
34
func (r * repository ) CreateChatRoom (ctx context.Context , chatRoom * ChatRoom ) (* ChatRoom , error ) {
35
35
36
36
err := r .db .Querier .CreateChatRoom (ctx , sqlc.CreateChatRoomParams {
37
- ID : uuid .New (),
38
37
Name : sqlc .StringToPgtype (chatRoom .Name ),
39
38
CreatedAt : sqlc .TimeToPgtype (time .Now ()),
40
39
})
@@ -65,7 +64,24 @@ func (r *repository) FindChatRoomByID(ctx context.Context, id uuid.UUID) (*ChatR
65
64
66
65
// FindChatRoomInfoByID implements Repository.
67
66
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() */
69
85
sqlcRows , err := r .db .Querier .FindChatRoomInfoByID (ctx , chatRoomID )
70
86
if err != nil {
71
87
slog .Error ("Error finding chat room info by ID" , "error" , err , "chatRoomID" , chatRoomID )
0 commit comments