+
+
+
+
+
+
+
+
+
+
+
{{ tag.name }}
+ class="alert-detail alert-tags"
+ :class="{ and: alert.and.tags, or: !alert.and.tags }"
+ >
+
+
+ {{ tag.name }}
+
+
+
with {{ actor.name }}
+ class="alert-detail alert-actors"
+ :class="{ and: alert.and.actors, or: !alert.and.actors }"
+ >
+
with
+
+ {{ actor.name }}
+
+
+
for {{ entity.name }}
+ class="alert-detail alert-entities or"
+ >
+
for
+
+
+ {{ entity.name }}
+
+
+
+
matching {{ alert.matches.map((match) => match.expression).join(', ') }}
+ class="alert-detail alert-matches"
+ :class="{ and: alert.and.matches, or: !alert.and.matches }"
+ >
+
matching
+
+ {{ match.property }}:
+ {{ match.expression }}
+
+
+
+
+ #{{ alert.id }}
+
({
+ id: stash.stash_id,
+ name: stash.stash_name,
+ slug: stash.stash_slug,
+ isPrimary: stash.stash_primary,
+ })) || [],
};
}
@@ -49,9 +55,11 @@ export async function fetchAlerts(user) {
tags,
entities,
matches,
+ stashes,
} = await promiseProps({
alerts: knex('alerts')
- .where('user_id', user.id),
+ .where('user_id', user.id)
+ .orderBy('created_at', 'desc'),
actors: knex('alerts_actors')
.select('alerts_actors.*', 'actors.name as actor_name', 'actors.slug as actor_slug')
.leftJoin('alerts', 'alerts.id', 'alerts_actors.alert_id')
@@ -71,6 +79,11 @@ export async function fetchAlerts(user) {
.select('alerts_matches.*')
.leftJoin('alerts', 'alerts.id', 'alerts_matches.alert_id')
.where('alerts.user_id', user.id),
+ stashes: knex('alerts_stashes')
+ .select('alerts_stashes.*', 'stashes.id as stash_id', 'stashes.name as stash_name', 'stashes.slug as stash_slug', 'stashes.primary as stash_primary')
+ .leftJoin('alerts', 'alerts.id', 'alerts_stashes.alert_id')
+ .leftJoin('stashes', 'stashes.id', 'alerts_stashes.stash_id')
+ .where('alerts.user_id', user.id),
});
const curatedAlerts = alerts.map((alert) => curateAlert(alert, {
@@ -78,6 +91,7 @@ export async function fetchAlerts(user) {
tags: tags.filter((tag) => tag.alert_id === alert.id),
entities: entities.filter((entity) => entity.alert_id === alert.id),
matches: matches.filter((match) => match.alert_id === alert.id),
+ stashes: stashes.filter((stash) => stash.alert_id === alert.id),
}));
return curatedAlerts;