Skip to content

Commit 406049f

Browse files
committed
cleanup feeds
1 parent 36b584b commit 406049f

File tree

14 files changed

+433
-223
lines changed

14 files changed

+433
-223
lines changed

backend/internal/core/feeds/feeds.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ type Config struct {
1515
// Feed represents a webhook feed configuration
1616
type Feed struct {
1717
Name string `yaml:"name"`
18+
Category string `yaml:"category"`
1819
ID string `yaml:"id"` // used as the unique identifier
1920
Keys []string `yaml:"keys"` // used as the :key value in url path to resolve feed
2021
Description string `yaml:"description"`
@@ -27,6 +28,7 @@ type Feed struct {
2728
func (f Feed) IntoParsed() FeedParsed {
2829
fp := FeedParsed{
2930
Name: f.Name,
31+
Category: f.Category,
3032
ID: f.ID,
3133
Keys: f.Keys,
3234
Description: f.Description,
@@ -60,6 +62,7 @@ func (f Feed) IntoParsed() FeedParsed {
6062
// where none were assigned in the base type
6163
type FeedParsed struct {
6264
Name string `yaml:"name"`
65+
Category string `yaml:"category"`
6366
ID string `yaml:"id"` // used as the unique identifier
6467
Keys []string `yaml:"keys"` // used as the :key value in url path to resolve feed
6568
Description string `yaml:"description"`

backend/internal/data/db/feed_message.sql

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,21 +108,19 @@ SET
108108
WHERE
109109
id = ANY($1::uuid[]);
110110

111-
-- name: FeedMessageBulkDelete :one
111+
-- name: FeedMessageBulkDelete :execrows
112112
DELETE FROM
113113
feed_messages
114114
WHERE
115-
id = ANY(sqlc.arg('message_ids')::uuid[])
116-
RETURNING COUNT(*);
115+
id = ANY(sqlc.arg('message_ids')::uuid[]);
117116

118-
-- name: FeedMessageBulkDeleteByFilter :one
117+
-- name: FeedMessageBulkDeleteByFilter :execrows
119118
DELETE FROM
120119
feed_messages
121120
WHERE
122121
feed_slug = $1
123122
AND (sqlc.narg('priority')::integer IS NULL OR priority = sqlc.narg('priority'))
124-
AND (sqlc.narg('older_than')::timestamp IS NULL OR received_at < sqlc.narg('older_than'))
125-
RETURNING COUNT(*);
123+
AND (sqlc.narg('older_than')::timestamp IS NULL OR received_at < sqlc.narg('older_than'));
126124

127125
-- name: FeedMessageSearch :many
128126
SELECT

backend/internal/data/db/feed_message.sql.go

Lines changed: 12 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

backend/internal/data/dtos/feeds.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
package dtos
22

33
type Feed struct {
4-
Name string `json:"name"`
5-
ID string `json:"id"`
6-
Keys []string
4+
Name string `json:"name"`
5+
Category string `json:"category"`
6+
ID string `json:"id"`
7+
Keys []string `json:"-"`
78
Description string `json:"description"`
89
Middleware []string `json:"middleware"`
910
Adapters []string `json:"adapters"`

backend/internal/data/dtos/pagination.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package dtos
22

33
type Pagination struct {
44
Skip int `json:"skip" validate:"omitempty,gte=0"`
5-
Limit int `json:"limit" validate:"omitempty,gte=1,lte=300"`
5+
Limit int `json:"limit" validate:"omitempty,gte=1,lte=10000"`
66
}
77

88
// WithDefaults returns a copy of Pagination where the defaults have been set

backend/internal/services/feed_service.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ func (f *FeedService) GetAllFeeds() []dtos.Feed {
4646
return utils.Map(parsed, func(f feeds.FeedParsed) dtos.Feed {
4747
return dtos.Feed{
4848
Name: f.Name,
49+
Category: f.Category,
4950
ID: f.ID,
5051
Keys: f.Keys,
5152
Description: f.Description,

backend/internal/web/docs/swagger.json

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -913,18 +913,15 @@
913913
"type": "string"
914914
}
915915
},
916+
"category": {
917+
"type": "string"
918+
},
916919
"description": {
917920
"type": "string"
918921
},
919922
"id": {
920923
"type": "string"
921924
},
922-
"keys": {
923-
"type": "array",
924-
"items": {
925-
"type": "string"
926-
}
927-
},
928925
"middleware": {
929926
"type": "array",
930927
"items": {

dev/dev.feeds.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ middleware:
77
# Feed definitions
88
feeds:
99
- name: "Production Alerts"
10+
category: Alerting
1011
id: "prod-alerts"
1112
keys:
1213
- 1ftyjSfiZott986g1rWykD # github
@@ -25,6 +26,7 @@ feeds:
2526
maxAgeDays: 90
2627

2728
- name: "GitHub Events"
29+
category: External
2830
id: "github-events"
2931
keys:
3032
- 1ftyjSfiZott983g1rWykD # github
@@ -42,6 +44,7 @@ feeds:
4244
maxAgeDays: 30
4345

4446
- name: "Development Testing"
47+
category: Alerting
4548
id: "dev-test"
4649
keys:
4750
- 3ftyjSfiZott983g1rWykD # github
@@ -58,6 +61,7 @@ feeds:
5861
maxAgeDays: 1
5962

6063
- name: "Ntfy Messages"
64+
category: Ntfy
6165
id: "ntfy-test"
6266
keys:
6367
- ntfy-test # Simple key matching the topic name for ntfy compatibility

frontend/app/components/MessageCard.vue

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
*/
55
66
import type { FeedMessage } from "~~/lib/api/types/data-contracts";
7-
import IconCircle from "~icons/mdi/circle";
8-
import IconCircleOutline from "~icons/mdi/circle-outline";
9-
import IconCheck from "~icons/mdi/check";
7+
import IconBell from "~icons/mdi/bell";
8+
import IconEyeCheck from "~icons/mdi/eye-check";
9+
import IconCheckCircle from "~icons/mdi/check-circle";
1010
import IconArchive from "~icons/mdi/archive";
1111
import IconClock from "~icons/mdi/clock";
1212
import IconChevronDown from "~icons/mdi/chevron-down";
@@ -43,9 +43,9 @@ const priorityLabels = {
4343
4444
// State icons
4545
const stateIcons = {
46-
new: IconCircle,
47-
acknowledged: IconCircleOutline,
48-
resolved: IconCheck,
46+
new: IconBell,
47+
acknowledged: IconEyeCheck,
48+
resolved: IconCheckCircle,
4949
archived: IconArchive,
5050
};
5151
@@ -57,6 +57,14 @@ const stateColors = {
5757
archived: "text-base-content/40",
5858
};
5959
60+
// State border colors
61+
const stateBorderColors = {
62+
new: "border-l-primary",
63+
acknowledged: "border-l-info",
64+
resolved: "border-l-success",
65+
archived: "border-l-base-content/40",
66+
};
67+
6068
// Expanded state for card details
6169
const isExpanded = ref(false);
6270
const activeTab = ref<"request" | "headers" | "queryParams" | "logs">(
@@ -131,7 +139,8 @@ const handleDelete = async () => {
131139

132140
<template>
133141
<div
134-
class="card bg-base-200 shadow-sm border border-base-300 hover:shadow-md transition-shadow"
142+
class="card bg-base-200 shadow-sm border border-base-300 hover:shadow-md transition-shadow border-l-8"
143+
:class="stateBorderColors[message.state as keyof typeof stateBorderColors]"
135144
>
136145
<!-- Card Header - Always visible -->
137146
<div class="card-body p-4">
@@ -140,7 +149,7 @@ const handleDelete = async () => {
140149
<div class="flex-shrink-0 pt-1">
141150
<component
142151
:is="
143-
stateIcons[message.state as keyof typeof stateIcons] || IconCircle
152+
stateIcons[message.state as keyof typeof stateIcons] || IconBell
144153
"
145154
class="h-5 w-5"
146155
:class="stateColors[message.state as keyof typeof stateColors]"

frontend/app/composables/useAppState.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export interface Feed {
1010
name: string
1111
slug: string
1212
description: string
13+
category?: string
1314
unreadCount: number
1415
}
1516

@@ -31,6 +32,7 @@ export const useAppState = () => {
3132
name: dto.name || '',
3233
slug: dto.id || '', // Backend uses ID as slug
3334
description: dto.description || '',
35+
category: dto.category,
3436
unreadCount: 0, // Will be calculated separately
3537
}))
3638
} catch (error) {

0 commit comments

Comments
 (0)