mirror of
https://github.com/Dvorinka/Primora.git
synced 2026-10-28 07:41:23 +00:00
feat: integration/webhook counts in project overview
ProjectOverview gains integration_count + webhook_count (enabled only); dashboard Resources list gets an Integrations row linking to the new view. Covers the "dashboard widget if cheap" Phase 4 item. Authored By: TDvorak <[email protected]>
This commit is contained in:
1 parent
e25eb92339
commit
23186e38b8
8 files changed
+71
-2
No files matched your search
@@ -217,7 +217,18 @@ SELECT
|
||||
SELECT MAX(al.created_at)::TIMESTAMPTZ
|
||||
FROM core.audit_logs al
|
||||
WHERE al.project_id = p.id
|
||||
) AS last_audit_at
|
||||
) AS last_audit_at,
|
||||
(
|
||||
SELECT COUNT(*)::BIGINT
|
||||
FROM core.integrations i
|
||||
WHERE i.project_id = p.id
|
||||
) AS integration_count,
|
||||
(
|
||||
SELECT COUNT(*)::BIGINT
|
||||
FROM core.webhooks w
|
||||
WHERE w.project_id = p.id
|
||||
AND w.enabled
|
||||
) AS webhook_count
|
||||
FROM core.projects p
|
||||
WHERE p.id = $1
|
||||
`
|
||||
@@ -235,6 +246,8 @@ type GetProjectOverviewRow struct {
|
||||
PendingInvitationCount int64 `json:"pending_invitation_count"`
|
||||
AuditEvents24h int64 `json:"audit_events_24h"`
|
||||
LastAuditAt pgtype.Timestamptz `json:"last_audit_at"`
|
||||
IntegrationCount int64 `json:"integration_count"`
|
||||
WebhookCount int64 `json:"webhook_count"`
|
||||
}
|
||||
|
||||
func (q *Queries) GetProjectOverview(ctx context.Context, id uuid.UUID) (GetProjectOverviewRow, error) {
|
||||
@@ -253,6 +266,8 @@ func (q *Queries) GetProjectOverview(ctx context.Context, id uuid.UUID) (GetProj
|
||||
&i.PendingInvitationCount,
|
||||
&i.AuditEvents24h,
|
||||
&i.LastAuditAt,
|
||||
&i.IntegrationCount,
|
||||
&i.WebhookCount,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user