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

Method GetChatCostPerChat

coderd/database/dbauthz/dbauthz.go:2843–2853  ·  view source on GitHub ↗
(ctx context.Context, arg database.GetChatCostPerChatParams)

Source from the content-addressed store, hash-verified

2841}
2842
2843func (q *querier) GetChatCostPerChat(ctx context.Context, arg database.GetChatCostPerChatParams) ([]database.GetChatCostPerChatRow, error) {
2844 // The owner's chats, may cross orgs. AnyOrganization() authorizes
2845 // the caller if they hold read permission on chats owned by
2846 // arg.OwnerID in any org they belong to.
2847 // TODO(CODAGT-161): the underlying SQL queries filter only by owner_id, not
2848 // organization_id.
2849 if err := q.authorizeContext(ctx, policy.ActionRead, rbac.ResourceChat.WithOwner(arg.OwnerID.String()).AnyOrganization()); err != nil {
2850 return nil, err
2851 }
2852 return q.db.GetChatCostPerChat(ctx, arg)
2853}
2854
2855func (q *querier) GetChatCostPerModel(ctx context.Context, arg database.GetChatCostPerModelParams) ([]database.GetChatCostPerModelRow, error) {
2856 // See GetChatCostPerChat for the authorization rationale.

Callers

nothing calls this directly

Calls 5

authorizeContextMethod · 0.95
AnyOrganizationMethod · 0.80
WithOwnerMethod · 0.80
GetChatCostPerChatMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected