MCPcopy Index your code
hub / github.com/coder/coder / GetChatMessageByID

Method GetChatMessageByID

coderd/database/dbauthz/dbauthz.go:3076–3089  ·  view source on GitHub ↗
(ctx context.Context, id int64)

Source from the content-addressed store, hash-verified

3074}
3075
3076func (q *querier) GetChatMessageByID(ctx context.Context, id int64) (database.ChatMessage, error) {
3077 // ChatMessages are authorized through their parent Chat.
3078 // We need to fetch the message first to get its chat_id.
3079 msg, err := q.db.GetChatMessageByID(ctx, id)
3080 if err != nil {
3081 return database.ChatMessage{}, err
3082 }
3083 // Authorize read on the parent chat.
3084 _, err = q.GetChatByID(ctx, msg.ChatID)
3085 if err != nil {
3086 return database.ChatMessage{}, err
3087 }
3088 return msg, nil
3089}
3090
3091func (q *querier) GetChatMessageSummariesPerChat(ctx context.Context, createdAfter time.Time) ([]database.GetChatMessageSummariesPerChatRow, error) {
3092 // Telemetry queries are called from system contexts only.

Callers

nothing calls this directly

Calls 2

GetChatByIDMethod · 0.95
GetChatMessageByIDMethod · 0.65

Tested by

no test coverage detected