implement push notifications
This commit is contained in:
parent
81bfdeb55e
commit
b1aafbd25e
67 changed files with 43958 additions and 5106 deletions
24
.claude/settings.json
Normal file
24
.claude/settings.json
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
{
|
||||
"hooks": {
|
||||
"PreToolUse": [
|
||||
{
|
||||
"matcher": "Bash|Grep",
|
||||
"hooks": [
|
||||
{
|
||||
"type": "command",
|
||||
"command": "/usr/sbin/graphify hook-guard search"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"matcher": "Read|Glob",
|
||||
"hooks": [
|
||||
{
|
||||
"type": "command",
|
||||
"command": "/usr/sbin/graphify hook-guard read"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
24
README.md
24
README.md
|
|
@ -20,8 +20,7 @@ The user interface is German; code and documentation are English.
|
|||
- **Assignees**: while a fault is in progress, users (or yourself via "Mir zuweisen") can be
|
||||
assigned to it in the edit dialog. They stay visible on the resolved fault and are removed when
|
||||
it is set back to open. Only users who logged in at least once can be assigned. Users assigned
|
||||
by someone else get a mail (requires the `SMTP_*` settings), which they can switch off under
|
||||
**Einstellungen → Benachrichtigungen**.
|
||||
by someone else are notified, see **Notifications** below.
|
||||
- **Responsibilities** ("Verantwortlichkeiten", called fault types in the API), seeded with `IUK`,
|
||||
`Gerätewart` and `Atemschutz`. Each can be restricted to OIDC groups, see below.
|
||||
- **Locations** (vehicles, rooms, ...) selectable from a dropdown, managed in the admin UI.
|
||||
|
|
@ -68,9 +67,8 @@ Admins can assign OIDC groups to a responsibility under **Admin → Verantwortli
|
|||
- **No groups:** the history of this responsibility is visible to everyone, no mails are sent.
|
||||
- **With groups:** resolved faults of this responsibility are only visible to members of one of
|
||||
the groups and to admins. Open faults stay visible to everyone.
|
||||
- **Mail notification:** when a new fault is reported for a responsibility with groups, every
|
||||
member gets a mail (except the reporter). Requires the `SMTP_*` settings. Users can switch
|
||||
these mails off under **Einstellungen → Benachrichtigungen**.
|
||||
- **Notification:** when a new fault is reported for a responsibility with groups, every
|
||||
member is notified (except the reporter), see **Notifications** below.
|
||||
|
||||
Group memberships are taken from the OIDC claims and stored on every login. Users who never
|
||||
logged in are unknown to the application and therefore receive no mails; a membership change in
|
||||
|
|
@ -79,6 +77,19 @@ the identity provider takes effect on the user's next login.
|
|||
Public dashboards show the history of unrestricted responsibilities. The history of restricted
|
||||
ones has to be enabled per dashboard under **Admin → Dashboards → Bearbeiten**.
|
||||
|
||||
### Notifications
|
||||
|
||||
Users are notified about **new faults** of their responsibilities and about faults **assigned**
|
||||
to them by someone else. Under **Einstellungen → Benachrichtigungen** every user chooses per
|
||||
notification type which transports to use; all are enabled by default.
|
||||
|
||||
- **E-Mail** requires the `SMTP_*` settings.
|
||||
- **Push** (Web Push) works without external services. The user enables it per device under
|
||||
**Push-Geräte**; clicking a notification opens the fault. On iPhone/iPad the app has to be
|
||||
added to the home screen first. A VAPID key pair is generated on first use and stored in the
|
||||
database, so all replicas share it. Set `VAPID_PUBLIC_KEY`/`VAPID_PRIVATE_KEY` to provide your
|
||||
own; changing the keys invalidates all existing push subscriptions.
|
||||
|
||||
## MP-Feuer hand-over
|
||||
|
||||
If a MP-Feuer database is configured (`MPFEUER_DB_*`), logged-in users can tick
|
||||
|
|
@ -224,6 +235,9 @@ automatically).
|
|||
| `SMTP_SECURITY` | `starttls` | `starttls`, `tls` (implicit TLS) or `none` |
|
||||
| `SMTP_USERNAME`, `SMTP_PASSWORD` | | SMTP login (PLAIN auth) |
|
||||
| `SMTP_FROM` | `SMTP_USERNAME` | sender, e.g. `Schadensmeldung <noreply@example.org>` |
|
||||
| `WEBPUSH_ENABLED` | `true` | set `false` to disable push notifications |
|
||||
| `VAPID_SUBJECT` | `SMTP_FROM` address or `APP_URL` | contact (`mailto:` or `https:` URL) sent to push services |
|
||||
| `VAPID_PUBLIC_KEY`, `VAPID_PRIVATE_KEY` | generated | VAPID key pair for Web Push |
|
||||
| `MPFEUER_DB_HOST` | | MP-Feuer SQL Server, hand-over is disabled if empty |
|
||||
| `MPFEUER_DB_PORT` | `1433` | SQL Server port |
|
||||
| `MPFEUER_DB_NAME` | `mpfeuer` | database name |
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ GIN_MODE=debug
|
|||
PORT=8080
|
||||
# TRUSTED_PROXIES=10.0.0.0/8
|
||||
|
||||
# Mail notifications for new faults (disabled if SMTP_HOST is empty)
|
||||
# Mail notifications (disabled if SMTP_HOST is empty)
|
||||
# SMTP_HOST=smtp.example.org
|
||||
# SMTP_PORT=587
|
||||
# SMTP_SECURITY=starttls
|
||||
|
|
@ -32,6 +32,12 @@ PORT=8080
|
|||
# SMTP_FROM=Schadensmeldung <noreply@example.org>
|
||||
# APP_URL=https://schaden.example.org
|
||||
|
||||
# Push notifications (VAPID keys are generated and stored in the database if not set)
|
||||
# WEBPUSH_ENABLED=true
|
||||
# VAPID_SUBJECT=mailto:admin@example.org
|
||||
# VAPID_PUBLIC_KEY=
|
||||
# VAPID_PRIVATE_KEY=
|
||||
|
||||
# MP-Feuer hand-over (disabled if MPFEUER_DB_HOST is empty)
|
||||
# MPFEUER_DB_HOST=mpfeuer-sql.example.org
|
||||
# MPFEUER_DB_PORT=1433
|
||||
|
|
|
|||
|
|
@ -109,11 +109,11 @@ func TestFaultAssignees(t *testing.T) {
|
|||
// Bernd disables assignment mails.
|
||||
var me struct {
|
||||
User struct {
|
||||
AssignmentMails bool `json:"assignmentMails"`
|
||||
Notifications map[string]map[string]bool `json:"notifications"`
|
||||
} `json:"user"`
|
||||
}
|
||||
bernd.do(http.MethodPut, "/api/v1/me/preferences", map[string]any{"assignmentMails": false}, http.StatusOK, &me)
|
||||
if me.User.AssignmentMails {
|
||||
bernd.do(http.MethodPut, "/api/v1/me/preferences", map[string]any{"notifications": map[string]any{"assigned": map[string]bool{"mail": false}}}, http.StatusOK, &me)
|
||||
if me.User.Notifications["assigned"]["mail"] || !me.User.Notifications["newFault"]["mail"] {
|
||||
t.Fatal("assignment mails should be disabled")
|
||||
}
|
||||
user.do(http.MethodPut, path, with(map[string]any{"status": "in_progress", "assigneeIds": []uint{berndID}}), http.StatusOK, &fault)
|
||||
|
|
|
|||
|
|
@ -4,25 +4,36 @@ import (
|
|||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"jonasled.dev/jonasled/feuerwehr-schadensmeldung/backend/database"
|
||||
"jonasled.dev/jonasled/feuerwehr-schadensmeldung/backend/internal/appsettings"
|
||||
"jonasled.dev/jonasled/feuerwehr-schadensmeldung/backend/internal/auth"
|
||||
"jonasled.dev/jonasled/feuerwehr-schadensmeldung/backend/internal/dto"
|
||||
"jonasled.dev/jonasled/feuerwehr-schadensmeldung/backend/internal/mpfeuer"
|
||||
"jonasled.dev/jonasled/feuerwehr-schadensmeldung/backend/internal/notify"
|
||||
"jonasled.dev/jonasled/feuerwehr-schadensmeldung/backend/internal/webpush"
|
||||
)
|
||||
|
||||
// configHandler godoc
|
||||
// @Summary Get authentication config
|
||||
// @Description Returns whether OIDC is configured, the current user (if logged in) and the branding.
|
||||
// @Description Returns whether OIDC is configured, the available notification transports, the current user (if logged in) and the branding.
|
||||
// @Tags auth
|
||||
// @Produce json
|
||||
// @Success 200 {object} dto.AuthConfigResponse
|
||||
// @Router /api/v1/auth/config [get]
|
||||
func configHandler(ctx *gin.Context) {
|
||||
user, _ := auth.CurrentUser(ctx)
|
||||
transports := []database.NotificationTransport{}
|
||||
for _, transport := range database.NotificationTransports {
|
||||
if notify.TransportEnabled(transport) {
|
||||
transports = append(transports, transport)
|
||||
}
|
||||
}
|
||||
ctx.JSON(http.StatusOK, dto.AuthConfigResponse{
|
||||
OIDCEnabled: auth.OIDCEnabled(),
|
||||
MPFeuerEnabled: mpfeuer.Enabled(),
|
||||
User: dto.NewUser(user),
|
||||
Branding: appsettings.Current(),
|
||||
OIDCEnabled: auth.OIDCEnabled(),
|
||||
MPFeuerEnabled: mpfeuer.Enabled(),
|
||||
NotificationTransports: transports,
|
||||
WebPushPublicKey: webpush.PublicKey(),
|
||||
User: dto.NewUser(user),
|
||||
Branding: appsettings.Current(),
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package meroutes
|
|||
|
||||
import (
|
||||
"net/http"
|
||||
"slices"
|
||||
"strings"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
|
|
@ -21,7 +22,7 @@ func nonZero(id *uint) *uint {
|
|||
|
||||
// updatePreferencesHandler godoc
|
||||
// @Summary Update own preferences
|
||||
// @Description Stores the default filter for the fault overview and whether the user receives mails about new faults and assignments. Omitted fields are left unchanged.
|
||||
// @Description Stores the default filter for the fault overview and via which transports (mail, webpush) the user receives each notification type (newFault, assigned). Omitted fields are left unchanged.
|
||||
// @Tags me
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
|
|
@ -58,13 +59,21 @@ func updatePreferencesHandler(ctx *gin.Context) {
|
|||
user.DefaultStatus = database.FaultStatus(filter.Status)
|
||||
columns = append(columns, "DefaultFaultTypeID", "DefaultLocationID", "DefaultPriority", "DefaultStatus")
|
||||
}
|
||||
if payload.MailNotifications != nil {
|
||||
user.MailNotificationsDisabled = !*payload.MailNotifications
|
||||
columns = append(columns, "MailNotificationsDisabled")
|
||||
}
|
||||
if payload.AssignmentMails != nil {
|
||||
user.AssignmentMailsDisabled = !*payload.AssignmentMails
|
||||
columns = append(columns, "AssignmentMailsDisabled")
|
||||
if len(payload.Notifications) > 0 {
|
||||
for kind, transports := range payload.Notifications {
|
||||
if !slices.Contains(database.NotificationTypes, kind) {
|
||||
apiutil.Error(ctx, http.StatusBadRequest, "unknown notification type: "+string(kind))
|
||||
return
|
||||
}
|
||||
for transport, enabled := range transports {
|
||||
if !slices.Contains(database.NotificationTransports, transport) {
|
||||
apiutil.Error(ctx, http.StatusBadRequest, "unknown notification transport: "+string(transport))
|
||||
return
|
||||
}
|
||||
user.SetNotificationEnabled(kind, transport, enabled)
|
||||
}
|
||||
}
|
||||
columns = append(columns, "DisabledNotifications")
|
||||
}
|
||||
|
||||
if payload.MPFeuerHandzeichen != nil {
|
||||
|
|
|
|||
151
backend/api/meroutes/push.go
Normal file
151
backend/api/meroutes/push.go
Normal file
|
|
@ -0,0 +1,151 @@
|
|||
package meroutes
|
||||
|
||||
import (
|
||||
"net"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"jonasled.dev/jonasled/feuerwehr-schadensmeldung/backend/api/apiutil"
|
||||
"jonasled.dev/jonasled/feuerwehr-schadensmeldung/backend/database"
|
||||
"jonasled.dev/jonasled/feuerwehr-schadensmeldung/backend/internal/auth"
|
||||
"jonasled.dev/jonasled/feuerwehr-schadensmeldung/backend/internal/dto"
|
||||
"jonasled.dev/jonasled/feuerwehr-schadensmeldung/backend/internal/webpush"
|
||||
)
|
||||
|
||||
// validPushEndpoint only accepts public HTTPS URLs, since the server sends requests to them.
|
||||
func validPushEndpoint(endpoint string) bool {
|
||||
parsed, err := url.Parse(endpoint)
|
||||
if err != nil || parsed.Scheme != "https" || parsed.User != nil {
|
||||
return false
|
||||
}
|
||||
host := strings.ToLower(parsed.Hostname())
|
||||
if host == "" || host == "localhost" || strings.HasSuffix(host, ".localhost") || !strings.Contains(host, ".") {
|
||||
return false
|
||||
}
|
||||
return net.ParseIP(host) == nil
|
||||
}
|
||||
|
||||
// listPushSubscriptionsHandler godoc
|
||||
// @Summary List own push subscriptions
|
||||
// @Description Returns the devices on which the user enabled push notifications.
|
||||
// @Tags me
|
||||
// @Produce json
|
||||
// @Security SessionCookieAuth
|
||||
// @Success 200 {object} dto.PushSubscriptionListResponse
|
||||
// @Failure 401 {object} dto.ErrorResponse
|
||||
// @Router /api/v1/me/push-subscriptions [get]
|
||||
func listPushSubscriptionsHandler(ctx *gin.Context) {
|
||||
subscriptions := []database.PushSubscription{}
|
||||
if err := database.Db.Where("user_id = ?", auth.MustCurrentUser(ctx).ID).Order("created_at DESC").Find(&subscriptions).Error; err != nil {
|
||||
apiutil.Error(ctx, http.StatusInternalServerError, err.Error())
|
||||
return
|
||||
}
|
||||
response := dto.PushSubscriptionListResponse{Subscriptions: make([]dto.PushSubscriptionResponse, 0, len(subscriptions))}
|
||||
for i := range subscriptions {
|
||||
response.Subscriptions = append(response.Subscriptions, dto.NewPushSubscription(&subscriptions[i]))
|
||||
}
|
||||
ctx.JSON(http.StatusOK, response)
|
||||
}
|
||||
|
||||
// createPushSubscriptionHandler godoc
|
||||
// @Summary Register push subscription
|
||||
// @Description Stores the browser's push subscription for the current user. A subscription that is already known (e.g. from another user on a shared device) is moved to the current user.
|
||||
// @Tags me
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security SessionCookieAuth
|
||||
// @Param payload body dto.PushSubscriptionPayload true "Subscription"
|
||||
// @Success 201 {object} dto.PushSubscriptionEnvelope
|
||||
// @Failure 400 {object} dto.ErrorResponse
|
||||
// @Failure 401 {object} dto.ErrorResponse
|
||||
// @Failure 409 {object} dto.ErrorResponse
|
||||
// @Router /api/v1/me/push-subscriptions [post]
|
||||
func createPushSubscriptionHandler(ctx *gin.Context) {
|
||||
if !webpush.Enabled() {
|
||||
apiutil.Error(ctx, http.StatusConflict, "web push is disabled")
|
||||
return
|
||||
}
|
||||
var payload dto.PushSubscriptionPayload
|
||||
if !apiutil.BindJSON(ctx, &payload) {
|
||||
return
|
||||
}
|
||||
if !validPushEndpoint(payload.Endpoint) {
|
||||
apiutil.Error(ctx, http.StatusBadRequest, "invalid push endpoint")
|
||||
return
|
||||
}
|
||||
userAgent := ctx.Request.UserAgent()
|
||||
if len(userAgent) > 255 {
|
||||
userAgent = userAgent[:255]
|
||||
}
|
||||
subscription := database.PushSubscription{}
|
||||
database.Db.Where("endpoint_hash = ?", webpush.HashEndpoint(payload.Endpoint)).Limit(1).Find(&subscription)
|
||||
subscription.UserID = auth.MustCurrentUser(ctx).ID
|
||||
subscription.EndpointHash = webpush.HashEndpoint(payload.Endpoint)
|
||||
subscription.Endpoint = payload.Endpoint
|
||||
subscription.P256dh = payload.Keys.P256dh
|
||||
subscription.Auth = payload.Keys.Auth
|
||||
subscription.UserAgent = userAgent
|
||||
if err := database.Db.Save(&subscription).Error; err != nil {
|
||||
apiutil.Error(ctx, http.StatusInternalServerError, err.Error())
|
||||
return
|
||||
}
|
||||
ctx.JSON(http.StatusCreated, dto.PushSubscriptionEnvelope{Subscription: dto.NewPushSubscription(&subscription)})
|
||||
}
|
||||
|
||||
// deletePushSubscriptionHandler godoc
|
||||
// @Summary Delete push subscription
|
||||
// @Tags me
|
||||
// @Produce json
|
||||
// @Security SessionCookieAuth
|
||||
// @Param id path int true "Subscription ID"
|
||||
// @Success 200 {object} dto.StatusResponse
|
||||
// @Failure 401 {object} dto.ErrorResponse
|
||||
// @Failure 404 {object} dto.ErrorResponse
|
||||
// @Router /api/v1/me/push-subscriptions/{id} [delete]
|
||||
func deletePushSubscriptionHandler(ctx *gin.Context) {
|
||||
id, ok := apiutil.ParseID(ctx)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
result := database.Db.Where("user_id = ?", auth.MustCurrentUser(ctx).ID).Delete(&database.PushSubscription{}, id)
|
||||
if result.Error != nil {
|
||||
apiutil.Error(ctx, http.StatusInternalServerError, result.Error.Error())
|
||||
return
|
||||
}
|
||||
if result.RowsAffected == 0 {
|
||||
apiutil.Error(ctx, http.StatusNotFound, "push subscription not found")
|
||||
return
|
||||
}
|
||||
ctx.JSON(http.StatusOK, dto.StatusResponse{Status: "deleted"})
|
||||
}
|
||||
|
||||
// testPushHandler godoc
|
||||
// @Summary Send test push notification
|
||||
// @Description Sends a test notification to all devices of the current user.
|
||||
// @Tags me
|
||||
// @Produce json
|
||||
// @Security SessionCookieAuth
|
||||
// @Success 200 {object} dto.PushTestResponse
|
||||
// @Failure 401 {object} dto.ErrorResponse
|
||||
// @Failure 409 {object} dto.ErrorResponse
|
||||
// @Failure 502 {object} dto.ErrorResponse
|
||||
// @Router /api/v1/me/push-subscriptions/test [post]
|
||||
func testPushHandler(ctx *gin.Context) {
|
||||
if !webpush.Enabled() {
|
||||
apiutil.Error(ctx, http.StatusConflict, "web push is disabled")
|
||||
return
|
||||
}
|
||||
delivered, err := webpush.SendToUser(auth.MustCurrentUser(ctx).ID, webpush.Message{
|
||||
Title: "Test-Benachrichtigung",
|
||||
Body: "Push-Benachrichtigungen funktionieren auf diesem Gerät.",
|
||||
URL: "/einstellungen",
|
||||
Tag: "test",
|
||||
})
|
||||
if err != nil && delivered == 0 {
|
||||
apiutil.Error(ctx, http.StatusBadGateway, err.Error())
|
||||
return
|
||||
}
|
||||
ctx.JSON(http.StatusOK, dto.PushTestResponse{Delivered: delivered})
|
||||
}
|
||||
|
|
@ -11,4 +11,8 @@ func Register(api *gin.RouterGroup) {
|
|||
group.GET("/api-tokens", listTokensHandler)
|
||||
group.POST("/api-tokens", createTokenHandler)
|
||||
group.DELETE("/api-tokens/:id", deleteTokenHandler)
|
||||
group.GET("/push-subscriptions", listPushSubscriptionsHandler)
|
||||
group.POST("/push-subscriptions", createPushSubscriptionHandler)
|
||||
group.POST("/push-subscriptions/test", testPushHandler)
|
||||
group.DELETE("/push-subscriptions/:id", deletePushSubscriptionHandler)
|
||||
}
|
||||
|
|
|
|||
146
backend/api/push_test.go
Normal file
146
backend/api/push_test.go
Normal file
|
|
@ -0,0 +1,146 @@
|
|||
package api
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"testing"
|
||||
|
||||
"jonasled.dev/jonasled/feuerwehr-schadensmeldung/backend/database"
|
||||
"jonasled.dev/jonasled/feuerwehr-schadensmeldung/backend/internal/auth"
|
||||
"jonasled.dev/jonasled/feuerwehr-schadensmeldung/backend/internal/notify"
|
||||
"jonasled.dev/jonasled/feuerwehr-schadensmeldung/backend/internal/webpush"
|
||||
)
|
||||
|
||||
func TestWebPushNotifications(t *testing.T) {
|
||||
// Without SMTP only Web Push is available.
|
||||
setupServer(t)
|
||||
type delivery struct {
|
||||
userID uint
|
||||
message webpush.Message
|
||||
}
|
||||
pushed := []delivery{}
|
||||
gone := map[string]bool{}
|
||||
previousSend := webpush.SendFunc
|
||||
webpush.SendFunc = func(subscription database.PushSubscription, message webpush.Message) error {
|
||||
if gone[subscription.Endpoint] {
|
||||
return webpush.ErrGone
|
||||
}
|
||||
pushed = append(pushed, delivery{subscription.UserID, message})
|
||||
return nil
|
||||
}
|
||||
notify.Async = false
|
||||
t.Cleanup(func() { webpush.SendFunc = previousSend; notify.Async = true })
|
||||
|
||||
anna := client{t: t, headers: map[string]string{"Cookie": auth.SessionCookieName + "=" + createSession(t, database.UserRoleUser, "Anna")}}
|
||||
bernd := client{t: t, headers: map[string]string{"Cookie": auth.SessionCookieName + "=" + createSession(t, database.UserRoleUser, "Bernd")}}
|
||||
|
||||
var config struct {
|
||||
NotificationTransports []string `json:"notificationTransports"`
|
||||
WebPushPublicKey string `json:"webPushPublicKey"`
|
||||
}
|
||||
anna.do(http.MethodGet, "/api/v1/auth/config", nil, http.StatusOK, &config)
|
||||
if len(config.NotificationTransports) != 1 || config.NotificationTransports[0] != "webpush" || config.WebPushPublicKey == "" {
|
||||
t.Fatalf("unexpected notification config %+v", config)
|
||||
}
|
||||
// The generated key pair is stored and reused.
|
||||
var settings database.AppSettings
|
||||
database.Db.First(&settings)
|
||||
if settings.VAPIDPublicKey != config.WebPushPublicKey || settings.VAPIDPrivateKey == "" {
|
||||
t.Fatalf("VAPID keys not stored: %+v", settings)
|
||||
}
|
||||
|
||||
subscription := func(endpoint string) map[string]any {
|
||||
return map[string]any{"endpoint": endpoint, "keys": map[string]string{"p256dh": "BPublicKey", "auth": "secret"}}
|
||||
}
|
||||
for _, endpoint := range []string{"http://push.example.org/x", "https://127.0.0.1/x", "https://localhost/x", "https://intranet/x"} {
|
||||
bernd.do(http.MethodPost, "/api/v1/me/push-subscriptions", subscription(endpoint), http.StatusBadRequest, nil)
|
||||
}
|
||||
const phone, laptop = "https://push.example.org/bernd-phone", "https://push.example.org/bernd-laptop"
|
||||
bernd.do(http.MethodPost, "/api/v1/me/push-subscriptions", subscription(phone), http.StatusCreated, nil)
|
||||
bernd.do(http.MethodPost, "/api/v1/me/push-subscriptions", subscription(phone), http.StatusCreated, nil)
|
||||
bernd.do(http.MethodPost, "/api/v1/me/push-subscriptions", subscription(laptop), http.StatusCreated, nil)
|
||||
var list struct {
|
||||
Subscriptions []struct {
|
||||
ID uint
|
||||
Endpoint string
|
||||
} `json:"subscriptions"`
|
||||
}
|
||||
bernd.do(http.MethodGet, "/api/v1/me/push-subscriptions", nil, http.StatusOK, &list)
|
||||
if len(list.Subscriptions) != 2 {
|
||||
t.Fatalf("expected two devices, got %+v", list.Subscriptions)
|
||||
}
|
||||
|
||||
var users struct {
|
||||
Users []struct{ ID uint } `json:"users"`
|
||||
}
|
||||
anna.do(http.MethodGet, "/api/v1/users", nil, http.StatusOK, &users)
|
||||
berndID := users.Users[1].ID
|
||||
var catalog struct {
|
||||
Locations []struct{ ID uint } `json:"locations"`
|
||||
FaultTypes []struct{ ID uint } `json:"faultTypes"`
|
||||
}
|
||||
anna.do(http.MethodGet, "/api/v1/catalog", nil, http.StatusOK, &catalog)
|
||||
var fault struct {
|
||||
Fault struct{ ID uint } `json:"fault"`
|
||||
}
|
||||
fields := map[string]any{"title": "Funk defekt", "locationId": catalog.Locations[0].ID, "faultTypeId": catalog.FaultTypes[0].ID}
|
||||
anna.do(http.MethodPost, "/api/v1/faults", fields, http.StatusCreated, &fault)
|
||||
path := "/api/v1/faults/" + itoa(fault.Fault.ID)
|
||||
assign := func(ids ...uint) {
|
||||
payload := map[string]any{"status": "in_progress", "assigneeIds": ids}
|
||||
for key, value := range fields {
|
||||
payload[key] = value
|
||||
}
|
||||
anna.do(http.MethodPut, path, payload, http.StatusOK, nil)
|
||||
}
|
||||
|
||||
// Assigning Bernd pushes to both of his devices.
|
||||
assign(berndID)
|
||||
if len(pushed) != 2 || pushed[0].userID != berndID || pushed[0].message.URL != "/meldungen/"+itoa(fault.Fault.ID) || pushed[0].message.Title != "Dir zugewiesen: #"+itoa(fault.Fault.ID)+" Funk defekt" {
|
||||
t.Fatalf("expected two pushes to Bernd, got %+v", pushed)
|
||||
}
|
||||
|
||||
// Switching off push for assignments stops them; unknown types and transports are rejected.
|
||||
bernd.do(http.MethodPut, "/api/v1/me/preferences", map[string]any{"notifications": map[string]any{"assigned": map[string]bool{"sms": true}}}, http.StatusBadRequest, nil)
|
||||
bernd.do(http.MethodPut, "/api/v1/me/preferences", map[string]any{"notifications": map[string]any{"resolved": map[string]bool{"mail": true}}}, http.StatusBadRequest, nil)
|
||||
var me struct {
|
||||
User struct {
|
||||
Notifications map[string]map[string]bool `json:"notifications"`
|
||||
} `json:"user"`
|
||||
}
|
||||
bernd.do(http.MethodPut, "/api/v1/me/preferences", map[string]any{"notifications": map[string]any{"assigned": map[string]bool{"webpush": false}}}, http.StatusOK, &me)
|
||||
if me.User.Notifications["assigned"]["webpush"] || !me.User.Notifications["assigned"]["mail"] || !me.User.Notifications["newFault"]["webpush"] {
|
||||
t.Fatalf("unexpected preferences %+v", me.User.Notifications)
|
||||
}
|
||||
pushed = nil
|
||||
assign()
|
||||
assign(berndID)
|
||||
if len(pushed) != 0 {
|
||||
t.Fatalf("opted out user must not get pushes, got %+v", pushed)
|
||||
}
|
||||
bernd.do(http.MethodPut, "/api/v1/me/preferences", map[string]any{"notifications": map[string]any{"assigned": map[string]bool{"webpush": true}}}, http.StatusOK, &me)
|
||||
if !me.User.Notifications["assigned"]["webpush"] {
|
||||
t.Fatal("push for assignments should be enabled again")
|
||||
}
|
||||
|
||||
// Expired subscriptions are removed when sending.
|
||||
gone[laptop] = true
|
||||
var test struct{ Delivered int }
|
||||
bernd.do(http.MethodPost, "/api/v1/me/push-subscriptions/test", nil, http.StatusOK, &test)
|
||||
if test.Delivered != 1 {
|
||||
t.Fatalf("expected delivery to one device, got %d", test.Delivered)
|
||||
}
|
||||
bernd.do(http.MethodGet, "/api/v1/me/push-subscriptions", nil, http.StatusOK, &list)
|
||||
if len(list.Subscriptions) != 1 || list.Subscriptions[0].Endpoint != phone {
|
||||
t.Fatalf("expired device should be removed, got %+v", list.Subscriptions)
|
||||
}
|
||||
|
||||
// A device used by someone else is moved to the new user; others cannot delete it.
|
||||
anna.do(http.MethodPost, "/api/v1/me/push-subscriptions", subscription(phone), http.StatusCreated, nil)
|
||||
bernd.do(http.MethodGet, "/api/v1/me/push-subscriptions", nil, http.StatusOK, &list)
|
||||
if len(list.Subscriptions) != 0 {
|
||||
t.Fatalf("device should have moved to Anna, got %+v", list.Subscriptions)
|
||||
}
|
||||
anna.do(http.MethodGet, "/api/v1/me/push-subscriptions", nil, http.StatusOK, &list)
|
||||
bernd.do(http.MethodDelete, "/api/v1/me/push-subscriptions/"+itoa(list.Subscriptions[0].ID), nil, http.StatusNotFound, nil)
|
||||
anna.do(http.MethodDelete, "/api/v1/me/push-subscriptions/"+itoa(list.Subscriptions[0].ID), nil, http.StatusOK, nil)
|
||||
}
|
||||
|
|
@ -157,14 +157,14 @@ func TestResponsibilityGroups(t *testing.T) {
|
|||
member.do(http.MethodPut, "/api/v1/me/preferences", map[string]any{"defaultFilter": map[string]any{"faultTypeId": iuk}}, http.StatusOK, nil)
|
||||
var me struct {
|
||||
User struct {
|
||||
MailNotifications bool `json:"mailNotifications"`
|
||||
DefaultFilter struct {
|
||||
Notifications map[string]map[string]bool `json:"notifications"`
|
||||
DefaultFilter struct {
|
||||
FaultTypeID *uint `json:"faultTypeId"`
|
||||
} `json:"defaultFilter"`
|
||||
} `json:"user"`
|
||||
}
|
||||
member.do(http.MethodPut, "/api/v1/me/preferences", map[string]any{"mailNotifications": false}, http.StatusOK, &me)
|
||||
if me.User.MailNotifications || me.User.DefaultFilter.FaultTypeID == nil {
|
||||
member.do(http.MethodPut, "/api/v1/me/preferences", map[string]any{"notifications": map[string]any{"newFault": map[string]bool{"mail": false}}}, http.StatusOK, &me)
|
||||
if me.User.Notifications["newFault"]["mail"] || !me.User.Notifications["newFault"]["webpush"] || !me.User.Notifications["assigned"]["mail"] || me.User.DefaultFilter.FaultTypeID == nil {
|
||||
t.Fatalf("unexpected preferences after opt-out: %+v", me.User)
|
||||
}
|
||||
sent = nil
|
||||
|
|
|
|||
|
|
@ -99,6 +99,7 @@ func autoMigrate() error {
|
|||
&Session{},
|
||||
&LoginState{},
|
||||
&APIToken{},
|
||||
&PushSubscription{},
|
||||
&Dashboard{},
|
||||
&AppSettings{},
|
||||
&Location{},
|
||||
|
|
|
|||
|
|
@ -48,6 +48,9 @@ func migrateLegacySchema() bool {
|
|||
log.Log.WithError(err).Warn("Failed dropping legacy faults.category_id column")
|
||||
}
|
||||
}
|
||||
if migrateNotificationColumns() {
|
||||
changed = true
|
||||
}
|
||||
if migrator.HasTable("categories") {
|
||||
changed = true
|
||||
if err := migrator.DropTable("categories"); err != nil {
|
||||
|
|
@ -56,3 +59,37 @@ func migrateLegacySchema() bool {
|
|||
}
|
||||
return changed
|
||||
}
|
||||
|
||||
// migrateNotificationColumns converts the boolean mail opt-outs used before notifications could be
|
||||
// delivered via several transports into DisabledNotifications and drops the old columns.
|
||||
func migrateNotificationColumns() bool {
|
||||
migrator := Db.Migrator()
|
||||
legacy := map[string]NotificationType{
|
||||
"mail_notifications_disabled": NotificationNewFault,
|
||||
"assignment_mails_disabled": NotificationAssigned,
|
||||
}
|
||||
changed := false
|
||||
for column, kind := range legacy {
|
||||
if !migrator.HasColumn(&User{}, column) {
|
||||
continue
|
||||
}
|
||||
changed = true
|
||||
var ids []uint
|
||||
Db.Table("users").Where(column+" = ?", true).Pluck("id", &ids)
|
||||
for _, id := range ids {
|
||||
user := User{}
|
||||
if err := Db.First(&user, id).Error; err != nil {
|
||||
continue
|
||||
}
|
||||
user.SetNotificationEnabled(kind, TransportMail, false)
|
||||
if err := Db.Model(&user).Select("DisabledNotifications").Updates(&user).Error; err != nil {
|
||||
log.Log.WithError(err).WithField("user", id).Warn("Failed migrating notification preference")
|
||||
}
|
||||
}
|
||||
if err := migrator.DropColumn(&User{}, column); err != nil {
|
||||
log.Log.WithError(err).Warnf("Failed dropping legacy users.%s column", column)
|
||||
}
|
||||
log.Log.WithField("users", len(ids)).WithField("column", column).Info("Migrated mail notification opt-outs")
|
||||
}
|
||||
return changed
|
||||
}
|
||||
|
|
|
|||
42
backend/database/migrate_test.go
Normal file
42
backend/database/migrate_test.go
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
package database
|
||||
|
||||
import (
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"jonasled.dev/jonasled/go-libs/log"
|
||||
)
|
||||
|
||||
func TestMigrateNotificationColumns(t *testing.T) {
|
||||
t.Setenv("DB_DRIVER", "sqlite")
|
||||
t.Setenv("DB_NAME", filepath.Join(t.TempDir(), "test.db"))
|
||||
log.Init()
|
||||
Init()
|
||||
|
||||
users := []User{{Subject: "a", Email: "a@example.org", Name: "A"}, {Subject: "b", Email: "b@example.org", Name: "B"}}
|
||||
if err := Db.Create(&users).Error; err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
Db.Exec("ALTER TABLE `users` ADD COLUMN `mail_notifications_disabled` numeric NOT NULL DEFAULT false")
|
||||
Db.Exec("ALTER TABLE `users` ADD COLUMN `assignment_mails_disabled` numeric NOT NULL DEFAULT false")
|
||||
Db.Exec("UPDATE users SET mail_notifications_disabled = true, assignment_mails_disabled = true WHERE id = ?", users[0].ID)
|
||||
|
||||
if !migrateNotificationColumns() {
|
||||
t.Fatal("expected the legacy columns to be migrated")
|
||||
}
|
||||
if Db.Migrator().HasColumn(&User{}, "mail_notifications_disabled") || Db.Migrator().HasColumn(&User{}, "assignment_mails_disabled") {
|
||||
t.Fatal("legacy columns should be dropped")
|
||||
}
|
||||
var a, b User
|
||||
Db.First(&a, users[0].ID)
|
||||
Db.First(&b, users[1].ID)
|
||||
if a.NotificationEnabled(NotificationNewFault, TransportMail) || a.NotificationEnabled(NotificationAssigned, TransportMail) {
|
||||
t.Fatalf("opt-outs not migrated: %+v", a.DisabledNotifications)
|
||||
}
|
||||
if !a.NotificationEnabled(NotificationNewFault, TransportWebPush) || !b.NotificationEnabled(NotificationNewFault, TransportMail) {
|
||||
t.Fatal("other preferences must stay enabled")
|
||||
}
|
||||
if migrateNotificationColumns() {
|
||||
t.Fatal("second run must be a no-op")
|
||||
}
|
||||
}
|
||||
|
|
@ -61,16 +61,87 @@ type User struct {
|
|||
DefaultPriority FaultPriority `gorm:"size:16" json:"defaultPriority"`
|
||||
DefaultStatus FaultStatus `gorm:"size:16" json:"defaultStatus"`
|
||||
|
||||
// MailNotificationsDisabled opts the user out of new fault mails. It is stored negated so
|
||||
// existing and newly created users are notified by default.
|
||||
MailNotificationsDisabled bool `gorm:"not null;default:false" json:"mailNotificationsDisabled"`
|
||||
// AssignmentMailsDisabled opts the user out of mails when someone else assigns a fault to them.
|
||||
AssignmentMailsDisabled bool `gorm:"not null;default:false" json:"assignmentMailsDisabled"`
|
||||
// DisabledNotifications maps a notification type to the transports the user switched off. It
|
||||
// is stored as opt-out so existing and newly created users get every notification by default.
|
||||
DisabledNotifications map[NotificationType][]NotificationTransport `gorm:"serializer:json;type:text" json:"disabledNotifications"`
|
||||
// MPFeuerHandzeichen is written as UPDATED_HDZ when the user hands a fault over to MP-Feuer.
|
||||
MPFeuerHandzeichen string `gorm:"size:16" json:"mpFeuerHandzeichen"`
|
||||
|
||||
Sessions []Session `json:"-" gorm:"constraint:OnDelete:CASCADE"`
|
||||
APITokens []APIToken `json:"-" gorm:"constraint:OnDelete:CASCADE"`
|
||||
Sessions []Session `json:"-" gorm:"constraint:OnDelete:CASCADE"`
|
||||
APITokens []APIToken `json:"-" gorm:"constraint:OnDelete:CASCADE"`
|
||||
PushSubscriptions []PushSubscription `json:"-" gorm:"constraint:OnDelete:CASCADE"`
|
||||
}
|
||||
|
||||
// NotificationType is an event users can be notified about.
|
||||
type NotificationType string
|
||||
|
||||
const (
|
||||
// NotificationNewFault is sent to the members of a responsibility's groups for new faults.
|
||||
NotificationNewFault NotificationType = "newFault"
|
||||
// NotificationAssigned is sent to users someone else assigned a fault to.
|
||||
NotificationAssigned NotificationType = "assigned"
|
||||
)
|
||||
|
||||
// NotificationTypes lists all notification types in display order.
|
||||
var NotificationTypes = []NotificationType{NotificationNewFault, NotificationAssigned}
|
||||
|
||||
// NotificationTransport is a channel a notification is delivered through.
|
||||
type NotificationTransport string
|
||||
|
||||
const (
|
||||
TransportMail NotificationTransport = "mail"
|
||||
TransportWebPush NotificationTransport = "webpush"
|
||||
)
|
||||
|
||||
// NotificationTransports lists all transports in display order.
|
||||
var NotificationTransports = []NotificationTransport{TransportMail, TransportWebPush}
|
||||
|
||||
// NotificationEnabled reports whether the user wants notifications of the type via the transport.
|
||||
func (user *User) NotificationEnabled(kind NotificationType, transport NotificationTransport) bool {
|
||||
for _, disabled := range user.DisabledNotifications[kind] {
|
||||
if disabled == transport {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// SetNotificationEnabled switches a single transport of a notification type on or off.
|
||||
func (user *User) SetNotificationEnabled(kind NotificationType, transport NotificationTransport, enabled bool) {
|
||||
disabled := []NotificationTransport{}
|
||||
for _, existing := range user.DisabledNotifications[kind] {
|
||||
if existing != transport {
|
||||
disabled = append(disabled, existing)
|
||||
}
|
||||
}
|
||||
if !enabled {
|
||||
disabled = append(disabled, transport)
|
||||
}
|
||||
if user.DisabledNotifications == nil {
|
||||
user.DisabledNotifications = map[NotificationType][]NotificationTransport{}
|
||||
}
|
||||
if len(disabled) == 0 {
|
||||
delete(user.DisabledNotifications, kind)
|
||||
return
|
||||
}
|
||||
user.DisabledNotifications[kind] = disabled
|
||||
}
|
||||
|
||||
// PushSubscription is a browser's Web Push subscription of a user, one per device and browser.
|
||||
type PushSubscription struct {
|
||||
ID uint `gorm:"primaryKey" json:"id"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
UpdatedAt time.Time `json:"updatedAt"`
|
||||
|
||||
UserID uint `gorm:"index;not null" json:"userId"`
|
||||
User User `json:"-"`
|
||||
// Endpoint URLs can be longer than an index allows, so uniqueness is enforced on their hash.
|
||||
EndpointHash string `gorm:"uniqueIndex;size:64;not null" json:"-"`
|
||||
Endpoint string `gorm:"type:text;not null" json:"endpoint"`
|
||||
P256dh string `gorm:"size:255;not null" json:"-"`
|
||||
Auth string `gorm:"size:255;not null" json:"-"`
|
||||
UserAgent string `gorm:"size:255" json:"userAgent"`
|
||||
LastUsedAt *time.Time `json:"lastUsedAt"`
|
||||
}
|
||||
|
||||
// Session is a server side login session. Only the SHA-256 hash of the cookie value is stored.
|
||||
|
|
@ -138,7 +209,7 @@ type Dashboard struct {
|
|||
HistoryFaultTypes []FaultType `gorm:"many2many:dashboard_history_fault_types" json:"-"`
|
||||
}
|
||||
|
||||
// AppSettings holds application wide branding settings. Only a single row exists.
|
||||
// AppSettings holds application wide settings. Only a single row exists.
|
||||
type AppSettings struct {
|
||||
ID uint `gorm:"primaryKey" json:"id"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
|
|
@ -147,6 +218,10 @@ type AppSettings struct {
|
|||
|
||||
ApplicationTitle string `gorm:"size:191;not null" json:"applicationTitle"`
|
||||
OrganizationName string `gorm:"size:191;not null" json:"organizationName"`
|
||||
|
||||
// VAPID key pair for Web Push, generated on first use unless configured via environment.
|
||||
VAPIDPublicKey string `gorm:"column:vapid_public_key;size:128" json:"-"`
|
||||
VAPIDPrivateKey string `gorm:"column:vapid_private_key;size:128" json:"-"`
|
||||
}
|
||||
|
||||
// Location is a selectable place where the faulty device is located (e.g. a vehicle or room).
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
// Code generated by swaggo/swag. DO NOT EDIT.
|
||||
|
||||
// Package docs Code generated by swaggo/swag. DO NOT EDIT
|
||||
package docs
|
||||
|
||||
import "github.com/swaggo/swag"
|
||||
|
|
@ -1023,7 +1022,7 @@ const docTemplate = `{
|
|||
},
|
||||
"/api/v1/auth/config": {
|
||||
"get": {
|
||||
"description": "Returns whether OIDC is configured, the current user (if logged in) and the branding.",
|
||||
"description": "Returns whether OIDC is configured, the available notification transports, the current user (if logged in) and the branding.",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
|
|
@ -2400,7 +2399,7 @@ const docTemplate = `{
|
|||
"BearerTokenAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Stores the default filter for the fault overview and whether the user receives mails about new faults and assignments. Omitted fields are left unchanged.",
|
||||
"description": "Stores the default filter for the fault overview and via which transports (mail, webpush) the user receives each notification type (newFault, assigned). Omitted fields are left unchanged.",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
|
|
@ -2444,6 +2443,180 @@ const docTemplate = `{
|
|||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/me/push-subscriptions": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"SessionCookieAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Returns the devices on which the user enabled push notifications.",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"me"
|
||||
],
|
||||
"summary": "List own push subscriptions",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.PushSubscriptionListResponse"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.ErrorResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"SessionCookieAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Stores the browser's push subscription for the current user. A subscription that is already known (e.g. from another user on a shared device) is moved to the current user.",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"me"
|
||||
],
|
||||
"summary": "Register push subscription",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "Subscription",
|
||||
"name": "payload",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.PushSubscriptionPayload"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"201": {
|
||||
"description": "Created",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.PushSubscriptionEnvelope"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.ErrorResponse"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.ErrorResponse"
|
||||
}
|
||||
},
|
||||
"409": {
|
||||
"description": "Conflict",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.ErrorResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/me/push-subscriptions/test": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"SessionCookieAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Sends a test notification to all devices of the current user.",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"me"
|
||||
],
|
||||
"summary": "Send test push notification",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.PushTestResponse"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.ErrorResponse"
|
||||
}
|
||||
},
|
||||
"409": {
|
||||
"description": "Conflict",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.ErrorResponse"
|
||||
}
|
||||
},
|
||||
"502": {
|
||||
"description": "Bad Gateway",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.ErrorResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/me/push-subscriptions/{id}": {
|
||||
"delete": {
|
||||
"security": [
|
||||
{
|
||||
"SessionCookieAuth": []
|
||||
}
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"me"
|
||||
],
|
||||
"summary": "Delete push subscription",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "Subscription ID",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.StatusResponse"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.ErrorResponse"
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "Not Found",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.ErrorResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/mp-feuer/devices": {
|
||||
"get": {
|
||||
"security": [
|
||||
|
|
@ -2542,6 +2715,17 @@ const docTemplate = `{
|
|||
}
|
||||
}
|
||||
},
|
||||
"database.NotificationTransport": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"mail",
|
||||
"webpush"
|
||||
],
|
||||
"x-enum-varnames": [
|
||||
"TransportMail",
|
||||
"TransportWebPush"
|
||||
]
|
||||
},
|
||||
"dto.APITokenCreateResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
|
@ -2611,11 +2795,27 @@ const docTemplate = `{
|
|||
"description": "MPFeuerEnabled reports whether faults can be handed over to MP-Feuer.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"notificationTransports": {
|
||||
"description": "NotificationTransports lists the transports configured on the server (mail needs SMTP).",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/database.NotificationTransport"
|
||||
},
|
||||
"example": [
|
||||
"mail",
|
||||
"webpush"
|
||||
]
|
||||
},
|
||||
"oidcEnabled": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"user": {
|
||||
"$ref": "#/definitions/dto.UserResponse"
|
||||
},
|
||||
"webPushPublicKey": {
|
||||
"description": "WebPushPublicKey is the VAPID key browsers subscribe with, empty if Web Push is disabled.",
|
||||
"type": "string",
|
||||
"example": "BOr3..."
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
@ -3448,24 +3648,120 @@ const docTemplate = `{
|
|||
}
|
||||
}
|
||||
},
|
||||
"dto.NotificationPreferences": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
},
|
||||
"dto.PreferencesPayload": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"assignmentMails": {
|
||||
"type": "boolean",
|
||||
"example": true
|
||||
},
|
||||
"defaultFilter": {
|
||||
"$ref": "#/definitions/dto.DefaultFilter"
|
||||
},
|
||||
"mailNotifications": {
|
||||
"type": "boolean",
|
||||
"example": false
|
||||
},
|
||||
"mpFeuerHandzeichen": {
|
||||
"type": "string",
|
||||
"maxLength": 16,
|
||||
"example": "JL"
|
||||
},
|
||||
"notifications": {
|
||||
"description": "Notifications switches single transports of notification types on or off, e.g.\n{\"assigned\": {\"mail\": false}}. Omitted types and transports are left unchanged.",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/dto.NotificationPreferences"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"dto.PushSubscriptionEnvelope": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"subscription": {
|
||||
"$ref": "#/definitions/dto.PushSubscriptionResponse"
|
||||
}
|
||||
}
|
||||
},
|
||||
"dto.PushSubscriptionKeys": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"auth",
|
||||
"p256dh"
|
||||
],
|
||||
"properties": {
|
||||
"auth": {
|
||||
"type": "string",
|
||||
"maxLength": 255,
|
||||
"example": "tBHItJI5svbpez7KI4CCXg"
|
||||
},
|
||||
"p256dh": {
|
||||
"type": "string",
|
||||
"maxLength": 255,
|
||||
"example": "BNcRdreALRFXTkOOUHK1EtK2wtaz5Ry4YfYCA_0QTpQtUbVlUls0VJXg7A8u-Ts1XbjhazAkj7I99e8QcYP7DkM"
|
||||
}
|
||||
}
|
||||
},
|
||||
"dto.PushSubscriptionListResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"subscriptions": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/dto.PushSubscriptionResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"dto.PushSubscriptionPayload": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"endpoint",
|
||||
"keys"
|
||||
],
|
||||
"properties": {
|
||||
"endpoint": {
|
||||
"type": "string",
|
||||
"maxLength": 2048,
|
||||
"example": "https://fcm.googleapis.com/fcm/send/abc"
|
||||
},
|
||||
"keys": {
|
||||
"$ref": "#/definitions/dto.PushSubscriptionKeys"
|
||||
}
|
||||
}
|
||||
},
|
||||
"dto.PushSubscriptionResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"createdAt": {
|
||||
"type": "string"
|
||||
},
|
||||
"endpoint": {
|
||||
"type": "string",
|
||||
"example": "https://fcm.googleapis.com/fcm/send/abc"
|
||||
},
|
||||
"id": {
|
||||
"type": "integer",
|
||||
"example": 4
|
||||
},
|
||||
"lastUsedAt": {
|
||||
"type": "string"
|
||||
},
|
||||
"userAgent": {
|
||||
"type": "string",
|
||||
"example": "Mozilla/5.0 (Android 15; Mobile)"
|
||||
}
|
||||
}
|
||||
},
|
||||
"dto.PushTestResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"delivered": {
|
||||
"type": "integer",
|
||||
"example": 2
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
@ -3550,10 +3846,6 @@ const docTemplate = `{
|
|||
"dto.UserResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"assignmentMails": {
|
||||
"type": "boolean",
|
||||
"example": true
|
||||
},
|
||||
"defaultFilter": {
|
||||
"$ref": "#/definitions/dto.DefaultFilter"
|
||||
},
|
||||
|
|
@ -3582,10 +3874,6 @@ const docTemplate = `{
|
|||
"type": "string",
|
||||
"example": "Mustermann"
|
||||
},
|
||||
"mailNotifications": {
|
||||
"type": "boolean",
|
||||
"example": true
|
||||
},
|
||||
"mpFeuerHandzeichen": {
|
||||
"type": "string",
|
||||
"example": "JL"
|
||||
|
|
@ -3594,6 +3882,14 @@ const docTemplate = `{
|
|||
"type": "string",
|
||||
"example": "Max Mustermann"
|
||||
},
|
||||
"notifications": {
|
||||
"description": "Notifications contains every notification type with every transport.",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/dto.NotificationPreferences"
|
||||
}
|
||||
]
|
||||
},
|
||||
"role": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
|
|
@ -3703,6 +3999,8 @@ var SwaggerInfo = &swag.Spec{
|
|||
Description: "API for reporting and tracking faults on technical equipment of a fire brigade.\nUsers authenticate via OIDC (session cookie) or personal API tokens.\nPublic dashboards authenticate with a secret issued by an admin.",
|
||||
InfoInstanceName: "swagger",
|
||||
SwaggerTemplate: docTemplate,
|
||||
LeftDelim: "{{",
|
||||
RightDelim: "}}",
|
||||
}
|
||||
|
||||
func init() {
|
||||
|
|
|
|||
|
|
@ -1015,7 +1015,7 @@
|
|||
},
|
||||
"/api/v1/auth/config": {
|
||||
"get": {
|
||||
"description": "Returns whether OIDC is configured, the current user (if logged in) and the branding.",
|
||||
"description": "Returns whether OIDC is configured, the available notification transports, the current user (if logged in) and the branding.",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
|
|
@ -2392,7 +2392,7 @@
|
|||
"BearerTokenAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Stores the default filter for the fault overview and whether the user receives mails about new faults and assignments. Omitted fields are left unchanged.",
|
||||
"description": "Stores the default filter for the fault overview and via which transports (mail, webpush) the user receives each notification type (newFault, assigned). Omitted fields are left unchanged.",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
|
|
@ -2436,6 +2436,180 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/me/push-subscriptions": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"SessionCookieAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Returns the devices on which the user enabled push notifications.",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"me"
|
||||
],
|
||||
"summary": "List own push subscriptions",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.PushSubscriptionListResponse"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.ErrorResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"SessionCookieAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Stores the browser's push subscription for the current user. A subscription that is already known (e.g. from another user on a shared device) is moved to the current user.",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"me"
|
||||
],
|
||||
"summary": "Register push subscription",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "Subscription",
|
||||
"name": "payload",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.PushSubscriptionPayload"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"201": {
|
||||
"description": "Created",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.PushSubscriptionEnvelope"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.ErrorResponse"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.ErrorResponse"
|
||||
}
|
||||
},
|
||||
"409": {
|
||||
"description": "Conflict",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.ErrorResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/me/push-subscriptions/test": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"SessionCookieAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Sends a test notification to all devices of the current user.",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"me"
|
||||
],
|
||||
"summary": "Send test push notification",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.PushTestResponse"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.ErrorResponse"
|
||||
}
|
||||
},
|
||||
"409": {
|
||||
"description": "Conflict",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.ErrorResponse"
|
||||
}
|
||||
},
|
||||
"502": {
|
||||
"description": "Bad Gateway",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.ErrorResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/me/push-subscriptions/{id}": {
|
||||
"delete": {
|
||||
"security": [
|
||||
{
|
||||
"SessionCookieAuth": []
|
||||
}
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"me"
|
||||
],
|
||||
"summary": "Delete push subscription",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "Subscription ID",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.StatusResponse"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.ErrorResponse"
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "Not Found",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.ErrorResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/mp-feuer/devices": {
|
||||
"get": {
|
||||
"security": [
|
||||
|
|
@ -2534,6 +2708,17 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"database.NotificationTransport": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"mail",
|
||||
"webpush"
|
||||
],
|
||||
"x-enum-varnames": [
|
||||
"TransportMail",
|
||||
"TransportWebPush"
|
||||
]
|
||||
},
|
||||
"dto.APITokenCreateResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
|
@ -2603,11 +2788,27 @@
|
|||
"description": "MPFeuerEnabled reports whether faults can be handed over to MP-Feuer.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"notificationTransports": {
|
||||
"description": "NotificationTransports lists the transports configured on the server (mail needs SMTP).",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/database.NotificationTransport"
|
||||
},
|
||||
"example": [
|
||||
"mail",
|
||||
"webpush"
|
||||
]
|
||||
},
|
||||
"oidcEnabled": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"user": {
|
||||
"$ref": "#/definitions/dto.UserResponse"
|
||||
},
|
||||
"webPushPublicKey": {
|
||||
"description": "WebPushPublicKey is the VAPID key browsers subscribe with, empty if Web Push is disabled.",
|
||||
"type": "string",
|
||||
"example": "BOr3..."
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
@ -3440,24 +3641,120 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"dto.NotificationPreferences": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
},
|
||||
"dto.PreferencesPayload": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"assignmentMails": {
|
||||
"type": "boolean",
|
||||
"example": true
|
||||
},
|
||||
"defaultFilter": {
|
||||
"$ref": "#/definitions/dto.DefaultFilter"
|
||||
},
|
||||
"mailNotifications": {
|
||||
"type": "boolean",
|
||||
"example": false
|
||||
},
|
||||
"mpFeuerHandzeichen": {
|
||||
"type": "string",
|
||||
"maxLength": 16,
|
||||
"example": "JL"
|
||||
},
|
||||
"notifications": {
|
||||
"description": "Notifications switches single transports of notification types on or off, e.g.\n{\"assigned\": {\"mail\": false}}. Omitted types and transports are left unchanged.",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/dto.NotificationPreferences"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"dto.PushSubscriptionEnvelope": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"subscription": {
|
||||
"$ref": "#/definitions/dto.PushSubscriptionResponse"
|
||||
}
|
||||
}
|
||||
},
|
||||
"dto.PushSubscriptionKeys": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"auth",
|
||||
"p256dh"
|
||||
],
|
||||
"properties": {
|
||||
"auth": {
|
||||
"type": "string",
|
||||
"maxLength": 255,
|
||||
"example": "tBHItJI5svbpez7KI4CCXg"
|
||||
},
|
||||
"p256dh": {
|
||||
"type": "string",
|
||||
"maxLength": 255,
|
||||
"example": "BNcRdreALRFXTkOOUHK1EtK2wtaz5Ry4YfYCA_0QTpQtUbVlUls0VJXg7A8u-Ts1XbjhazAkj7I99e8QcYP7DkM"
|
||||
}
|
||||
}
|
||||
},
|
||||
"dto.PushSubscriptionListResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"subscriptions": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/dto.PushSubscriptionResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"dto.PushSubscriptionPayload": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"endpoint",
|
||||
"keys"
|
||||
],
|
||||
"properties": {
|
||||
"endpoint": {
|
||||
"type": "string",
|
||||
"maxLength": 2048,
|
||||
"example": "https://fcm.googleapis.com/fcm/send/abc"
|
||||
},
|
||||
"keys": {
|
||||
"$ref": "#/definitions/dto.PushSubscriptionKeys"
|
||||
}
|
||||
}
|
||||
},
|
||||
"dto.PushSubscriptionResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"createdAt": {
|
||||
"type": "string"
|
||||
},
|
||||
"endpoint": {
|
||||
"type": "string",
|
||||
"example": "https://fcm.googleapis.com/fcm/send/abc"
|
||||
},
|
||||
"id": {
|
||||
"type": "integer",
|
||||
"example": 4
|
||||
},
|
||||
"lastUsedAt": {
|
||||
"type": "string"
|
||||
},
|
||||
"userAgent": {
|
||||
"type": "string",
|
||||
"example": "Mozilla/5.0 (Android 15; Mobile)"
|
||||
}
|
||||
}
|
||||
},
|
||||
"dto.PushTestResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"delivered": {
|
||||
"type": "integer",
|
||||
"example": 2
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
@ -3542,10 +3839,6 @@
|
|||
"dto.UserResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"assignmentMails": {
|
||||
"type": "boolean",
|
||||
"example": true
|
||||
},
|
||||
"defaultFilter": {
|
||||
"$ref": "#/definitions/dto.DefaultFilter"
|
||||
},
|
||||
|
|
@ -3574,10 +3867,6 @@
|
|||
"type": "string",
|
||||
"example": "Mustermann"
|
||||
},
|
||||
"mailNotifications": {
|
||||
"type": "boolean",
|
||||
"example": true
|
||||
},
|
||||
"mpFeuerHandzeichen": {
|
||||
"type": "string",
|
||||
"example": "JL"
|
||||
|
|
@ -3586,6 +3875,14 @@
|
|||
"type": "string",
|
||||
"example": "Max Mustermann"
|
||||
},
|
||||
"notifications": {
|
||||
"description": "Notifications contains every notification type with every transport.",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/dto.NotificationPreferences"
|
||||
}
|
||||
]
|
||||
},
|
||||
"role": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
|
|
|
|||
|
|
@ -9,6 +9,14 @@ definitions:
|
|||
example: Feuerwehr Musterstadt
|
||||
type: string
|
||||
type: object
|
||||
database.NotificationTransport:
|
||||
enum:
|
||||
- mail
|
||||
- webpush
|
||||
type: string
|
||||
x-enum-varnames:
|
||||
- TransportMail
|
||||
- TransportWebPush
|
||||
dto.APITokenCreateResponse:
|
||||
properties:
|
||||
plainToken:
|
||||
|
|
@ -56,10 +64,24 @@ definitions:
|
|||
mpFeuerEnabled:
|
||||
description: MPFeuerEnabled reports whether faults can be handed over to MP-Feuer.
|
||||
type: boolean
|
||||
notificationTransports:
|
||||
description: NotificationTransports lists the transports configured on the
|
||||
server (mail needs SMTP).
|
||||
example:
|
||||
- mail
|
||||
- webpush
|
||||
items:
|
||||
$ref: '#/definitions/database.NotificationTransport'
|
||||
type: array
|
||||
oidcEnabled:
|
||||
type: boolean
|
||||
user:
|
||||
$ref: '#/definitions/dto.UserResponse'
|
||||
webPushPublicKey:
|
||||
description: WebPushPublicKey is the VAPID key browsers subscribe with, empty
|
||||
if Web Push is disabled.
|
||||
example: BOr3...
|
||||
type: string
|
||||
type: object
|
||||
dto.BrandingEnvelope:
|
||||
properties:
|
||||
|
|
@ -659,20 +681,86 @@ definitions:
|
|||
- key
|
||||
- kind
|
||||
type: object
|
||||
dto.NotificationPreferences:
|
||||
additionalProperties:
|
||||
additionalProperties:
|
||||
type: boolean
|
||||
type: object
|
||||
type: object
|
||||
dto.PreferencesPayload:
|
||||
properties:
|
||||
assignmentMails:
|
||||
example: true
|
||||
type: boolean
|
||||
defaultFilter:
|
||||
$ref: '#/definitions/dto.DefaultFilter'
|
||||
mailNotifications:
|
||||
example: false
|
||||
type: boolean
|
||||
mpFeuerHandzeichen:
|
||||
example: JL
|
||||
maxLength: 16
|
||||
type: string
|
||||
notifications:
|
||||
allOf:
|
||||
- $ref: '#/definitions/dto.NotificationPreferences'
|
||||
description: |-
|
||||
Notifications switches single transports of notification types on or off, e.g.
|
||||
{"assigned": {"mail": false}}. Omitted types and transports are left unchanged.
|
||||
type: object
|
||||
dto.PushSubscriptionEnvelope:
|
||||
properties:
|
||||
subscription:
|
||||
$ref: '#/definitions/dto.PushSubscriptionResponse'
|
||||
type: object
|
||||
dto.PushSubscriptionKeys:
|
||||
properties:
|
||||
auth:
|
||||
example: tBHItJI5svbpez7KI4CCXg
|
||||
maxLength: 255
|
||||
type: string
|
||||
p256dh:
|
||||
example: BNcRdreALRFXTkOOUHK1EtK2wtaz5Ry4YfYCA_0QTpQtUbVlUls0VJXg7A8u-Ts1XbjhazAkj7I99e8QcYP7DkM
|
||||
maxLength: 255
|
||||
type: string
|
||||
required:
|
||||
- auth
|
||||
- p256dh
|
||||
type: object
|
||||
dto.PushSubscriptionListResponse:
|
||||
properties:
|
||||
subscriptions:
|
||||
items:
|
||||
$ref: '#/definitions/dto.PushSubscriptionResponse'
|
||||
type: array
|
||||
type: object
|
||||
dto.PushSubscriptionPayload:
|
||||
properties:
|
||||
endpoint:
|
||||
example: https://fcm.googleapis.com/fcm/send/abc
|
||||
maxLength: 2048
|
||||
type: string
|
||||
keys:
|
||||
$ref: '#/definitions/dto.PushSubscriptionKeys'
|
||||
required:
|
||||
- endpoint
|
||||
- keys
|
||||
type: object
|
||||
dto.PushSubscriptionResponse:
|
||||
properties:
|
||||
createdAt:
|
||||
type: string
|
||||
endpoint:
|
||||
example: https://fcm.googleapis.com/fcm/send/abc
|
||||
type: string
|
||||
id:
|
||||
example: 4
|
||||
type: integer
|
||||
lastUsedAt:
|
||||
type: string
|
||||
userAgent:
|
||||
example: Mozilla/5.0 (Android 15; Mobile)
|
||||
type: string
|
||||
type: object
|
||||
dto.PushTestResponse:
|
||||
properties:
|
||||
delivered:
|
||||
example: 2
|
||||
type: integer
|
||||
type: object
|
||||
dto.RepairOrderPayload:
|
||||
properties:
|
||||
|
|
@ -732,9 +820,6 @@ definitions:
|
|||
type: object
|
||||
dto.UserResponse:
|
||||
properties:
|
||||
assignmentMails:
|
||||
example: true
|
||||
type: boolean
|
||||
defaultFilter:
|
||||
$ref: '#/definitions/dto.DefaultFilter'
|
||||
email:
|
||||
|
|
@ -755,15 +840,16 @@ definitions:
|
|||
lastName:
|
||||
example: Mustermann
|
||||
type: string
|
||||
mailNotifications:
|
||||
example: true
|
||||
type: boolean
|
||||
mpFeuerHandzeichen:
|
||||
example: JL
|
||||
type: string
|
||||
name:
|
||||
example: Max Mustermann
|
||||
type: string
|
||||
notifications:
|
||||
allOf:
|
||||
- $ref: '#/definitions/dto.NotificationPreferences'
|
||||
description: Notifications contains every notification type with every transport.
|
||||
role:
|
||||
enum:
|
||||
- user
|
||||
|
|
@ -1462,8 +1548,8 @@ paths:
|
|||
- auth
|
||||
/api/v1/auth/config:
|
||||
get:
|
||||
description: Returns whether OIDC is configured, the current user (if logged
|
||||
in) and the branding.
|
||||
description: Returns whether OIDC is configured, the available notification
|
||||
transports, the current user (if logged in) and the branding.
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
|
|
@ -2340,9 +2426,9 @@ paths:
|
|||
put:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Stores the default filter for the fault overview and whether the
|
||||
user receives mails about new faults and assignments. Omitted fields are left
|
||||
unchanged.
|
||||
description: Stores the default filter for the fault overview and via which
|
||||
transports (mail, webpush) the user receives each notification type (newFault,
|
||||
assigned). Omitted fields are left unchanged.
|
||||
parameters:
|
||||
- description: Preferences
|
||||
in: body
|
||||
|
|
@ -2371,6 +2457,117 @@ paths:
|
|||
summary: Update own preferences
|
||||
tags:
|
||||
- me
|
||||
/api/v1/me/push-subscriptions:
|
||||
get:
|
||||
description: Returns the devices on which the user enabled push notifications.
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/dto.PushSubscriptionListResponse'
|
||||
"401":
|
||||
description: Unauthorized
|
||||
schema:
|
||||
$ref: '#/definitions/dto.ErrorResponse'
|
||||
security:
|
||||
- SessionCookieAuth: []
|
||||
summary: List own push subscriptions
|
||||
tags:
|
||||
- me
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Stores the browser's push subscription for the current user. A
|
||||
subscription that is already known (e.g. from another user on a shared device)
|
||||
is moved to the current user.
|
||||
parameters:
|
||||
- description: Subscription
|
||||
in: body
|
||||
name: payload
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/dto.PushSubscriptionPayload'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"201":
|
||||
description: Created
|
||||
schema:
|
||||
$ref: '#/definitions/dto.PushSubscriptionEnvelope'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/dto.ErrorResponse'
|
||||
"401":
|
||||
description: Unauthorized
|
||||
schema:
|
||||
$ref: '#/definitions/dto.ErrorResponse'
|
||||
"409":
|
||||
description: Conflict
|
||||
schema:
|
||||
$ref: '#/definitions/dto.ErrorResponse'
|
||||
security:
|
||||
- SessionCookieAuth: []
|
||||
summary: Register push subscription
|
||||
tags:
|
||||
- me
|
||||
/api/v1/me/push-subscriptions/{id}:
|
||||
delete:
|
||||
parameters:
|
||||
- description: Subscription ID
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: integer
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/dto.StatusResponse'
|
||||
"401":
|
||||
description: Unauthorized
|
||||
schema:
|
||||
$ref: '#/definitions/dto.ErrorResponse'
|
||||
"404":
|
||||
description: Not Found
|
||||
schema:
|
||||
$ref: '#/definitions/dto.ErrorResponse'
|
||||
security:
|
||||
- SessionCookieAuth: []
|
||||
summary: Delete push subscription
|
||||
tags:
|
||||
- me
|
||||
/api/v1/me/push-subscriptions/test:
|
||||
post:
|
||||
description: Sends a test notification to all devices of the current user.
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/dto.PushTestResponse'
|
||||
"401":
|
||||
description: Unauthorized
|
||||
schema:
|
||||
$ref: '#/definitions/dto.ErrorResponse'
|
||||
"409":
|
||||
description: Conflict
|
||||
schema:
|
||||
$ref: '#/definitions/dto.ErrorResponse'
|
||||
"502":
|
||||
description: Bad Gateway
|
||||
schema:
|
||||
$ref: '#/definitions/dto.ErrorResponse'
|
||||
security:
|
||||
- SessionCookieAuth: []
|
||||
summary: Send test push notification
|
||||
tags:
|
||||
- me
|
||||
/api/v1/mp-feuer/devices:
|
||||
get:
|
||||
description: Returns the MP-Feuer device for a barcode and the Standort mapped
|
||||
|
|
|
|||
|
|
@ -3,9 +3,11 @@ module jonasled.dev/jonasled/feuerwehr-schadensmeldung/backend
|
|||
go 1.27.1
|
||||
|
||||
require (
|
||||
github.com/SherClockHolmes/webpush-go v1.4.0
|
||||
github.com/coreos/go-oidc/v3 v3.21.0
|
||||
github.com/gin-gonic/gin v1.12.0
|
||||
github.com/glebarez/sqlite v1.11.0
|
||||
github.com/go-pdf/fpdf v0.9.0
|
||||
github.com/google/uuid v1.6.0
|
||||
github.com/joho/godotenv v1.5.1
|
||||
github.com/microsoft/go-mssqldb v1.9.6
|
||||
|
|
@ -41,13 +43,13 @@ require (
|
|||
github.com/go-openapi/jsonreference v0.19.6 // indirect
|
||||
github.com/go-openapi/spec v0.20.4 // indirect
|
||||
github.com/go-openapi/swag v0.19.15 // indirect
|
||||
github.com/go-pdf/fpdf v0.9.0 // indirect
|
||||
github.com/go-playground/locales v0.14.1 // indirect
|
||||
github.com/go-playground/universal-translator v0.18.1 // indirect
|
||||
github.com/go-playground/validator/v10 v10.30.1 // indirect
|
||||
github.com/go-sql-driver/mysql v1.8.1 // indirect
|
||||
github.com/goccy/go-json v0.10.5 // indirect
|
||||
github.com/goccy/go-yaml v1.19.2 // indirect
|
||||
github.com/golang-jwt/jwt/v5 v5.2.2 // indirect
|
||||
github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 // indirect
|
||||
github.com/golang-sql/sqlexp v0.1.0 // indirect
|
||||
github.com/jackc/pgpassfile v1.0.0 // indirect
|
||||
|
|
|
|||
|
|
@ -18,6 +18,8 @@ github.com/PuerkitoBio/purell v1.1.1 h1:WEQqlqaGbrPkxLJWfBwQmfEAE1Z7ONdDLqrN38tN
|
|||
github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0=
|
||||
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 h1:d+Bc7a5rLufV/sSk/8dngufqelfh6jnri85riMAaF/M=
|
||||
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE=
|
||||
github.com/SherClockHolmes/webpush-go v1.4.0 h1:ocnzNKWN23T9nvHi6IfyrQjkIc0oJWv1B1pULsf9i3s=
|
||||
github.com/SherClockHolmes/webpush-go v1.4.0/go.mod h1:XSq8pKX11vNV8MJEMwjrlTkxhAj1zKfxmyhdV7Pd6UA=
|
||||
github.com/bytedance/gopkg v0.1.3 h1:TPBSwH8RsouGCBcMBktLt1AymVo2TVsBVCY4b6TnZ/M=
|
||||
github.com/bytedance/gopkg v0.1.3/go.mod h1:576VvJ+eJgyCzdjS+c4+77QF3p7ubbtiKARP3TxducM=
|
||||
github.com/bytedance/sonic v1.15.0 h1:/PXeWFaR5ElNcVE84U0dOHjiMHQOwNIx3K4ymzh/uSE=
|
||||
|
|
@ -74,12 +76,14 @@ github.com/goccy/go-json v0.10.5 h1:Fq85nIqj+gXn/S5ahsiTlK3TmC85qgirsdTP/+DeaC4=
|
|||
github.com/goccy/go-json v0.10.5/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M=
|
||||
github.com/goccy/go-yaml v1.19.2 h1:PmFC1S6h8ljIz6gMRBopkjP1TVT7xuwrButHID66PoM=
|
||||
github.com/goccy/go-yaml v1.19.2/go.mod h1:XBurs7gK8ATbW4ZPGKgcbrY1Br56PdM69F7LkFRi1kA=
|
||||
github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk=
|
||||
github.com/golang-jwt/jwt/v5 v5.2.2 h1:Rl4B7itRWVtYIHFrSNd7vhTiz9UpLdi6gZhZ3wEeDy8=
|
||||
github.com/golang-jwt/jwt/v5 v5.2.2/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk=
|
||||
github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 h1:au07oEsX2xN0ktxqI+Sida1w446QrXBRJ0nee3SNZlA=
|
||||
github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0=
|
||||
github.com/golang-sql/sqlexp v0.1.0 h1:ZCD6MBpcuOVfGVqsEmY5/4FtYiKz6tSyUv9LPEDei6A=
|
||||
github.com/golang-sql/sqlexp v0.1.0/go.mod h1:J4ad9Vo8ZCWQ2GMrC4UCQy1JpCbwU9m3EOqtpKwwwHI=
|
||||
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
|
||||
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
|
||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||
|
|
@ -190,22 +194,40 @@ golang.org/x/arch v0.22.0 h1:c/Zle32i5ttqRXjdLyyHZESLD/bB90DCU1g9l/0YBDI=
|
|||
golang.org/x/arch v0.22.0/go.mod h1:dNHoOeKiyja7GTvF9NJS1l3Z2yntpQNzgrjh1cU103A=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||
golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc=
|
||||
golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
|
||||
golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8=
|
||||
golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk=
|
||||
golang.org/x/crypto v0.52.0 h1:RMs7fP2rXdep0CftQlK8Uf+kibLm7qkCcradZWYz988=
|
||||
golang.org/x/crypto v0.52.0/go.mod h1:1QgfPxDqh0T2M/elOJtp9RvuR95kVjir0e6/BvEmGbc=
|
||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
|
||||
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
|
||||
golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
|
||||
golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
|
||||
golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
|
||||
golang.org/x/mod v0.35.0 h1:Ww1D637e6Pg+Zb2KrWfHQUnH2dQRLBQyAtpr/haaJeM=
|
||||
golang.org/x/mod v0.35.0/go.mod h1:+GwiRhIInF8wPm+4AoT6L0FA1QWAad3OMdTRx4tFYlU=
|
||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||
golang.org/x/net v0.0.0-20210421230115-4e50805a0758/go.mod h1:72T/g9IO56b78aLF+1Kcs5dz7/ng1VjMUvfKvpfy+jM=
|
||||
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
|
||||
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
|
||||
golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
|
||||
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
|
||||
golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk=
|
||||
golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
|
||||
golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM=
|
||||
golang.org/x/net v0.54.0 h1:2zJIZAxAHV/OHCDTCOHAYehQzLfSXuf/5SoL/Dv6w/w=
|
||||
golang.org/x/net v0.54.0/go.mod h1:Sj4oj8jK6XmHpBZU/zWHw3BV3abl4Kvi+Ut7cQcY+cQ=
|
||||
golang.org/x/oauth2 v0.37.0 h1:JUlcxA8oAtauLfiH8FX2/FkAWHAdi0QtGCGc+hofE98=
|
||||
golang.org/x/oauth2 v0.37.0/go.mod h1:IxwZNxUULJmpBFf9K/9NTMSIfZZuvuTy1gGxhigP/58=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
|
||||
golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||
golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||
golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||
golang.org/x/sync v0.20.0 h1:e0PTpb7pjO8GAtTs2dQ6jYa5BWYlMuX047Dco/pItO4=
|
||||
golang.org/x/sync v0.20.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
|
|
@ -216,21 +238,40 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc
|
|||
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/sys v0.45.0 h1:dO4czNzziLiiXplLQgBCEpCvXQ3dnkn0SdaZSYdQ+FY=
|
||||
golang.org/x/sys v0.45.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
|
||||
golang.org/x/telemetry v0.0.0-20240228155512-f48c80bd79b2/go.mod h1:TeRTkGYfJXctD9OcfyVLyj2J3IxLnKwHJR8f4D8a3YE=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
|
||||
golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo=
|
||||
golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU=
|
||||
golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk=
|
||||
golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY=
|
||||
golang.org/x/term v0.27.0/go.mod h1:iMsnZpn0cago0GOrHO2+Y7u7JPn5AylBrcoWkElMTSM=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
||||
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
|
||||
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
|
||||
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
||||
golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
||||
golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=
|
||||
golang.org/x/text v0.37.0 h1:Cqjiwd9eSg8e0QAkyCaQTNHFIIzWtidPahFWR83rTrc=
|
||||
golang.org/x/text v0.37.0/go.mod h1:a5sjxXGs9hsn/AJVwuElvCAo9v8QYLzvavO5z2PiM38=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
|
||||
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
|
||||
golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58=
|
||||
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk=
|
||||
golang.org/x/tools v0.44.0 h1:UP4ajHPIcuMjT1GqzDWRlalUEoY+uzoZKnhOjbIPD2c=
|
||||
golang.org/x/tools v0.44.0/go.mod h1:KA0AfVErSdxRZIsOVipbv3rQhVXTnlU6UhKxHd1seDI=
|
||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
|
|
|
|||
|
|
@ -8,18 +8,33 @@ import (
|
|||
)
|
||||
|
||||
type UserResponse struct {
|
||||
ID uint `json:"id" example:"1"`
|
||||
Email string `json:"email" example:"max.mustermann@example.org"`
|
||||
Name string `json:"name" example:"Max Mustermann"`
|
||||
FirstName string `json:"firstName" example:"Max"`
|
||||
LastName string `json:"lastName" example:"Mustermann"`
|
||||
Role string `json:"role" example:"admin" enums:"user,admin"`
|
||||
LastLoginAt *time.Time `json:"lastLoginAt,omitempty"`
|
||||
Groups []string `json:"groups"`
|
||||
DefaultFilter DefaultFilter `json:"defaultFilter"`
|
||||
MailNotifications bool `json:"mailNotifications" example:"true"`
|
||||
AssignmentMails bool `json:"assignmentMails" example:"true"`
|
||||
MPFeuerHandzeichen string `json:"mpFeuerHandzeichen" example:"JL"`
|
||||
ID uint `json:"id" example:"1"`
|
||||
Email string `json:"email" example:"max.mustermann@example.org"`
|
||||
Name string `json:"name" example:"Max Mustermann"`
|
||||
FirstName string `json:"firstName" example:"Max"`
|
||||
LastName string `json:"lastName" example:"Mustermann"`
|
||||
Role string `json:"role" example:"admin" enums:"user,admin"`
|
||||
LastLoginAt *time.Time `json:"lastLoginAt,omitempty"`
|
||||
Groups []string `json:"groups"`
|
||||
DefaultFilter DefaultFilter `json:"defaultFilter"`
|
||||
// Notifications contains every notification type with every transport.
|
||||
Notifications NotificationPreferences `json:"notifications"`
|
||||
MPFeuerHandzeichen string `json:"mpFeuerHandzeichen" example:"JL"`
|
||||
}
|
||||
|
||||
// NotificationPreferences maps a notification type (newFault, assigned) to whether the user
|
||||
// receives it via each transport (mail, webpush).
|
||||
type NotificationPreferences map[database.NotificationType]map[database.NotificationTransport]bool
|
||||
|
||||
func newNotificationPreferences(user *database.User) NotificationPreferences {
|
||||
preferences := NotificationPreferences{}
|
||||
for _, kind := range database.NotificationTypes {
|
||||
preferences[kind] = map[database.NotificationTransport]bool{}
|
||||
for _, transport := range database.NotificationTransports {
|
||||
preferences[kind][transport] = user.NotificationEnabled(kind, transport)
|
||||
}
|
||||
}
|
||||
return preferences
|
||||
}
|
||||
|
||||
// DefaultFilter is the user's preferred filter for the fault overview. Empty values mean "all".
|
||||
|
|
@ -32,10 +47,11 @@ type DefaultFilter struct {
|
|||
|
||||
// PreferencesPayload updates the user's own preferences. Omitted fields are left unchanged.
|
||||
type PreferencesPayload struct {
|
||||
DefaultFilter *DefaultFilter `json:"defaultFilter,omitempty"`
|
||||
MailNotifications *bool `json:"mailNotifications,omitempty" example:"false"`
|
||||
AssignmentMails *bool `json:"assignmentMails,omitempty" example:"true"`
|
||||
MPFeuerHandzeichen *string `json:"mpFeuerHandzeichen,omitempty" binding:"omitempty,max=16" example:"JL"`
|
||||
DefaultFilter *DefaultFilter `json:"defaultFilter,omitempty"`
|
||||
// Notifications switches single transports of notification types on or off, e.g.
|
||||
// {"assigned": {"mail": false}}. Omitted types and transports are left unchanged.
|
||||
Notifications NotificationPreferences `json:"notifications,omitempty"`
|
||||
MPFeuerHandzeichen *string `json:"mpFeuerHandzeichen,omitempty" binding:"omitempty,max=16" example:"JL"`
|
||||
}
|
||||
|
||||
func NewUser(user *database.User) *UserResponse {
|
||||
|
|
@ -51,8 +67,7 @@ func NewUser(user *database.User) *UserResponse {
|
|||
Role: string(user.Role),
|
||||
LastLoginAt: user.LastLoginAt,
|
||||
Groups: nonNil(user.Groups),
|
||||
MailNotifications: !user.MailNotificationsDisabled,
|
||||
AssignmentMails: !user.AssignmentMailsDisabled,
|
||||
Notifications: newNotificationPreferences(user),
|
||||
MPFeuerHandzeichen: user.MPFeuerHandzeichen,
|
||||
DefaultFilter: DefaultFilter{
|
||||
FaultTypeID: user.DefaultFaultTypeID,
|
||||
|
|
@ -74,9 +89,13 @@ type UserListResponse struct {
|
|||
type AuthConfigResponse struct {
|
||||
OIDCEnabled bool `json:"oidcEnabled"`
|
||||
// MPFeuerEnabled reports whether faults can be handed over to MP-Feuer.
|
||||
MPFeuerEnabled bool `json:"mpFeuerEnabled"`
|
||||
User *UserResponse `json:"user,omitempty"`
|
||||
Branding appsettings.Branding `json:"branding"`
|
||||
MPFeuerEnabled bool `json:"mpFeuerEnabled"`
|
||||
// NotificationTransports lists the transports configured on the server (mail needs SMTP).
|
||||
NotificationTransports []database.NotificationTransport `json:"notificationTransports" example:"mail,webpush"`
|
||||
// WebPushPublicKey is the VAPID key browsers subscribe with, empty if Web Push is disabled.
|
||||
WebPushPublicKey string `json:"webPushPublicKey" example:"BOr3..."`
|
||||
User *UserResponse `json:"user,omitempty"`
|
||||
Branding appsettings.Branding `json:"branding"`
|
||||
}
|
||||
|
||||
type APITokenResponse struct {
|
||||
|
|
@ -128,3 +147,44 @@ type GroupMembership struct {
|
|||
type GroupMembershipResponse struct {
|
||||
Groups []GroupMembership `json:"groups"`
|
||||
}
|
||||
|
||||
type PushSubscriptionKeys struct {
|
||||
P256dh string `json:"p256dh" binding:"required,max=255" example:"BNcRdreALRFXTkOOUHK1EtK2wtaz5Ry4YfYCA_0QTpQtUbVlUls0VJXg7A8u-Ts1XbjhazAkj7I99e8QcYP7DkM"`
|
||||
Auth string `json:"auth" binding:"required,max=255" example:"tBHItJI5svbpez7KI4CCXg"`
|
||||
}
|
||||
|
||||
// PushSubscriptionPayload is the browser's PushSubscription as returned by toJSON().
|
||||
type PushSubscriptionPayload struct {
|
||||
Endpoint string `json:"endpoint" binding:"required,max=2048" example:"https://fcm.googleapis.com/fcm/send/abc"`
|
||||
Keys PushSubscriptionKeys `json:"keys" binding:"required"`
|
||||
}
|
||||
|
||||
type PushSubscriptionResponse struct {
|
||||
ID uint `json:"id" example:"4"`
|
||||
Endpoint string `json:"endpoint" example:"https://fcm.googleapis.com/fcm/send/abc"`
|
||||
UserAgent string `json:"userAgent" example:"Mozilla/5.0 (Android 15; Mobile)"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
LastUsedAt *time.Time `json:"lastUsedAt,omitempty"`
|
||||
}
|
||||
|
||||
func NewPushSubscription(subscription *database.PushSubscription) PushSubscriptionResponse {
|
||||
return PushSubscriptionResponse{
|
||||
ID: subscription.ID,
|
||||
Endpoint: subscription.Endpoint,
|
||||
UserAgent: subscription.UserAgent,
|
||||
CreatedAt: subscription.CreatedAt,
|
||||
LastUsedAt: subscription.LastUsedAt,
|
||||
}
|
||||
}
|
||||
|
||||
type PushSubscriptionEnvelope struct {
|
||||
Subscription PushSubscriptionResponse `json:"subscription"`
|
||||
}
|
||||
|
||||
type PushSubscriptionListResponse struct {
|
||||
Subscriptions []PushSubscriptionResponse `json:"subscriptions"`
|
||||
}
|
||||
|
||||
type PushTestResponse struct {
|
||||
Delivered int `json:"delivered" example:"2"`
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
// Package notify informs the members of a fault type's OIDC groups about new faults and users about
|
||||
// faults assigned to them by mail.
|
||||
// faults assigned to them. Each notification is delivered via the transports (mail, Web Push) the
|
||||
// user enabled for its type.
|
||||
package notify
|
||||
|
||||
import (
|
||||
|
|
@ -9,6 +10,7 @@ import (
|
|||
"jonasled.dev/jonasled/feuerwehr-schadensmeldung/backend/database"
|
||||
"jonasled.dev/jonasled/feuerwehr-schadensmeldung/backend/internal/appsettings"
|
||||
"jonasled.dev/jonasled/feuerwehr-schadensmeldung/backend/internal/mailer"
|
||||
"jonasled.dev/jonasled/feuerwehr-schadensmeldung/backend/internal/webpush"
|
||||
"jonasled.dev/jonasled/go-libs/config"
|
||||
"jonasled.dev/jonasled/go-libs/log"
|
||||
)
|
||||
|
|
@ -22,11 +24,61 @@ var priorityLabels = map[database.FaultPriority]string{
|
|||
database.FaultPriorityHigh: "Hoch",
|
||||
}
|
||||
|
||||
// NewFault sends a mail to every known member of the fault type's OIDC groups, except the reporter
|
||||
// and users who disabled mail notifications.
|
||||
// TransportEnabled reports whether the transport is configured on the server.
|
||||
func TransportEnabled(transport database.NotificationTransport) bool {
|
||||
switch transport {
|
||||
case database.TransportMail:
|
||||
return mailer.Enabled()
|
||||
case database.TransportWebPush:
|
||||
return webpush.Enabled()
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func anyTransportEnabled() bool {
|
||||
for _, transport := range database.NotificationTransports {
|
||||
if TransportEnabled(transport) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// notification is one rendered message for a single user.
|
||||
type notification struct {
|
||||
kind database.NotificationType
|
||||
faultID uint
|
||||
subject string
|
||||
mailBody string
|
||||
push webpush.Message
|
||||
}
|
||||
|
||||
// deliver sends the notification via every transport that is configured and enabled by the user.
|
||||
func deliver(user *database.User, n notification) {
|
||||
logger := log.Log.WithField("fault", n.faultID).WithField("type", n.kind).WithField("user", user.ID)
|
||||
if mailer.Enabled() && user.Email != "" && user.NotificationEnabled(n.kind, database.TransportMail) {
|
||||
message := mailer.Message{To: user.Email, ToName: user.Name, Subject: n.subject, Body: n.mailBody}
|
||||
if err := mailer.Send(message); err != nil {
|
||||
logger.WithError(err).WithField("to", user.Email).Error("Failed sending notification mail")
|
||||
} else {
|
||||
logger.WithField("to", user.Email).Info("Sent notification mail")
|
||||
}
|
||||
}
|
||||
if webpush.Enabled() && user.NotificationEnabled(n.kind, database.TransportWebPush) {
|
||||
delivered, err := webpush.SendToUser(user.ID, n.push)
|
||||
if err != nil {
|
||||
logger.WithError(err).Error("Failed sending push notification")
|
||||
}
|
||||
if delivered > 0 {
|
||||
logger.WithField("devices", delivered).Info("Sent push notification")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// NewFault notifies every known member of the fault type's OIDC groups, except the reporter.
|
||||
// Group memberships are known from the users' last login.
|
||||
func NewFault(fault *database.Fault) {
|
||||
if !mailer.Enabled() || len(fault.FaultType.OIDCGroups) == 0 {
|
||||
if !anyTransportEnabled() || len(fault.FaultType.OIDCGroups) == 0 {
|
||||
return
|
||||
}
|
||||
if Async {
|
||||
|
|
@ -39,7 +91,7 @@ func NewFault(fault *database.Fault) {
|
|||
// Recipients returns the users that should be notified about the fault.
|
||||
func Recipients(fault *database.Fault) ([]database.User, error) {
|
||||
users := []database.User{}
|
||||
if err := database.Db.Where("email <> '' AND mail_notifications_disabled = ?", false).Find(&users).Error; err != nil {
|
||||
if err := database.Db.Find(&users).Error; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
groups := map[string]bool{}
|
||||
|
|
@ -69,13 +121,20 @@ func send(fault database.Fault) {
|
|||
}
|
||||
branding := appsettings.Current()
|
||||
subject := fmt.Sprintf("[%s] Neue Meldung #%d: %s", branding.ApplicationTitle, fault.ID, fault.Title)
|
||||
push := webpush.Message{
|
||||
Title: fmt.Sprintf("Neue Meldung #%d: %s", fault.ID, fault.Title),
|
||||
Body: pushSummary(&fault),
|
||||
URL: faultPath(&fault),
|
||||
Tag: fmt.Sprintf("fault-%d", fault.ID),
|
||||
}
|
||||
for _, user := range recipients {
|
||||
message := mailer.Message{To: user.Email, ToName: user.Name, Subject: subject, Body: body(&fault, &user, branding)}
|
||||
if err := mailer.Send(message); err != nil {
|
||||
log.Log.WithError(err).WithField("fault", fault.ID).WithField("to", user.Email).Error("Failed sending notification mail")
|
||||
continue
|
||||
}
|
||||
log.Log.WithField("fault", fault.ID).WithField("to", user.Email).Info("Sent notification mail")
|
||||
deliver(&user, notification{
|
||||
kind: database.NotificationNewFault,
|
||||
faultID: fault.ID,
|
||||
subject: subject,
|
||||
mailBody: body(&fault, &user, branding),
|
||||
push: push,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -84,15 +143,15 @@ func body(fault *database.Fault, user *database.User, branding appsettings.Brand
|
|||
fmt.Fprintf(&builder, "Hallo %s,\n\n", user.Name)
|
||||
fmt.Fprintf(&builder, "für die Verantwortlichkeit \"%s\" wurde eine neue Meldung erfasst:\n\n", fault.FaultType.Name)
|
||||
writeDetails(&builder, fault)
|
||||
fmt.Fprintf(&builder, "\n-- \nDiese E-Mail wurde automatisch von %s (%s) versendet, weil du Mitglied einer zuständigen Gruppe bist.\n",
|
||||
fmt.Fprintf(&builder, "\n-- \nDiese E-Mail wurde automatisch von %s (%s) versendet, weil du Mitglied einer zuständigen Gruppe bist.\n"+
|
||||
"Du kannst diese E-Mails in den Einstellungen unter \"Benachrichtigungen\" abschalten.\n",
|
||||
branding.ApplicationTitle, branding.OrganizationName)
|
||||
return builder.String()
|
||||
}
|
||||
|
||||
// Assigned mails the users who were assigned to the fault by someone else, unless they disabled
|
||||
// assignment mails.
|
||||
// Assigned notifies the users who were assigned to the fault by someone else.
|
||||
func Assigned(fault *database.Fault, users []database.User, assignedBy *database.User) {
|
||||
if !mailer.Enabled() || len(users) == 0 {
|
||||
if !anyTransportEnabled() || len(users) == 0 {
|
||||
return
|
||||
}
|
||||
if Async {
|
||||
|
|
@ -105,16 +164,24 @@ func Assigned(fault *database.Fault, users []database.User, assignedBy *database
|
|||
func sendAssigned(fault database.Fault, users []database.User, assignedBy *database.User) {
|
||||
branding := appsettings.Current()
|
||||
subject := fmt.Sprintf("[%s] Dir zugewiesen: Meldung #%d %s", branding.ApplicationTitle, fault.ID, fault.Title)
|
||||
lead := "Dir wurde eine Meldung zugewiesen."
|
||||
if assignedBy != nil {
|
||||
lead = assignedBy.Name + " hat dir eine Meldung zugewiesen."
|
||||
}
|
||||
push := webpush.Message{
|
||||
Title: fmt.Sprintf("Dir zugewiesen: #%d %s", fault.ID, fault.Title),
|
||||
Body: lead + "\n" + pushSummary(&fault),
|
||||
URL: faultPath(&fault),
|
||||
Tag: fmt.Sprintf("fault-%d-assigned", fault.ID),
|
||||
}
|
||||
for _, user := range users {
|
||||
if user.Email == "" || user.AssignmentMailsDisabled {
|
||||
continue
|
||||
}
|
||||
message := mailer.Message{To: user.Email, ToName: user.Name, Subject: subject, Body: assignedBody(&fault, &user, assignedBy, branding)}
|
||||
if err := mailer.Send(message); err != nil {
|
||||
log.Log.WithError(err).WithField("fault", fault.ID).WithField("to", user.Email).Error("Failed sending assignment mail")
|
||||
continue
|
||||
}
|
||||
log.Log.WithField("fault", fault.ID).WithField("to", user.Email).Info("Sent assignment mail")
|
||||
deliver(&user, notification{
|
||||
kind: database.NotificationAssigned,
|
||||
faultID: fault.ID,
|
||||
subject: subject,
|
||||
mailBody: assignedBody(&fault, &user, assignedBy, branding),
|
||||
push: push,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -142,6 +209,31 @@ func assignedBody(fault *database.Fault, user *database.User, assignedBy *databa
|
|||
return builder.String()
|
||||
}
|
||||
|
||||
// faultPath is the frontend route of the fault, opened when a push notification is clicked.
|
||||
func faultPath(fault *database.Fault) string {
|
||||
return fmt.Sprintf("/meldungen/%d", fault.ID)
|
||||
}
|
||||
|
||||
// pushSummary is the short fault description shown in push notifications.
|
||||
func pushSummary(fault *database.Fault) string {
|
||||
parts := []string{}
|
||||
if fault.FaultType.Name != "" {
|
||||
parts = append(parts, fault.FaultType.Name)
|
||||
}
|
||||
parts = append(parts, "Priorität "+priorityLabels[fault.Priority])
|
||||
if fault.Location != nil {
|
||||
parts = append(parts, fault.Location.Name)
|
||||
}
|
||||
if fault.Device != "" {
|
||||
parts = append(parts, fault.Device)
|
||||
}
|
||||
summary := strings.Join(parts, " · ")
|
||||
if fault.Description != "" {
|
||||
summary += "\n" + fault.Description
|
||||
}
|
||||
return summary
|
||||
}
|
||||
|
||||
// writeDetails writes the fault summary shared by all notification mails.
|
||||
func writeDetails(builder *strings.Builder, fault *database.Fault) {
|
||||
fmt.Fprintf(builder, "Meldung: #%d %s\n", fault.ID, fault.Title)
|
||||
|
|
|
|||
198
backend/internal/webpush/webpush.go
Normal file
198
backend/internal/webpush/webpush.go
Normal file
|
|
@ -0,0 +1,198 @@
|
|||
// Package webpush delivers notifications to the users' browsers via the Web Push protocol. The
|
||||
// VAPID key pair is taken from VAPID_PUBLIC_KEY/VAPID_PRIVATE_KEY or generated once and stored in
|
||||
// the database, so all replicas share it. Web Push is disabled if WEBPUSH_ENABLED is false.
|
||||
package webpush
|
||||
|
||||
import (
|
||||
"crypto/sha256"
|
||||
"encoding/hex"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
"net/mail"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
webpushgo "github.com/SherClockHolmes/webpush-go"
|
||||
"jonasled.dev/jonasled/feuerwehr-schadensmeldung/backend/database"
|
||||
"jonasled.dev/jonasled/go-libs/config"
|
||||
"jonasled.dev/jonasled/go-libs/log"
|
||||
)
|
||||
|
||||
// Message is the payload shown by the service worker (see frontend/public/sw.js).
|
||||
type Message struct {
|
||||
Title string `json:"title"`
|
||||
Body string `json:"body"`
|
||||
// URL is opened when the notification is clicked, relative to the application.
|
||||
URL string `json:"url,omitempty"`
|
||||
// Tag replaces an earlier notification with the same tag on the device.
|
||||
Tag string `json:"tag,omitempty"`
|
||||
}
|
||||
|
||||
// ErrGone is returned by SendFunc when the push service no longer knows the subscription.
|
||||
var ErrGone = errors.New("push subscription expired")
|
||||
|
||||
// SendFunc delivers a message to one subscription. It can be replaced in tests.
|
||||
var SendFunc = sendWebPush
|
||||
|
||||
// maxBodyLength keeps the encrypted payload well below the 4 KB push services accept.
|
||||
const maxBodyLength = 1000
|
||||
|
||||
var (
|
||||
keysMutex sync.Mutex
|
||||
publicKey string
|
||||
privateKey string
|
||||
)
|
||||
|
||||
// Enabled reports whether Web Push is switched on.
|
||||
func Enabled() bool {
|
||||
return config.GetOrDefault("WEBPUSH_ENABLED", "true") == "true"
|
||||
}
|
||||
|
||||
// PublicKey returns the VAPID public key browsers subscribe with, or "" if Web Push is disabled.
|
||||
func PublicKey() string {
|
||||
if !Enabled() {
|
||||
return ""
|
||||
}
|
||||
public, _, err := keys()
|
||||
if err != nil {
|
||||
log.Log.WithError(err).Error("Failed loading VAPID keys")
|
||||
return ""
|
||||
}
|
||||
return public
|
||||
}
|
||||
|
||||
// HashEndpoint returns the value stored in PushSubscription.EndpointHash.
|
||||
func HashEndpoint(endpoint string) string {
|
||||
sum := sha256.Sum256([]byte(endpoint))
|
||||
return hex.EncodeToString(sum[:])
|
||||
}
|
||||
|
||||
func keys() (string, string, error) {
|
||||
keysMutex.Lock()
|
||||
defer keysMutex.Unlock()
|
||||
if publicKey != "" {
|
||||
return publicKey, privateKey, nil
|
||||
}
|
||||
public := strings.TrimSpace(config.GetOrDefault("VAPID_PUBLIC_KEY", ""))
|
||||
private := strings.TrimSpace(config.GetOrDefault("VAPID_PRIVATE_KEY", ""))
|
||||
if public == "" || private == "" {
|
||||
var err error
|
||||
public, private, err = storedKeys()
|
||||
if err != nil {
|
||||
return "", "", err
|
||||
}
|
||||
}
|
||||
publicKey, privateKey = public, private
|
||||
return publicKey, privateKey, nil
|
||||
}
|
||||
|
||||
// storedKeys loads the key pair from the settings row and generates it on first use.
|
||||
func storedKeys() (string, string, error) {
|
||||
settings := database.AppSettings{}
|
||||
if err := database.Db.FirstOrCreate(&settings).Error; err != nil {
|
||||
return "", "", err
|
||||
}
|
||||
if settings.VAPIDPublicKey != "" && settings.VAPIDPrivateKey != "" {
|
||||
return settings.VAPIDPublicKey, settings.VAPIDPrivateKey, nil
|
||||
}
|
||||
private, public, err := webpushgo.GenerateVAPIDKeys()
|
||||
if err != nil {
|
||||
return "", "", err
|
||||
}
|
||||
// Another replica may have generated a pair in the meantime; only the first one is kept.
|
||||
err = database.Db.Model(&database.AppSettings{}).
|
||||
Where("id = ? AND (vapid_public_key IS NULL OR vapid_public_key = '')", settings.ID).
|
||||
Updates(map[string]any{"vapid_public_key": public, "vapid_private_key": private}).Error
|
||||
if err != nil {
|
||||
return "", "", err
|
||||
}
|
||||
if err := database.Db.First(&settings, settings.ID).Error; err != nil {
|
||||
return "", "", err
|
||||
}
|
||||
log.Log.Info("Generated VAPID key pair for Web Push")
|
||||
return settings.VAPIDPublicKey, settings.VAPIDPrivateKey, nil
|
||||
}
|
||||
|
||||
// subscriber is the contact push services use when there are problems with our messages.
|
||||
func subscriber() string {
|
||||
if subject := strings.TrimSpace(config.GetOrDefault("VAPID_SUBJECT", "")); subject != "" {
|
||||
return subject
|
||||
}
|
||||
if address, err := mail.ParseAddress(config.GetOrDefault("SMTP_FROM", "")); err == nil {
|
||||
return address.Address
|
||||
}
|
||||
if appURL := strings.TrimSpace(config.GetOrDefault("APP_URL", "")); strings.HasPrefix(appURL, "https://") {
|
||||
return appURL
|
||||
}
|
||||
return "https://jonasled.dev/jonasled/feuerwehr-schadensmeldung"
|
||||
}
|
||||
|
||||
// SendToUser delivers the message to all devices of the user. Expired subscriptions are removed.
|
||||
// It returns the number of devices the message was delivered to.
|
||||
func SendToUser(userID uint, message Message) (int, error) {
|
||||
if !Enabled() {
|
||||
return 0, errors.New("web push is disabled")
|
||||
}
|
||||
subscriptions := []database.PushSubscription{}
|
||||
if err := database.Db.Where("user_id = ?", userID).Find(&subscriptions).Error; err != nil {
|
||||
return 0, err
|
||||
}
|
||||
if len([]rune(message.Body)) > maxBodyLength {
|
||||
message.Body = string([]rune(message.Body)[:maxBodyLength-1]) + "…"
|
||||
}
|
||||
delivered := 0
|
||||
var errs []error
|
||||
for _, subscription := range subscriptions {
|
||||
err := SendFunc(subscription, message)
|
||||
switch {
|
||||
case errors.Is(err, ErrGone):
|
||||
database.Db.Delete(&subscription)
|
||||
log.Log.WithField("user", userID).WithField("subscription", subscription.ID).Info("Removed expired push subscription")
|
||||
case err != nil:
|
||||
errs = append(errs, err)
|
||||
default:
|
||||
delivered++
|
||||
now := time.Now()
|
||||
database.Db.Model(&subscription).UpdateColumn("last_used_at", &now)
|
||||
}
|
||||
}
|
||||
return delivered, errors.Join(errs...)
|
||||
}
|
||||
|
||||
func sendWebPush(subscription database.PushSubscription, message Message) error {
|
||||
public, private, err := keys()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
payload, err := json.Marshal(message)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
response, err := webpushgo.SendNotification(payload, &webpushgo.Subscription{
|
||||
Endpoint: subscription.Endpoint,
|
||||
Keys: webpushgo.Keys{P256dh: subscription.P256dh, Auth: subscription.Auth},
|
||||
}, &webpushgo.Options{
|
||||
HTTPClient: &http.Client{Timeout: 15 * time.Second},
|
||||
Subscriber: subscriber(),
|
||||
VAPIDPublicKey: public,
|
||||
VAPIDPrivateKey: private,
|
||||
TTL: 24 * 60 * 60,
|
||||
Urgency: webpushgo.UrgencyHigh,
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer response.Body.Close()
|
||||
switch {
|
||||
case response.StatusCode == http.StatusNotFound || response.StatusCode == http.StatusGone:
|
||||
return ErrGone
|
||||
case response.StatusCode >= 300:
|
||||
body, _ := io.ReadAll(io.LimitReader(response.Body, 512))
|
||||
return fmt.Errorf("push service answered %s: %s", response.Status, strings.TrimSpace(string(body)))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
@ -5,6 +5,8 @@
|
|||
// - Built assets have content hashes in their names and are cached on first use.
|
||||
// - The API is never cached; fault data always comes from the server.
|
||||
// - A new version waits until the page asks it to take over (see src/lib/pwa.ts).
|
||||
// - Web Push messages from the backend (internal/webpush) are shown as notifications; clicking one
|
||||
// opens the fault (see src/lib/push.ts for the subscription).
|
||||
|
||||
const CACHE_VERSION = "v2";
|
||||
const SHELL_CACHE = `schadensmeldung-shell-${CACHE_VERSION}`;
|
||||
|
|
@ -128,3 +130,57 @@ self.addEventListener("fetch", (event) => {
|
|||
event.respondWith(caches.match(request).then((cached) => cached || fetch(request)));
|
||||
}
|
||||
});
|
||||
|
||||
self.addEventListener("push", (event) => {
|
||||
let message = {};
|
||||
try {
|
||||
message = event.data ? event.data.json() : {};
|
||||
} catch {
|
||||
message = { body: event.data ? event.data.text() : "" };
|
||||
}
|
||||
event.waitUntil(
|
||||
self.registration.showNotification(message.title || "Schadensmeldung", {
|
||||
body: message.body || "",
|
||||
icon: "/pwa-192.png",
|
||||
badge: "/pwa-192.png",
|
||||
tag: message.tag,
|
||||
renotify: Boolean(message.tag),
|
||||
data: { url: message.url || "/" }
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
self.addEventListener("notificationclick", (event) => {
|
||||
event.notification.close();
|
||||
const target = new URL(event.notification.data?.url || "/", self.location.origin);
|
||||
// Never navigate to another origin, even if the payload says so.
|
||||
const url = target.origin === self.location.origin ? target.href : self.location.origin + "/";
|
||||
event.waitUntil(
|
||||
self.clients.matchAll({ type: "window", includeUncontrolled: true }).then(async (windows) => {
|
||||
const existing = windows.find((client) => new URL(client.url).origin === self.location.origin);
|
||||
if (existing) {
|
||||
await existing.focus();
|
||||
return existing.navigate(url).catch(() => self.clients.openWindow(url));
|
||||
}
|
||||
return self.clients.openWindow(url);
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
// Browsers may renew a subscription; register the new one for the logged-in user.
|
||||
self.addEventListener("pushsubscriptionchange", (event) => {
|
||||
const options = event.oldSubscription?.options;
|
||||
if (!options) {
|
||||
return;
|
||||
}
|
||||
event.waitUntil(
|
||||
self.registration.pushManager.subscribe(options).then((subscription) =>
|
||||
fetch("/api/v1/me/push-subscriptions", {
|
||||
method: "POST",
|
||||
credentials: "include",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify(subscription.toJSON())
|
||||
})
|
||||
)
|
||||
);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import { api, errorMessage, jsonBody } from "./lib/api";
|
|||
import { defaultBranding } from "./lib/constants";
|
||||
import { useRemoteData } from "./lib/hooks";
|
||||
import { useNotification } from "./lib/notifications";
|
||||
import { disablePush } from "./lib/push";
|
||||
import { applyUpdate, useUpdateAvailable } from "./lib/pwa";
|
||||
import { linkHandler, parseRoute, useLocation, viewPath } from "./lib/router";
|
||||
import { useTheme } from "./lib/theme";
|
||||
|
|
@ -71,6 +72,8 @@ export default function App() {
|
|||
}, [location.pathname]);
|
||||
|
||||
async function logout() {
|
||||
// The next user of a shared device must not receive this user's notifications.
|
||||
await disablePush().catch(() => undefined);
|
||||
await api("/api/v1/auth/logout", jsonBody("POST")).catch(() => undefined);
|
||||
window.location.replace("/logged-out");
|
||||
}
|
||||
|
|
@ -215,6 +218,8 @@ export default function App() {
|
|||
{route.view === "settings" ? <SettingsView
|
||||
user={user}
|
||||
mpFeuerEnabled={authConfig.mpFeuerEnabled}
|
||||
notificationTransports={authConfig.notificationTransports}
|
||||
webPushPublicKey={authConfig.webPushPublicKey}
|
||||
catalog={catalog.data || emptyCatalog}
|
||||
notify={notify}
|
||||
onUserUpdated={(next: User) => setAuthConfig((current) => (current ? { ...current, user: next } : current))}
|
||||
|
|
|
|||
|
|
@ -1,29 +1,57 @@
|
|||
import { useState } from "react";
|
||||
import { useEffect, useState } from "react";
|
||||
import { api, errorMessage, jsonBody } from "../lib/api";
|
||||
import type { User } from "../lib/types";
|
||||
import { formatDateTime, formatRelative } from "../lib/formatters";
|
||||
import { useRemoteData } from "../lib/hooks";
|
||||
import { currentPushSubscription, describeDevice, disablePush, enablePush, pushSupport, type PushSupport } from "../lib/push";
|
||||
import type { NotificationTransport, NotificationType, PushSubscriptionInfo, User } from "../lib/types";
|
||||
|
||||
interface NotificationSettingsProps {
|
||||
user: User;
|
||||
// Transports configured on the server.
|
||||
transports: NotificationTransport[];
|
||||
webPushPublicKey: string;
|
||||
notify: (message: string, type?: "success" | "error") => void;
|
||||
onUserUpdated: (user: User) => void;
|
||||
}
|
||||
|
||||
type Setting = "mailNotifications" | "assignmentMails";
|
||||
const notificationTypes: { type: NotificationType; label: string; description: string }[] = [
|
||||
{
|
||||
type: "newFault",
|
||||
label: "Neue Meldungen",
|
||||
description: "für Verantwortlichkeiten, deren zuständiger Gruppe du angehörst"
|
||||
},
|
||||
{
|
||||
type: "assigned",
|
||||
label: "Zuweisungen",
|
||||
description: "wenn dir jemand anderes eine Meldung zuweist"
|
||||
}
|
||||
];
|
||||
|
||||
const messages: Record<Setting, [enabled: string, disabled: string]> = {
|
||||
mailNotifications: ["E-Mails bei neuen Meldungen aktiviert.", "E-Mails bei neuen Meldungen deaktiviert."],
|
||||
assignmentMails: ["E-Mails bei Zuweisungen aktiviert.", "E-Mails bei Zuweisungen deaktiviert."]
|
||||
const transportLabels: Record<NotificationTransport, string> = {
|
||||
mail: "E-Mail",
|
||||
webpush: "Push"
|
||||
};
|
||||
|
||||
export default function NotificationSettings({ user, notify, onUserUpdated }: NotificationSettingsProps) {
|
||||
const [saving, setSaving] = useState(false);
|
||||
const supportHints: Record<Exclude<PushSupport, "supported">, string> = {
|
||||
unsupported: "Dieser Browser unterstützt keine Push-Benachrichtigungen.",
|
||||
"needs-install": "Auf iPhone und iPad funktionieren Push-Benachrichtigungen nur, wenn die App über „Teilen → Zum Home-Bildschirm“ installiert wurde.",
|
||||
"no-service-worker": "Push-Benachrichtigungen sind erst verfügbar, wenn die App vollständig geladen ist. Bitte die Seite neu laden."
|
||||
};
|
||||
|
||||
async function toggle(setting: Setting, enabled: boolean) {
|
||||
export default function NotificationSettings({ user, transports, webPushPublicKey, notify, onUserUpdated }: NotificationSettingsProps) {
|
||||
const [saving, setSaving] = useState(false);
|
||||
const pushAvailable = transports.includes("webpush") && webPushPublicKey !== "";
|
||||
|
||||
async function toggle(type: NotificationType, transport: NotificationTransport, enabled: boolean) {
|
||||
setSaving(true);
|
||||
try {
|
||||
const payload = await api<{ user: User }>("/api/v1/me/preferences", jsonBody("PUT", { [setting]: enabled }));
|
||||
const payload = await api<{ user: User }>(
|
||||
"/api/v1/me/preferences",
|
||||
jsonBody("PUT", { notifications: { [type]: { [transport]: enabled } } })
|
||||
);
|
||||
onUserUpdated(payload.user);
|
||||
notify(messages[setting][enabled ? 0 : 1]);
|
||||
const label = notificationTypes.find((entry) => entry.type === type)?.label;
|
||||
notify(`${transportLabels[transport]} bei ${label} ${enabled ? "aktiviert" : "deaktiviert"}.`);
|
||||
} catch (toggleError) {
|
||||
notify(errorMessage(toggleError), "error");
|
||||
} finally {
|
||||
|
|
@ -36,28 +64,181 @@ export default function NotificationSettings({ user, notify, onUserUpdated }: No
|
|||
<div className="panel-header">
|
||||
<h3>Benachrichtigungen</h3>
|
||||
</div>
|
||||
<p className="panel-copy">
|
||||
E-Mails werden an <strong>{user.email}</strong> gesendet. Bei neuen Meldungen erhalten alle Mitglieder der zuständigen
|
||||
Gruppen eine E-Mail; welche Verantwortlichkeiten das betrifft, legen die Admins über die OIDC-Gruppen fest.
|
||||
</p>
|
||||
<label className="toggle">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={user.mailNotifications}
|
||||
disabled={saving}
|
||||
onChange={(event) => toggle("mailNotifications", event.target.checked)}
|
||||
/>
|
||||
<span>E-Mails bei neuen Meldungen erhalten</span>
|
||||
</label>
|
||||
<label className="toggle">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={user.assignmentMails}
|
||||
disabled={saving}
|
||||
onChange={(event) => toggle("assignmentMails", event.target.checked)}
|
||||
/>
|
||||
<span>E-Mails erhalten, wenn mir jemand eine Meldung zuweist</span>
|
||||
</label>
|
||||
{transports.length === 0 ? (
|
||||
<p className="panel-copy">Auf dem Server ist derzeit kein Benachrichtigungsweg eingerichtet.</p>
|
||||
) : (
|
||||
<>
|
||||
<p className="panel-copy">
|
||||
Lege für jede Art von Benachrichtigung fest, auf welchem Weg du sie erhältst.
|
||||
{transports.includes("mail") ? (
|
||||
<>
|
||||
{" "}
|
||||
E-Mails werden an <strong>{user.email}</strong> gesendet.
|
||||
</>
|
||||
) : null}
|
||||
{pushAvailable ? " Push-Benachrichtigungen erreichen alle Geräte, auf denen du sie unten aktiviert hast." : null} Welche
|
||||
Verantwortlichkeiten dich betreffen, legen die Admins über die OIDC-Gruppen fest.
|
||||
</p>
|
||||
<div className="notification-matrix" style={{ ["--transport-count" as string]: transports.length }} role="table">
|
||||
<div role="row" className="matrix-row">
|
||||
<span role="columnheader" className="matrix-head matrix-label">
|
||||
Benachrichtigung
|
||||
</span>
|
||||
{transports.map((transport) => (
|
||||
<span role="columnheader" className="matrix-head" key={transport}>
|
||||
{transportLabels[transport]}
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
{notificationTypes.map(({ type, label, description }) => (
|
||||
<div role="row" className="matrix-row" key={type}>
|
||||
<div role="rowheader" className="matrix-label">
|
||||
<strong>{label}</strong>
|
||||
<span>{description}</span>
|
||||
</div>
|
||||
{transports.map((transport) => (
|
||||
<label role="cell" className="matrix-cell" key={transport}>
|
||||
<input
|
||||
type="checkbox"
|
||||
aria-label={`${label} per ${transportLabels[transport]}`}
|
||||
checked={user.notifications[type][transport]}
|
||||
disabled={saving}
|
||||
onChange={(event) => toggle(type, transport, event.target.checked)}
|
||||
/>
|
||||
</label>
|
||||
))}
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
{pushAvailable ? <PushDevices user={user} publicKey={webPushPublicKey} notify={notify} /> : null}
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
interface PushDevicesProps {
|
||||
user: User;
|
||||
publicKey: string;
|
||||
notify: (message: string, type?: "success" | "error") => void;
|
||||
}
|
||||
|
||||
// PushDevices enables push on this device and lists all devices the user receives pushes on.
|
||||
function PushDevices({ user, publicKey, notify }: PushDevicesProps) {
|
||||
const devices = useRemoteData(
|
||||
() => api<{ subscriptions: PushSubscriptionInfo[] }>("/api/v1/me/push-subscriptions"),
|
||||
`push-subscriptions-${user.id}`
|
||||
);
|
||||
const [support, setSupport] = useState<PushSupport | null>(null);
|
||||
const [endpoint, setEndpoint] = useState<string | null>(null);
|
||||
const [busy, setBusy] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
let active = true;
|
||||
(async () => {
|
||||
const result = await pushSupport();
|
||||
const subscription = result === "supported" ? await currentPushSubscription() : null;
|
||||
if (active) {
|
||||
setSupport(result);
|
||||
setEndpoint(subscription?.endpoint ?? null);
|
||||
}
|
||||
})().catch(() => setSupport("unsupported"));
|
||||
return () => {
|
||||
active = false;
|
||||
};
|
||||
}, []);
|
||||
|
||||
const list = devices.data?.subscriptions ?? [];
|
||||
// The browser may still hold a subscription the server dropped (e.g. after it expired).
|
||||
const enabledHere = endpoint !== null && list.some((device) => device.endpoint === endpoint);
|
||||
|
||||
async function run(action: () => Promise<string>) {
|
||||
setBusy(true);
|
||||
try {
|
||||
notify(await action());
|
||||
} catch (actionError) {
|
||||
notify(errorMessage(actionError), "error");
|
||||
} finally {
|
||||
setBusy(false);
|
||||
await devices.refresh(true);
|
||||
}
|
||||
}
|
||||
|
||||
const enable = () =>
|
||||
run(async () => {
|
||||
const subscription = await enablePush(publicKey);
|
||||
setEndpoint(subscription.endpoint);
|
||||
return "Push-Benachrichtigungen auf diesem Gerät aktiviert.";
|
||||
});
|
||||
|
||||
const disable = () =>
|
||||
run(async () => {
|
||||
await disablePush();
|
||||
setEndpoint(null);
|
||||
return "Push-Benachrichtigungen auf diesem Gerät deaktiviert.";
|
||||
});
|
||||
|
||||
const sendTest = () =>
|
||||
run(async () => {
|
||||
const { delivered } = await api<{ delivered: number }>("/api/v1/me/push-subscriptions/test", jsonBody("POST"));
|
||||
return delivered === 1 ? "Test-Benachrichtigung an ein Gerät gesendet." : `Test-Benachrichtigung an ${delivered} Geräte gesendet.`;
|
||||
});
|
||||
|
||||
const remove = (device: PushSubscriptionInfo) =>
|
||||
run(async () => {
|
||||
if (device.endpoint === endpoint) {
|
||||
await disablePush();
|
||||
setEndpoint(null);
|
||||
} else {
|
||||
await api(`/api/v1/me/push-subscriptions/${device.id}`, jsonBody("DELETE"));
|
||||
}
|
||||
return "Gerät entfernt.";
|
||||
});
|
||||
|
||||
return (
|
||||
<div className="push-devices">
|
||||
<div className="panel-header">
|
||||
<h4>Push-Geräte</h4>
|
||||
</div>
|
||||
{support && support !== "supported" ? <p className="panel-copy">{supportHints[support]}</p> : null}
|
||||
<div className="tracker-actions">
|
||||
{support === "supported" && enabledHere ? (
|
||||
<button type="button" className="ghost" onClick={disable} disabled={busy}>
|
||||
Auf diesem Gerät deaktivieren
|
||||
</button>
|
||||
) : null}
|
||||
{support === "supported" && !enabledHere ? (
|
||||
<button type="button" className="primary" onClick={enable} disabled={busy}>
|
||||
Auf diesem Gerät aktivieren
|
||||
</button>
|
||||
) : null}
|
||||
{list.length > 0 ? (
|
||||
<button type="button" className="ghost" onClick={sendTest} disabled={busy}>
|
||||
Test senden
|
||||
</button>
|
||||
) : null}
|
||||
</div>
|
||||
<div className="table-like compact">
|
||||
{devices.data && list.length === 0 ? <p className="empty">Noch auf keinem Gerät aktiviert.</p> : null}
|
||||
{list.map((device) => (
|
||||
<div className="history-row" key={device.id}>
|
||||
<div>
|
||||
<strong>
|
||||
{describeDevice(device.userAgent)}
|
||||
{device.endpoint === endpoint ? " (dieses Gerät)" : ""}
|
||||
</strong>
|
||||
<span>
|
||||
aktiviert {formatDateTime(device.createdAt)} · zuletzt benachrichtigt {formatRelative(device.lastUsedAt)}
|
||||
</span>
|
||||
</div>
|
||||
<div className="row-actions">
|
||||
<button type="button" className="danger" onClick={() => remove(device)} disabled={busy}>
|
||||
Entfernen
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
117
frontend/src/lib/push.ts
Normal file
117
frontend/src/lib/push.ts
Normal file
|
|
@ -0,0 +1,117 @@
|
|||
import { api, jsonBody } from "./api";
|
||||
import type { PushSubscriptionInfo } from "./types";
|
||||
|
||||
// Web Push subscriptions of this browser. The service worker (public/sw.js) shows the notifications.
|
||||
|
||||
export type PushSupport = "supported" | "unsupported" | "needs-install" | "no-service-worker";
|
||||
|
||||
function isIOS(): boolean {
|
||||
return /iPad|iPhone|iPod/.test(navigator.userAgent) || (navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1);
|
||||
}
|
||||
|
||||
function isStandalone(): boolean {
|
||||
return window.matchMedia("(display-mode: standalone)").matches || (navigator as Navigator & { standalone?: boolean }).standalone === true;
|
||||
}
|
||||
|
||||
async function registration(): Promise<ServiceWorkerRegistration | undefined> {
|
||||
if (!("serviceWorker" in navigator)) {
|
||||
return undefined;
|
||||
}
|
||||
return navigator.serviceWorker.getRegistration();
|
||||
}
|
||||
|
||||
// pushSupport reports whether this browser can receive push notifications right now.
|
||||
export async function pushSupport(): Promise<PushSupport> {
|
||||
if (!("serviceWorker" in navigator) || !("PushManager" in window) || !("Notification" in window)) {
|
||||
// Safari on iOS only offers push to apps added to the home screen.
|
||||
return isIOS() && !isStandalone() ? "needs-install" : "unsupported";
|
||||
}
|
||||
// The service worker is only registered in production builds (see pwa.ts).
|
||||
return (await registration()) ? "supported" : "no-service-worker";
|
||||
}
|
||||
|
||||
function base64UrlToBytes(value: string): Uint8Array<ArrayBuffer> {
|
||||
const base64 = (value + "=".repeat((4 - (value.length % 4)) % 4)).replace(/-/g, "+").replace(/_/g, "/");
|
||||
const raw = atob(base64);
|
||||
const bytes = new Uint8Array(raw.length);
|
||||
for (let i = 0; i < raw.length; i++) {
|
||||
bytes[i] = raw.charCodeAt(i);
|
||||
}
|
||||
return bytes;
|
||||
}
|
||||
|
||||
function sameKey(key: ArrayBuffer | null, expected: Uint8Array): boolean {
|
||||
if (!key || key.byteLength !== expected.length) {
|
||||
return false;
|
||||
}
|
||||
const actual = new Uint8Array(key);
|
||||
return actual.every((byte, index) => byte === expected[index]);
|
||||
}
|
||||
|
||||
// currentPushSubscription returns the subscription of this browser, if any.
|
||||
export async function currentPushSubscription(): Promise<PushSubscription | null> {
|
||||
const worker = await registration();
|
||||
return worker?.pushManager ? worker.pushManager.getSubscription() : null;
|
||||
}
|
||||
|
||||
// enablePush asks for permission, subscribes this browser and registers it for the current user.
|
||||
export async function enablePush(publicKey: string): Promise<PushSubscriptionInfo> {
|
||||
const permission = await Notification.requestPermission();
|
||||
if (permission !== "granted") {
|
||||
throw new Error("Benachrichtigungen wurden im Browser nicht erlaubt. Bitte in den Website-Einstellungen freigeben.");
|
||||
}
|
||||
const worker = await registration();
|
||||
if (!worker) {
|
||||
throw new Error("Der Service Worker ist nicht aktiv, bitte die Seite neu laden.");
|
||||
}
|
||||
const applicationServerKey = base64UrlToBytes(publicKey);
|
||||
let subscription = await worker.pushManager.getSubscription();
|
||||
// A subscription created with another server key cannot be used.
|
||||
if (subscription && !sameKey(subscription.options.applicationServerKey, applicationServerKey)) {
|
||||
await subscription.unsubscribe();
|
||||
subscription = null;
|
||||
}
|
||||
subscription ??= await worker.pushManager.subscribe({ userVisibleOnly: true, applicationServerKey });
|
||||
const payload = await api<{ subscription: PushSubscriptionInfo }>("/api/v1/me/push-subscriptions", jsonBody("POST", subscription.toJSON()));
|
||||
return payload.subscription;
|
||||
}
|
||||
|
||||
// disablePush removes this browser's subscription on the server and in the browser.
|
||||
export async function disablePush(): Promise<void> {
|
||||
const subscription = await currentPushSubscription();
|
||||
if (!subscription) {
|
||||
return;
|
||||
}
|
||||
const { subscriptions } = await api<{ subscriptions: PushSubscriptionInfo[] }>("/api/v1/me/push-subscriptions");
|
||||
const own = subscriptions.find((entry) => entry.endpoint === subscription.endpoint);
|
||||
if (own) {
|
||||
await api(`/api/v1/me/push-subscriptions/${own.id}`, jsonBody("DELETE"));
|
||||
}
|
||||
await subscription.unsubscribe();
|
||||
}
|
||||
|
||||
// describeDevice turns a user agent into a short German device name like "Chrome auf Android".
|
||||
export function describeDevice(userAgent: string): string {
|
||||
const browsers: [RegExp, string][] = [
|
||||
[/Edg\//, "Edge"],
|
||||
[/OPR\/|Opera/, "Opera"],
|
||||
[/SamsungBrowser/, "Samsung Internet"],
|
||||
[/Firefox\/|FxiOS/, "Firefox"],
|
||||
[/Chrome\/|CriOS/, "Chrome"],
|
||||
[/Safari\//, "Safari"]
|
||||
];
|
||||
const systems: [RegExp, string][] = [
|
||||
[/Android/, "Android"],
|
||||
[/iPhone|iPad|iPod/, "iOS"],
|
||||
[/Windows/, "Windows"],
|
||||
[/Mac OS X|Macintosh/, "macOS"],
|
||||
[/CrOS/, "ChromeOS"],
|
||||
[/Linux/, "Linux"]
|
||||
];
|
||||
const browser = browsers.find(([pattern]) => pattern.test(userAgent))?.[1];
|
||||
const system = systems.find(([pattern]) => pattern.test(userAgent))?.[1];
|
||||
if (browser && system) {
|
||||
return `${browser} auf ${system}`;
|
||||
}
|
||||
return browser || system || "Unbekanntes Gerät";
|
||||
}
|
||||
|
|
@ -19,11 +19,22 @@ export interface User {
|
|||
lastLoginAt?: string | null;
|
||||
groups: string[];
|
||||
defaultFilter: DefaultFilter;
|
||||
mailNotifications: boolean;
|
||||
assignmentMails: boolean;
|
||||
notifications: NotificationPreferences;
|
||||
mpFeuerHandzeichen: string;
|
||||
}
|
||||
|
||||
export type NotificationType = "newFault" | "assigned";
|
||||
export type NotificationTransport = "mail" | "webpush";
|
||||
export type NotificationPreferences = Record<NotificationType, Record<NotificationTransport, boolean>>;
|
||||
|
||||
export interface PushSubscriptionInfo {
|
||||
id: number;
|
||||
endpoint: string;
|
||||
userAgent: string;
|
||||
createdAt: string;
|
||||
lastUsedAt?: string | null;
|
||||
}
|
||||
|
||||
export interface GroupMembership {
|
||||
group: string;
|
||||
admin: boolean;
|
||||
|
|
@ -41,6 +52,10 @@ export interface DefaultFilter {
|
|||
export interface AuthConfig {
|
||||
oidcEnabled: boolean;
|
||||
mpFeuerEnabled: boolean;
|
||||
// Transports configured on the server; mail requires SMTP.
|
||||
notificationTransports: NotificationTransport[];
|
||||
// VAPID key for Web Push subscriptions, empty if Web Push is disabled.
|
||||
webPushPublicKey: string;
|
||||
user?: User | null;
|
||||
branding: Branding;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -592,6 +592,52 @@ p {
|
|||
width: auto;
|
||||
}
|
||||
|
||||
.notification-matrix {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr) repeat(var(--transport-count), minmax(4rem, auto));
|
||||
gap: 0.75rem 1rem;
|
||||
align-items: center;
|
||||
margin-top: 1rem;
|
||||
}
|
||||
|
||||
.notification-matrix .matrix-row {
|
||||
display: contents;
|
||||
}
|
||||
|
||||
.notification-matrix .matrix-head {
|
||||
color: var(--color-text-soft);
|
||||
font-size: 0.85rem;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.notification-matrix .matrix-label {
|
||||
display: grid;
|
||||
gap: 0.2rem;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.notification-matrix .matrix-label span {
|
||||
color: var(--color-text-soft);
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
.notification-matrix .matrix-cell {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.notification-matrix input {
|
||||
width: 1.25rem;
|
||||
height: 1.25rem;
|
||||
}
|
||||
|
||||
.push-devices {
|
||||
display: grid;
|
||||
gap: 0.75rem;
|
||||
margin-top: 1.5rem;
|
||||
}
|
||||
|
||||
.primary,
|
||||
.button-link.primary {
|
||||
background: linear-gradient(135deg, var(--color-accent), #ff7043);
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import NotificationSettings from "../components/NotificationSettings";
|
|||
import { api, errorMessage, jsonBody } from "../lib/api";
|
||||
import { formatDateTime, formatRelative } from "../lib/formatters";
|
||||
import { useRemoteData } from "../lib/hooks";
|
||||
import type { ApiToken, ApiTokenCreateResponse, Catalog, GroupMembership, User } from "../lib/types";
|
||||
import type { ApiToken, ApiTokenCreateResponse, Catalog, GroupMembership, NotificationTransport, User } from "../lib/types";
|
||||
|
||||
// describeMembership explains in German what an OIDC group grants in the application.
|
||||
function describeMembership(membership: GroupMembership): string {
|
||||
|
|
@ -26,11 +26,21 @@ interface SettingsViewProps {
|
|||
user: User;
|
||||
catalog: Catalog;
|
||||
mpFeuerEnabled: boolean;
|
||||
notificationTransports: NotificationTransport[];
|
||||
webPushPublicKey: string;
|
||||
notify: (message: string, type?: "success" | "error") => void;
|
||||
onUserUpdated: (user: User) => void;
|
||||
}
|
||||
|
||||
export default function SettingsView({ user, catalog, mpFeuerEnabled, notify, onUserUpdated }: SettingsViewProps) {
|
||||
export default function SettingsView({
|
||||
user,
|
||||
catalog,
|
||||
mpFeuerEnabled,
|
||||
notificationTransports,
|
||||
webPushPublicKey,
|
||||
notify,
|
||||
onUserUpdated
|
||||
}: SettingsViewProps) {
|
||||
const groups = useRemoteData(() => api<{ groups: GroupMembership[] }>("/api/v1/me/groups"), `groups-${user.id}`);
|
||||
const tokens = useRemoteData(() => api<{ tokens: ApiToken[] }>("/api/v1/me/api-tokens"), "tokens");
|
||||
const [tokenName, setTokenName] = useState("");
|
||||
|
|
@ -103,7 +113,13 @@ export default function SettingsView({ user, catalog, mpFeuerEnabled, notify, on
|
|||
|
||||
<DefaultFilterForm user={user} catalog={catalog} notify={notify} onUserUpdated={onUserUpdated} />
|
||||
|
||||
<NotificationSettings user={user} notify={notify} onUserUpdated={onUserUpdated} />
|
||||
<NotificationSettings
|
||||
user={user}
|
||||
transports={notificationTransports}
|
||||
webPushPublicKey={webPushPublicKey}
|
||||
notify={notify}
|
||||
onUserUpdated={onUserUpdated}
|
||||
/>
|
||||
|
||||
{mpFeuerEnabled ? <MPFeuerSettings user={user} notify={notify} onUserUpdated={onUserUpdated} /> : null}
|
||||
|
||||
|
|
|
|||
|
|
@ -1 +1,37 @@
|
|||
{"0": "Admin API Handlers", "1": "API Spec & Deployment Docs", "2": "Database Models", "3": "Route Registration", "4": "Backend Integration Tests", "5": "OIDC Auth & Sessions", "6": "Settings & Assignment UI", "7": "Fault Detail UI Components", "8": "MP-Feuer Integration", "9": "Frontend App Shell & Routing", "10": "Kiosk Dashboard & Theming", "11": "Fault Forms & Filters", "12": "Fault & Common DTOs", "13": "Fault Type Catalog", "14": "Frontend Type Definitions", "15": "User & Token DTOs", "16": "Badges & Formatters", "17": "Admin View & Branding", "18": "Brand Icons", "19": "Kiosk Clock", "20": "Swagger Docs Init", "21": "API Errors", "22": "Vite Env Types", "23": "Go Module", "24": "PWA Icon Set"}
|
||||
{
|
||||
"0": "github.com/gin-gonic/gin.Context",
|
||||
"1": "Swagger API Spec",
|
||||
"2": "user.go",
|
||||
"3": "registerRoutes",
|
||||
"4": "testing.T",
|
||||
"5": "HashToken",
|
||||
"6": "errorMessage",
|
||||
"7": "App.tsx",
|
||||
"8": "insertMangel",
|
||||
"9": "Fault",
|
||||
"10": "DashboardApp.tsx",
|
||||
"11": "webpush.go",
|
||||
"12": "fault.go",
|
||||
"13": "catalog.go",
|
||||
"14": "types.ts",
|
||||
"15": "Helm values.yaml",
|
||||
"16": "push.ts",
|
||||
"17": "OverviewView.tsx",
|
||||
"18": "Brand Icons",
|
||||
"19": "Fault",
|
||||
"20": "Swagger Docs Init",
|
||||
"21": "API Errors",
|
||||
"22": "Vite Env Types",
|
||||
"23": "Go Module",
|
||||
"24": "PWA Icon Set",
|
||||
"25": "resolveHandler",
|
||||
"26": "constants.ts",
|
||||
"27": "Frontend index.html (SPA shell)",
|
||||
"28": "CLAUDE.md",
|
||||
"29": "applyFaultType",
|
||||
"30": "dashboard.go",
|
||||
"32": "MustCurrentUser",
|
||||
"33": "BindJSON",
|
||||
"34": "ParseID",
|
||||
"35": "Clock.tsx"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
{"0": "0184c0ba26a96f03", "1": "36197efeb4697c8c", "2": "dd554c78dbcb87b4", "3": "0601c31138d37cc1", "4": "7a14144bfbacfc74", "5": "cf925b531e2f8301", "6": "33cd193250974902", "7": "099d77d1afda569a", "8": "1652720b1d6824ff", "9": "9e7795084cf45943", "10": "601c7957d5b76b3b", "11": "41a2b42de5fff9b4", "12": "f41c20099173f09a", "13": "417670b8e3550f05", "14": "a550ee9c6aafe2f2", "15": "3b6257e8ee1cb0ef", "16": "f715e0c350d2406a", "17": "d38ecf4363c8d6e2", "18": "c285eaa42e0bd738", "19": "e20742879db9d953", "20": "51892ab38c662c38", "21": "1630d601831e0f61", "22": "99c0fcbdc4f53a0e", "23": "ac1ca522fdc2565b", "24": "7d3726f3155634d9", "25": "bddaa0a41224ad60", "26": "0bdc582e1f64ce09", "27": "7cd2225b1595d652"}
|
||||
{"0": "91d0e7bfeee21d51", "1": "038d4c3a5df9c013", "2": "a9b5ed1c90b7edf2", "3": "264ab103b7fc88bb", "4": "2d796bdd5fd11201", "5": "5bad030b73d43f56", "6": "9b7b91e7409f8de4", "7": "4f19446b945dc493", "8": "9c4772a7b7cf85dd", "9": "a442fd11d6ca8932", "10": "b6d900707728d077", "11": "53173fa5a2ad50a6", "12": "5d2cb0cbb60ec666", "13": "dacc01c1702626ab", "14": "dcb47c9b787d7a8d", "15": "e20742879db9d953", "16": "6408443d0fed6a4d", "17": "c7a6ee91d5ae99b7", "18": "c285eaa42e0bd738", "19": "69233dcfaf6dfe99", "20": "51892ab38c662c38", "21": "1630d601831e0f61", "22": "99c0fcbdc4f53a0e", "23": "ac1ca522fdc2565b", "24": "7d3726f3155634d9", "25": "71dd480c72886adc", "26": "62b5b03f35c3bf5e", "27": "7cd2225b1595d652", "28": "6e7b82d0387bf16d", "29": "7028c7d318eef67a", "30": "2a2f7ce17131641b", "32": "8263eeac09c7e03d", "33": "a2b13ec0f2ab7497", "34": "566f6ba7a201df6a", "35": "d3dc61aee3fd8542"}
|
||||
1
graphify-out/.rebuild.lock
Normal file
1
graphify-out/.rebuild.lock
Normal file
|
|
@ -0,0 +1 @@
|
|||
197488
|
||||
37
graphify-out/2026-10-11/.graphify_labels.json
Normal file
37
graphify-out/2026-10-11/.graphify_labels.json
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
{
|
||||
"0": "github.com/gin-gonic/gin.Context",
|
||||
"1": "Swagger API Spec",
|
||||
"2": "user.go",
|
||||
"3": "registerRoutes",
|
||||
"4": "testing.T",
|
||||
"5": "HashToken",
|
||||
"6": "errorMessage",
|
||||
"7": "App.tsx",
|
||||
"8": "insertMangel",
|
||||
"9": "Fault",
|
||||
"10": "DashboardApp.tsx",
|
||||
"11": "webpush.go",
|
||||
"12": "fault.go",
|
||||
"13": "catalog.go",
|
||||
"14": "types.ts",
|
||||
"15": "Helm values.yaml",
|
||||
"16": "push.ts",
|
||||
"17": "OverviewView.tsx",
|
||||
"18": "Brand Icons",
|
||||
"19": "Fault",
|
||||
"20": "Swagger Docs Init",
|
||||
"21": "API Errors",
|
||||
"22": "Vite Env Types",
|
||||
"23": "Go Module",
|
||||
"24": "PWA Icon Set",
|
||||
"25": "resolveHandler",
|
||||
"26": "constants.ts",
|
||||
"27": "Frontend index.html (SPA shell)",
|
||||
"28": "CLAUDE.md",
|
||||
"29": "applyFaultType",
|
||||
"30": "dashboard.go",
|
||||
"32": "MustCurrentUser",
|
||||
"33": "BindJSON",
|
||||
"34": "ParseID",
|
||||
"35": "Clock.tsx"
|
||||
}
|
||||
222
graphify-out/2026-10-11/GRAPH_REPORT.md
Normal file
222
graphify-out/2026-10-11/GRAPH_REPORT.md
Normal file
|
|
@ -0,0 +1,222 @@
|
|||
# Graph Report - feuerwehr-schadensmeldung (2026-10-11)
|
||||
|
||||
## Corpus Check
|
||||
- 134 files · ~73,248 words
|
||||
- Verdict: corpus is large enough that graph structure adds value.
|
||||
|
||||
## Summary
|
||||
- 766 nodes · 2030 edges · 35 communities (32 shown, 3 thin omitted)
|
||||
- Extraction: 96% EXTRACTED · 4% INFERRED · 0% AMBIGUOUS · INFERRED: 80 edges (avg confidence: 0.81)
|
||||
- Token cost: 0 input · 0 output
|
||||
|
||||
## Graph Freshness
|
||||
- Built from commit: `81bfdeb5`
|
||||
- Run `git rev-parse HEAD` and compare to check if the graph is stale.
|
||||
- Run `graphify update .` after code changes (no API cost).
|
||||
|
||||
## Community Hubs (Navigation)
|
||||
- github.com/gin-gonic/gin.Context
|
||||
- Swagger API Spec
|
||||
- user.go
|
||||
- registerRoutes
|
||||
- testing.T
|
||||
- HashToken
|
||||
- errorMessage
|
||||
- App.tsx
|
||||
- insertMangel
|
||||
- Fault
|
||||
- DashboardApp.tsx
|
||||
- webpush.go
|
||||
- fault.go
|
||||
- catalog.go
|
||||
- types.ts
|
||||
- Helm values.yaml
|
||||
- push.ts
|
||||
- OverviewView.tsx
|
||||
- Brand Icons
|
||||
- Fault
|
||||
- Go Module
|
||||
- PWA Icon Set
|
||||
- resolveHandler
|
||||
- constants.ts
|
||||
- Frontend index.html (SPA shell)
|
||||
- CLAUDE.md
|
||||
- applyFaultType
|
||||
- dashboard.go
|
||||
- MustCurrentUser
|
||||
- BindJSON
|
||||
- ParseID
|
||||
- Clock.tsx
|
||||
|
||||
## God Nodes (most connected - your core abstractions)
|
||||
1. `errorMessage()` - 40 edges
|
||||
2. `Fault` - 34 edges
|
||||
3. `api()` - 34 edges
|
||||
4. `User` - 33 edges
|
||||
5. `jsonBody()` - 33 edges
|
||||
6. `Swagger API Spec` - 24 edges
|
||||
7. `ParseID()` - 21 edges
|
||||
8. `MustCurrentUser()` - 21 edges
|
||||
9. `useRemoteData()` - 20 edges
|
||||
10. `BindJSON()` - 19 edges
|
||||
|
||||
## Surprising Connections (you probably didn't know these)
|
||||
- `Backend Deployment` --references--> `GET /api/v1/health` [INFERRED]
|
||||
helm/templates/deployment-backend.yaml → backend/docs/swagger.yaml
|
||||
- `Backend Deployment` --references--> `GET /api/v1/health/liveness` [INFERRED]
|
||||
helm/templates/deployment-backend.yaml → backend/docs/swagger.yaml
|
||||
- `Standort mapping` --implements--> `PUT /api/v1/admin/locations/{id}/mp-feuer-mappings` [INFERRED]
|
||||
README.md → backend/docs/swagger.yaml
|
||||
- `Public dashboards` --implements--> `/api/v1/dashboard endpoints` [INFERRED]
|
||||
README.md → backend/docs/swagger.yaml
|
||||
- `Public dashboards` --implements--> `DashboardTokenAuth` [INFERRED]
|
||||
README.md → backend/docs/swagger.yaml
|
||||
|
||||
## Import Cycles
|
||||
- None detected.
|
||||
|
||||
## Hyperedges (group relationships)
|
||||
- **CI build -> Helm package -> registry publish flow** — gitlab_ci_backenddocker, gitlab_ci_frontenddocker, gitlab_ci_helm, gitlab_ci_deploy_helm, helm_chart [EXTRACTED 1.00]
|
||||
- **Kubernetes request routing (ingress, services, deployments)** — helm_templates_ingress, helm_templates_service_backend, helm_templates_service_frontend, helm_templates_deployment_backend, helm_templates_deployment_frontend [EXTRACTED 1.00]
|
||||
- **PWA / home-screen icon set sharing the Schadensmeldung brand mark** — frontend_public_pwa_192, frontend_public_pwa_512, frontend_public_pwa_maskable_512, frontend_public_apple_touch_icon, frontend_public_pwa_192_svg, frontend_public_pwa_512_svg, public_pwa_icon_set [INFERRED 0.85]
|
||||
|
||||
## Communities (35 total, 3 thin omitted)
|
||||
|
||||
### Community 0 - "github.com/gin-gonic/gin.Context"
|
||||
Cohesion: 0.18
|
||||
Nodes (21): Error(), FaultError(), ParseListQuery(), queryInt(), queryUint(), RespondFaultList(), RespondSummary(), createHandler() (+13 more)
|
||||
|
||||
### Community 1 - "Swagger API Spec"
|
||||
Cohesion: 0.08
|
||||
Nodes (36): Swagger API Spec, /api/v1/admin endpoints, PUT /api/v1/admin/locations/{id}/mp-feuer-mappings, appsettings.Branding, /api/v1/auth endpoints, BearerTokenAuth, GET /api/v1/catalog, /api/v1/dashboard endpoints (+28 more)
|
||||
|
||||
### Community 2 - "user.go"
|
||||
Cohesion: 0.13
|
||||
Nodes (25): newNotificationPreferences(), NewPushSubscription(), NewUser(), nonNil(), DefaultFilter, APITokenCreateResponse, APITokenListResponse, APITokenPayload (+17 more)
|
||||
|
||||
### Community 3 - "registerRoutes"
|
||||
Cohesion: 0.08
|
||||
Nodes (29): Register(), Register(), catalogHandler(), Register(), Register(), Register(), Register(), Register() (+21 more)
|
||||
|
||||
### Community 4 - "testing.T"
|
||||
Cohesion: 0.07
|
||||
Nodes (41): client, fakeProvider, faultList, createSession(), itoa(), setupServer(), TestFaultLifecycle(), TestFaultAssignees() (+33 more)
|
||||
|
||||
### Community 5 - "HashToken"
|
||||
Cohesion: 0.07
|
||||
Nodes (38): Claims, hybridKeySet, provider, callbackHandler(), configHandler(), loginHandler(), safeRedirectPath(), logoutHandler() (+30 more)
|
||||
|
||||
### Community 6 - "errorMessage"
|
||||
Cohesion: 0.15
|
||||
Nodes (34): DefaultFilterForm(), DefaultFilterFormProps, emptyDefaultFilter, FaultDetailDialog(), MPFeuerSettings(), MPFeuerSettingsProps, NotificationSettings(), NotificationSettingsProps (+26 more)
|
||||
|
||||
### Community 7 - "App.tsx"
|
||||
Cohesion: 0.13
|
||||
Nodes (24): App(), emptyCatalog, viewTitles, defaultBranding, Notification, useNotification(), adminPath(), AdminTab (+16 more)
|
||||
|
||||
### Community 8 - "insertMangel"
|
||||
Cohesion: 0.16
|
||||
Nodes (28): TransferToMPFeuer(), CreateMangel(), hasTransferMode(), infoText(), insertMangel(), loadColumns(), localDate(), localTime() (+20 more)
|
||||
|
||||
### Community 9 - "Fault"
|
||||
Cohesion: 0.06
|
||||
Nodes (69): APIToken, Dashboard, Fault, FaultPriority, FaultSource, FaultStatus, FaultType, Location (+61 more)
|
||||
|
||||
### Community 10 - "DashboardApp.tsx"
|
||||
Cohesion: 0.13
|
||||
Nodes (24): themeNames, ThemeToggle(), ThemeToggleProps, dashboardApi(), readStoredSecret(), storeSecret(), takeSecretFromHash(), DashboardApp() (+16 more)
|
||||
|
||||
### Community 11 - "webpush.go"
|
||||
Cohesion: 0.27
|
||||
Nodes (12): createPushSubscriptionHandler(), testPushHandler(), validPushEndpoint(), Enabled(), Message, HashEndpoint(), keys(), PublicKey() (+4 more)
|
||||
|
||||
### Community 12 - "fault.go"
|
||||
Cohesion: 0.10
|
||||
Nodes (25): usersHandler(), NewPagination(), FaultPayload, NewFaultList(), NewUserRefs(), BrandingEnvelope, BrandingPayload, CatalogRef (+17 more)
|
||||
|
||||
### Community 13 - "catalog.go"
|
||||
Cohesion: 0.20
|
||||
Nodes (16): AdminLocation(), LoadCatalog(), mappingTarget(), LocationMPFeuerMapping, CatalogItemResponse, CatalogResponse, MPFeuerTarget, NewFaultType() (+8 more)
|
||||
|
||||
### Community 14 - "types.ts"
|
||||
Cohesion: 0.08
|
||||
Nodes (30): AssigneePicker(), AssigneePickerProps, normalize(), emptyCatalogItemForm, ApiToken, ApiTokenCreateResponse, CatalogItem, CatalogItemForm (+22 more)
|
||||
|
||||
### Community 15 - "Helm values.yaml"
|
||||
Cohesion: 0.20
|
||||
Nodes (21): GET /api/v1/health, GET /api/v1/health/liveness, GitLab CI Pipeline, BackendDocker CI Job, Deploy Helm CI Job, FrontendDocker CI Job, Helm Package CI Job, Helm Chart feuerwehr-schadensmeldung (+13 more)
|
||||
|
||||
### Community 16 - "push.ts"
|
||||
Cohesion: 0.33
|
||||
Nodes (10): base64UrlToBytes(), currentPushSubscription(), disablePush(), enablePush(), isIOS(), isStandalone(), pushSupport, registration() (+2 more)
|
||||
|
||||
### Community 17 - "OverviewView.tsx"
|
||||
Cohesion: 0.11
|
||||
Nodes (34): FaultFilters(), FaultTypeChips(), FaultTypeChipsProps, entries(), Pagination(), PaginationProps, StatCard(), StatCardProps (+26 more)
|
||||
|
||||
### Community 18 - "Brand Icons"
|
||||
Cohesion: 0.32
|
||||
Nodes (8): Apple Touch Icon (PNG), Schadensmeldung Logo (logo.svg), Shield + Wrench + Warning Bar Brand Mark (fire brigade colors #F4511E->#B71C1C, #F9A825 accent), PWA Icon 192 (PNG), PWA Icon 192 (SVG), PWA Icon 512 (PNG), PWA Icon 512 (SVG), PWA Maskable Icon 512 (PNG, dark background)
|
||||
|
||||
### Community 19 - "Fault"
|
||||
Cohesion: 0.19
|
||||
Nodes (11): FaultCardProps, FaultAction, FaultDetailDialogProps, FaultFormProps, Modal(), ModalProps, RepairOrderFormProps, ResolveFormProps (+3 more)
|
||||
|
||||
### Community 25 - "resolveHandler"
|
||||
Cohesion: 0.26
|
||||
Nodes (8): createHandler(), toInput(), getHandler(), getVisible(), reopenHandler(), resolveHandler(), updateHandler(), NewFault()
|
||||
|
||||
### Community 26 - "constants.ts"
|
||||
Cohesion: 0.15
|
||||
Nodes (20): ColorBadge(), PriorityBadge(), StatusBadge(), FaultCard(), viaLabel(), FaultFiltersProps, BarcodeLookup, FaultForm() (+12 more)
|
||||
|
||||
### Community 27 - "Frontend index.html (SPA shell)"
|
||||
Cohesion: 0.67
|
||||
Nodes (3): Frontend index.html (SPA shell), PWA manifest link (manifest.webmanifest), #root mount point
|
||||
|
||||
### Community 29 - "applyFaultType"
|
||||
Cohesion: 0.31
|
||||
Nodes (8): applyFaultType(), createFaultTypeHandler(), listFaultTypesHandler(), updateFaultTypeHandler(), adminFaultType(), normalizeColor(), normalizeGroups(), CatalogItemPayload
|
||||
|
||||
### Community 30 - "dashboard.go"
|
||||
Cohesion: 0.48
|
||||
Nodes (6): DashboardEnvelope, DashboardListResponse, DashboardPayload, DashboardResponse, DashboardSecretResponse, DashboardSessionResponse
|
||||
|
||||
### Community 32 - "MustCurrentUser"
|
||||
Cohesion: 0.16
|
||||
Nodes (12): deleteUserHandler(), listUsersHandler(), createTokenHandler(), deleteTokenHandler(), listTokensHandler(), meHandler(), nonZero(), updatePreferencesHandler() (+4 more)
|
||||
|
||||
### Community 33 - "BindJSON"
|
||||
Cohesion: 0.17
|
||||
Nodes (11): getBrandingHandler(), updateBrandingHandler(), applyLocation(), createLocationHandler(), listLocationsHandler(), updateLocationHandler(), searchMPFeuerHandler(), updateLocationMappingsHandler() (+3 more)
|
||||
|
||||
### Community 34 - "ParseID"
|
||||
Cohesion: 0.23
|
||||
Nodes (13): createDashboardHandler(), deleteDashboardHandler(), listDashboardsHandler(), loadFaultTypes(), newDashboardSecret(), rotateDashboardSecretHandler(), updateDashboardHandler(), deleteFaultTypeHandler() (+5 more)
|
||||
|
||||
### Community 35 - "Clock.tsx"
|
||||
Cohesion: 0.50
|
||||
Nodes (3): Clock(), dateFormat, timeFormat
|
||||
|
||||
## Knowledge Gaps
|
||||
- **67 isolated node(s):** `jonasled.dev/jonasled/feuerwehr-schadensmeldung/backend`, `ErrorResponse`, `StatusResponse`, `BrandingPayload`, `DashboardPayload` (+62 more)
|
||||
These have ≤1 connection - possible missing edges or undocumented components.
|
||||
- **3 thin communities (<3 nodes) omitted from report** — run `graphify query` to explore isolated nodes.
|
||||
|
||||
## Suggested Questions
|
||||
_Questions this graph is uniquely positioned to answer:_
|
||||
|
||||
- **Why does `User` connect `Fault` to `MustCurrentUser`, `user.go`, `registerRoutes`, `HashToken`, `fault.go`?**
|
||||
_High betweenness centrality (0.057) - this node is a cross-community bridge._
|
||||
- **Why does `createSession()` connect `testing.T` to `Fault`, `HashToken`?**
|
||||
_High betweenness centrality (0.029) - this node is a cross-community bridge._
|
||||
- **Why does `Fault` connect `Fault` to `insertMangel`, `resolveHandler`, `fault.go`?**
|
||||
_High betweenness centrality (0.028) - this node is a cross-community bridge._
|
||||
- **What connects `jonasled.dev/jonasled/feuerwehr-schadensmeldung/backend`, `ErrorResponse`, `StatusResponse` to the rest of the system?**
|
||||
_67 weakly-connected nodes found - possible documentation gaps or missing edges._
|
||||
- **Should `Swagger API Spec` be split into smaller, more focused modules?**
|
||||
_Cohesion score 0.07657657657657657 - nodes in this community are weakly interconnected._
|
||||
- **Should `user.go` be split into smaller, more focused modules?**
|
||||
_Cohesion score 0.12615384615384614 - nodes in this community are weakly interconnected._
|
||||
- **Should `registerRoutes` be split into smaller, more focused modules?**
|
||||
_Cohesion score 0.07549361207897794 - nodes in this community are weakly interconnected._
|
||||
12
graphify-out/2026-10-11/cost.json
Normal file
12
graphify-out/2026-10-11/cost.json
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"runs": [
|
||||
{
|
||||
"date": "2026-10-11T18:00:35.054683+00:00",
|
||||
"input_tokens": 104075,
|
||||
"output_tokens": 0,
|
||||
"files": 146
|
||||
}
|
||||
],
|
||||
"total_input_tokens": 104075,
|
||||
"total_output_tokens": 0
|
||||
}
|
||||
32713
graphify-out/2026-10-11/graph.json
Normal file
32713
graphify-out/2026-10-11/graph.json
Normal file
File diff suppressed because it is too large
Load diff
762
graphify-out/2026-10-11/manifest.json
Normal file
762
graphify-out/2026-10-11/manifest.json
Normal file
|
|
@ -0,0 +1,762 @@
|
|||
{
|
||||
"backend/api/adminroutes/branding.go": {
|
||||
"mtime": 1791734107.4576664,
|
||||
"ast_hash": "a7ccc6970d5bcd4ce362ba9bc0c94864",
|
||||
"semantic_hash": "a7ccc6970d5bcd4ce362ba9bc0c94864"
|
||||
},
|
||||
"backend/api/adminroutes/dashboards.go": {
|
||||
"mtime": 1791734107.457699,
|
||||
"ast_hash": "df7b9b1c173272b9d97c3f3e85457ba0",
|
||||
"semantic_hash": "df7b9b1c173272b9d97c3f3e85457ba0"
|
||||
},
|
||||
"backend/api/adminroutes/fault_types.go": {
|
||||
"mtime": 1791734107.457699,
|
||||
"ast_hash": "bd1ba21381e53dd11d93ca18aa61834c",
|
||||
"semantic_hash": "bd1ba21381e53dd11d93ca18aa61834c"
|
||||
},
|
||||
"backend/api/adminroutes/helpers.go": {
|
||||
"mtime": 1791734107.457699,
|
||||
"ast_hash": "dd024422de85ea19a06b1a7482260ebe",
|
||||
"semantic_hash": "dd024422de85ea19a06b1a7482260ebe"
|
||||
},
|
||||
"backend/api/adminroutes/locations.go": {
|
||||
"mtime": 1791734107.457699,
|
||||
"ast_hash": "90d0616f8582b457eb469f5be2932499",
|
||||
"semantic_hash": "90d0616f8582b457eb469f5be2932499"
|
||||
},
|
||||
"backend/api/adminroutes/mpfeuer.go": {
|
||||
"mtime": 1791734107.457699,
|
||||
"ast_hash": "58dbf07ea832f6faca2d884a5d22e3f0",
|
||||
"semantic_hash": "58dbf07ea832f6faca2d884a5d22e3f0"
|
||||
},
|
||||
"backend/api/adminroutes/register.go": {
|
||||
"mtime": 1791734107.457699,
|
||||
"ast_hash": "8d9f1c36f7db13dc5aee505a062359fc",
|
||||
"semantic_hash": "8d9f1c36f7db13dc5aee505a062359fc"
|
||||
},
|
||||
"backend/api/adminroutes/users.go": {
|
||||
"mtime": 1791734107.457699,
|
||||
"ast_hash": "12ea0bec518c8c16d7109a39b6191528",
|
||||
"semantic_hash": "12ea0bec518c8c16d7109a39b6191528"
|
||||
},
|
||||
"backend/api/api_test.go": {
|
||||
"mtime": 1791734107.457699,
|
||||
"ast_hash": "2b9a404e62c588e849f3e47cdaa8c070",
|
||||
"semantic_hash": "2b9a404e62c588e849f3e47cdaa8c070"
|
||||
},
|
||||
"backend/api/apiutil/apiutil.go": {
|
||||
"mtime": 1791739919.70231,
|
||||
"ast_hash": "1d35dedd8ef2cfbb29298d829199a10e",
|
||||
"semantic_hash": "1d35dedd8ef2cfbb29298d829199a10e"
|
||||
},
|
||||
"backend/api/assignee_test.go": {
|
||||
"mtime": 1791741938.6401608,
|
||||
"ast_hash": "d2700ae0b2a4d378d76176020a86ccf7",
|
||||
"semantic_hash": ""
|
||||
},
|
||||
"backend/api/authroutes/callback.go": {
|
||||
"mtime": 1791734107.457699,
|
||||
"ast_hash": "a650180bbce4aa1bfc34436e798903fc",
|
||||
"semantic_hash": "a650180bbce4aa1bfc34436e798903fc"
|
||||
},
|
||||
"backend/api/authroutes/config.go": {
|
||||
"mtime": 1791741898.7634342,
|
||||
"ast_hash": "3752ad789725fca5123a5b82fe0af527",
|
||||
"semantic_hash": ""
|
||||
},
|
||||
"backend/api/authroutes/login.go": {
|
||||
"mtime": 1791734107.457951,
|
||||
"ast_hash": "aa8dd209aea68e8deac0e60c314e32eb",
|
||||
"semantic_hash": "aa8dd209aea68e8deac0e60c314e32eb"
|
||||
},
|
||||
"backend/api/authroutes/logout.go": {
|
||||
"mtime": 1791734107.457951,
|
||||
"ast_hash": "35378c0e8e31e5900d8eb0a7e18a35d7",
|
||||
"semantic_hash": "35378c0e8e31e5900d8eb0a7e18a35d7"
|
||||
},
|
||||
"backend/api/authroutes/register.go": {
|
||||
"mtime": 1791734107.457951,
|
||||
"ast_hash": "1dd70098dfdf565e08b89489808cacd0",
|
||||
"semantic_hash": "1dd70098dfdf565e08b89489808cacd0"
|
||||
},
|
||||
"backend/api/catalogroutes/register.go": {
|
||||
"mtime": 1791739934.9829698,
|
||||
"ast_hash": "558df808d719da15a7233620f1650c23",
|
||||
"semantic_hash": "558df808d719da15a7233620f1650c23"
|
||||
},
|
||||
"backend/api/catalogroutes/users.go": {
|
||||
"mtime": 1791739942.4851885,
|
||||
"ast_hash": "aa4091eafa5e842abbbe0afb2e183281",
|
||||
"semantic_hash": "aa4091eafa5e842abbbe0afb2e183281"
|
||||
},
|
||||
"backend/api/dashboardroutes/faults.go": {
|
||||
"mtime": 1791734107.457951,
|
||||
"ast_hash": "e79a92ea8591876323ed5f0417b9eb2e",
|
||||
"semantic_hash": "e79a92ea8591876323ed5f0417b9eb2e"
|
||||
},
|
||||
"backend/api/dashboardroutes/register.go": {
|
||||
"mtime": 1791734107.458079,
|
||||
"ast_hash": "b9a9256741c5a2245d097a00486f58ce",
|
||||
"semantic_hash": "b9a9256741c5a2245d097a00486f58ce"
|
||||
},
|
||||
"backend/api/dashboardroutes/session.go": {
|
||||
"mtime": 1791734107.458079,
|
||||
"ast_hash": "7082cce3b58c89d4be2483a09aeb1483",
|
||||
"semantic_hash": "7082cce3b58c89d4be2483a09aeb1483"
|
||||
},
|
||||
"backend/api/faultroutes/create.go": {
|
||||
"mtime": 1791734107.458079,
|
||||
"ast_hash": "84c6d8c99ce7b9b031c4862088c5568a",
|
||||
"semantic_hash": "84c6d8c99ce7b9b031c4862088c5568a"
|
||||
},
|
||||
"backend/api/faultroutes/delete.go": {
|
||||
"mtime": 1791734107.458147,
|
||||
"ast_hash": "c5b4ded8314b63c1e0c362afd98a7366",
|
||||
"semantic_hash": "c5b4ded8314b63c1e0c362afd98a7366"
|
||||
},
|
||||
"backend/api/faultroutes/get.go": {
|
||||
"mtime": 1791734107.458147,
|
||||
"ast_hash": "8fdd2ea990bbbe2a7a0c6348504ce7c3",
|
||||
"semantic_hash": "8fdd2ea990bbbe2a7a0c6348504ce7c3"
|
||||
},
|
||||
"backend/api/faultroutes/list.go": {
|
||||
"mtime": 1791734107.458147,
|
||||
"ast_hash": "4d10608571ce40f6136898bf6d554847",
|
||||
"semantic_hash": "4d10608571ce40f6136898bf6d554847"
|
||||
},
|
||||
"backend/api/faultroutes/register.go": {
|
||||
"mtime": 1791739337.5098598,
|
||||
"ast_hash": "2b6a178b548b9623cbd979d4f213b670",
|
||||
"semantic_hash": "2b6a178b548b9623cbd979d4f213b670"
|
||||
},
|
||||
"backend/api/faultroutes/repairorder.go": {
|
||||
"mtime": 1791739337.5092797,
|
||||
"ast_hash": "9846480fdede787d969254c28950b79e",
|
||||
"semantic_hash": "9846480fdede787d969254c28950b79e"
|
||||
},
|
||||
"backend/api/faultroutes/resolve.go": {
|
||||
"mtime": 1791734107.458147,
|
||||
"ast_hash": "4e36d00af80da5a106ca420eeb4eadbe",
|
||||
"semantic_hash": "4e36d00af80da5a106ca420eeb4eadbe"
|
||||
},
|
||||
"backend/api/faultroutes/update.go": {
|
||||
"mtime": 1791740102.468875,
|
||||
"ast_hash": "cd3bde90b675709200653753717046ab",
|
||||
"semantic_hash": "cd3bde90b675709200653753717046ab"
|
||||
},
|
||||
"backend/api/generalroutes/register.go": {
|
||||
"mtime": 1791734107.458147,
|
||||
"ast_hash": "f8555d15f85919fb47f3f0507f383a12",
|
||||
"semantic_hash": "f8555d15f85919fb47f3f0507f383a12"
|
||||
},
|
||||
"backend/api/meroutes/api_tokens.go": {
|
||||
"mtime": 1791734107.458147,
|
||||
"ast_hash": "aebd12b9a67eb3e030524ee67a0f0595",
|
||||
"semantic_hash": "aebd12b9a67eb3e030524ee67a0f0595"
|
||||
},
|
||||
"backend/api/meroutes/groups.go": {
|
||||
"mtime": 1791734107.4583547,
|
||||
"ast_hash": "4bfea179d804749eafc8e2aa6d439412",
|
||||
"semantic_hash": "4bfea179d804749eafc8e2aa6d439412"
|
||||
},
|
||||
"backend/api/meroutes/me.go": {
|
||||
"mtime": 1791734107.4583547,
|
||||
"ast_hash": "9f41e2019e171fc2e2cd8dd038cb9702",
|
||||
"semantic_hash": "9f41e2019e171fc2e2cd8dd038cb9702"
|
||||
},
|
||||
"backend/api/meroutes/preferences.go": {
|
||||
"mtime": 1791741898.7631993,
|
||||
"ast_hash": "8c747b4083723dd73079041abbda9284",
|
||||
"semantic_hash": ""
|
||||
},
|
||||
"backend/api/meroutes/register.go": {
|
||||
"mtime": 1791741898.7633417,
|
||||
"ast_hash": "829b071acba30ca1bcd3975cf5301b33",
|
||||
"semantic_hash": ""
|
||||
},
|
||||
"backend/api/mpfeuer_mapping_test.go": {
|
||||
"mtime": 1791734107.4583547,
|
||||
"ast_hash": "8f532c73e1345ac57e62484ff865b8d3",
|
||||
"semantic_hash": "8f532c73e1345ac57e62484ff865b8d3"
|
||||
},
|
||||
"backend/api/mpfeuerroutes/register.go": {
|
||||
"mtime": 1791734107.4583547,
|
||||
"ast_hash": "4ab1ca7bb2b736dd6fabd5fe6aeae202",
|
||||
"semantic_hash": "4ab1ca7bb2b736dd6fabd5fe6aeae202"
|
||||
},
|
||||
"backend/api/oidc_test.go": {
|
||||
"mtime": 1791734107.4583547,
|
||||
"ast_hash": "a0a2ad0dca2e0248bdd6beb363d85cab",
|
||||
"semantic_hash": "a0a2ad0dca2e0248bdd6beb363d85cab"
|
||||
},
|
||||
"backend/api/responsibility_test.go": {
|
||||
"mtime": 1791741938.6398892,
|
||||
"ast_hash": "9a08d7d6e13e5f2bf353b48dee6051b2",
|
||||
"semantic_hash": ""
|
||||
},
|
||||
"backend/api/routes.go": {
|
||||
"mtime": 1791734107.4583547,
|
||||
"ast_hash": "f21d87824e0df9b2ed175153d31907eb",
|
||||
"semantic_hash": "f21d87824e0df9b2ed175153d31907eb"
|
||||
},
|
||||
"backend/api/staticroutes/register.go": {
|
||||
"mtime": 1791734107.4583547,
|
||||
"ast_hash": "ec33c1c45b932c1226ca9ab39906d285",
|
||||
"semantic_hash": "ec33c1c45b932c1226ca9ab39906d285"
|
||||
},
|
||||
"backend/api/webserver.go": {
|
||||
"mtime": 1791734107.4583547,
|
||||
"ast_hash": "2730a3195754125ecda2505be8b768c4",
|
||||
"semantic_hash": "2730a3195754125ecda2505be8b768c4"
|
||||
},
|
||||
"backend/database/gorm.go": {
|
||||
"mtime": 1791741814.5109692,
|
||||
"ast_hash": "0bc54d853674331d90818746e3ab423f",
|
||||
"semantic_hash": ""
|
||||
},
|
||||
"backend/database/migrate.go": {
|
||||
"mtime": 1791741814.5110605,
|
||||
"ast_hash": "68408ae615101723fbf3b36f6ecbf29d",
|
||||
"semantic_hash": ""
|
||||
},
|
||||
"backend/database/models.go": {
|
||||
"mtime": 1791742003.239849,
|
||||
"ast_hash": "eebe70afae82b0999d273258b79ffb21",
|
||||
"semantic_hash": ""
|
||||
},
|
||||
"backend/database/seed.go": {
|
||||
"mtime": 1791734107.4586947,
|
||||
"ast_hash": "4f6a130c02306ed22b90a241a0f398ce",
|
||||
"semantic_hash": "4f6a130c02306ed22b90a241a0f398ce"
|
||||
},
|
||||
"backend/docs/docs.go": {
|
||||
"mtime": 1791742017.1529515,
|
||||
"ast_hash": "aeb17a21aa221f055e33606ede009432",
|
||||
"semantic_hash": ""
|
||||
},
|
||||
"backend/go.mod": {
|
||||
"mtime": 1791741930.8738563,
|
||||
"ast_hash": "9ca0f1a1cedea3c1cb31b91b30d9c6be",
|
||||
"semantic_hash": ""
|
||||
},
|
||||
"backend/internal/appsettings/appsettings.go": {
|
||||
"mtime": 1791734107.4591398,
|
||||
"ast_hash": "7bd94fdc7da5c1e704e37754f989e479",
|
||||
"semantic_hash": "7bd94fdc7da5c1e704e37754f989e479"
|
||||
},
|
||||
"backend/internal/auth/keyset.go": {
|
||||
"mtime": 1791734107.4591398,
|
||||
"ast_hash": "9f3472d882665b7d2659d9298ae6476b",
|
||||
"semantic_hash": "9f3472d882665b7d2659d9298ae6476b"
|
||||
},
|
||||
"backend/internal/auth/middleware.go": {
|
||||
"mtime": 1791734107.4591956,
|
||||
"ast_hash": "9b8fd6b78793ec9cd418c2475f3af2cf",
|
||||
"semantic_hash": "9b8fd6b78793ec9cd418c2475f3af2cf"
|
||||
},
|
||||
"backend/internal/auth/oidc.go": {
|
||||
"mtime": 1791734107.4591956,
|
||||
"ast_hash": "72316afd1a2ebd3eedb8f750fff50e44",
|
||||
"semantic_hash": "72316afd1a2ebd3eedb8f750fff50e44"
|
||||
},
|
||||
"backend/internal/auth/roles.go": {
|
||||
"mtime": 1791734107.4591956,
|
||||
"ast_hash": "60e1e89cb721311675163b846f09ddcb",
|
||||
"semantic_hash": "60e1e89cb721311675163b846f09ddcb"
|
||||
},
|
||||
"backend/internal/auth/roles_test.go": {
|
||||
"mtime": 1791734107.4591956,
|
||||
"ast_hash": "490c59f123abb76407a91b40926f1525",
|
||||
"semantic_hash": "490c59f123abb76407a91b40926f1525"
|
||||
},
|
||||
"backend/internal/auth/session.go": {
|
||||
"mtime": 1791734107.4591956,
|
||||
"ast_hash": "e9de6a4dcf55c6c9ab83bbdc483f3283",
|
||||
"semantic_hash": "e9de6a4dcf55c6c9ab83bbdc483f3283"
|
||||
},
|
||||
"backend/internal/auth/tokens.go": {
|
||||
"mtime": 1791734107.4591956,
|
||||
"ast_hash": "7772cf3d42f25618805a28b548a4d0bd",
|
||||
"semantic_hash": "7772cf3d42f25618805a28b548a4d0bd"
|
||||
},
|
||||
"backend/internal/dto/catalog.go": {
|
||||
"mtime": 1791734107.4591956,
|
||||
"ast_hash": "2eed67cc3657d045ab6baa1acdb60305",
|
||||
"semantic_hash": "2eed67cc3657d045ab6baa1acdb60305"
|
||||
},
|
||||
"backend/internal/dto/common.go": {
|
||||
"mtime": 1791734107.459341,
|
||||
"ast_hash": "8f1f8727fa84ea0086722e1116fe02c6",
|
||||
"semantic_hash": "8f1f8727fa84ea0086722e1116fe02c6"
|
||||
},
|
||||
"backend/internal/dto/dashboard.go": {
|
||||
"mtime": 1791734107.459341,
|
||||
"ast_hash": "adf0a48367b60e730ae0f485e9623e3b",
|
||||
"semantic_hash": "adf0a48367b60e730ae0f485e9623e3b"
|
||||
},
|
||||
"backend/internal/dto/fault.go": {
|
||||
"mtime": 1791739942.7829185,
|
||||
"ast_hash": "8f6c453cda54dbe579f2cbe0b5bffd80",
|
||||
"semantic_hash": "8f6c453cda54dbe579f2cbe0b5bffd80"
|
||||
},
|
||||
"backend/internal/dto/user.go": {
|
||||
"mtime": 1791741885.7214055,
|
||||
"ast_hash": "3546cae35d24134bca4b9627d568b9be",
|
||||
"semantic_hash": ""
|
||||
},
|
||||
"backend/internal/faults/errors.go": {
|
||||
"mtime": 1791739919.7018714,
|
||||
"ast_hash": "c05d64942c8570724d3f85f893566443",
|
||||
"semantic_hash": "c05d64942c8570724d3f85f893566443"
|
||||
},
|
||||
"backend/internal/faults/mpfeuer.go": {
|
||||
"mtime": 1791738923.917159,
|
||||
"ast_hash": "1ddffd6e5e05b2ff31bdd05f1091f42a",
|
||||
"semantic_hash": "1ddffd6e5e05b2ff31bdd05f1091f42a"
|
||||
},
|
||||
"backend/internal/faults/mutations.go": {
|
||||
"mtime": 1791740102.468493,
|
||||
"ast_hash": "4b3f65864317aeacbc9f1096b3d64162",
|
||||
"semantic_hash": "4b3f65864317aeacbc9f1096b3d64162"
|
||||
},
|
||||
"backend/internal/faults/query.go": {
|
||||
"mtime": 1791739919.7026927,
|
||||
"ast_hash": "8f91cc632149fc7a6bdcd493dd0d19f3",
|
||||
"semantic_hash": "8f91cc632149fc7a6bdcd493dd0d19f3"
|
||||
},
|
||||
"backend/internal/faults/visibility.go": {
|
||||
"mtime": 1791734107.4594462,
|
||||
"ast_hash": "4f5aac93f8f057c976bbf4054629fb78",
|
||||
"semantic_hash": "4f5aac93f8f057c976bbf4054629fb78"
|
||||
},
|
||||
"backend/internal/mailer/mailer.go": {
|
||||
"mtime": 1791734107.4594462,
|
||||
"ast_hash": "d484a08827b81c114d857a0ab6bbf761",
|
||||
"semantic_hash": "d484a08827b81c114d857a0ab6bbf761"
|
||||
},
|
||||
"backend/internal/mailer/mailer_test.go": {
|
||||
"mtime": 1791734107.4595816,
|
||||
"ast_hash": "8fbeaaa22198c1145813018714af0a8a",
|
||||
"semantic_hash": "8fbeaaa22198c1145813018714af0a8a"
|
||||
},
|
||||
"backend/internal/mpfeuer/mangel.go": {
|
||||
"mtime": 1791734629.431166,
|
||||
"ast_hash": "8e001b2b55737ee153b6c330cb2647ed",
|
||||
"semantic_hash": "8e001b2b55737ee153b6c330cb2647ed"
|
||||
},
|
||||
"backend/internal/mpfeuer/mapping.go": {
|
||||
"mtime": 1791734107.459662,
|
||||
"ast_hash": "90179e6e2fa5b30408e5c29fbc2636bb",
|
||||
"semantic_hash": "90179e6e2fa5b30408e5c29fbc2636bb"
|
||||
},
|
||||
"backend/internal/mpfeuer/mpfeuer.go": {
|
||||
"mtime": 1791739347.8546417,
|
||||
"ast_hash": "039435b701cd3fdb1b3ec60cc022683f",
|
||||
"semantic_hash": "039435b701cd3fdb1b3ec60cc022683f"
|
||||
},
|
||||
"backend/internal/mpfeuer/mpfeuer_integration_test.go": {
|
||||
"mtime": 1791734642.7327325,
|
||||
"ast_hash": "9fcfa7f73414432163a1680bc0fcfe5b",
|
||||
"semantic_hash": "9fcfa7f73414432163a1680bc0fcfe5b"
|
||||
},
|
||||
"backend/internal/mpfeuer/search.go": {
|
||||
"mtime": 1791734804.2082803,
|
||||
"ast_hash": "e25ee60b74043c56606ec83dbd5f944c",
|
||||
"semantic_hash": "e25ee60b74043c56606ec83dbd5f944c"
|
||||
},
|
||||
"backend/internal/notify/notify.go": {
|
||||
"mtime": 1791741885.7167108,
|
||||
"ast_hash": "94138bf7a02de75410ba1e9049512f8d",
|
||||
"semantic_hash": ""
|
||||
},
|
||||
"backend/internal/repairorder/repairorder.go": {
|
||||
"mtime": 1791739643.9659722,
|
||||
"ast_hash": "72196b655cfc27164bca563674234605",
|
||||
"semantic_hash": "72196b655cfc27164bca563674234605"
|
||||
},
|
||||
"backend/internal/repairorder/repairorder_test.go": {
|
||||
"mtime": 1791739366.801341,
|
||||
"ast_hash": "f02d3b594080278b93d8a9c9941d6a0b",
|
||||
"semantic_hash": "f02d3b594080278b93d8a9c9941d6a0b"
|
||||
},
|
||||
"backend/main.go": {
|
||||
"mtime": 1791734107.459662,
|
||||
"ast_hash": "978e4c0e72ae18dd1fa831ab941ba892",
|
||||
"semantic_hash": "978e4c0e72ae18dd1fa831ab941ba892"
|
||||
},
|
||||
"frontend/src/App.tsx": {
|
||||
"mtime": 1791742104.4695997,
|
||||
"ast_hash": "9227b36576a79e573caac66f64384501",
|
||||
"semantic_hash": ""
|
||||
},
|
||||
"frontend/src/components/AssigneePicker.tsx": {
|
||||
"mtime": 1791740441.1169918,
|
||||
"ast_hash": "3178d6493a28218b8b18f1271bd9383d",
|
||||
"semantic_hash": "3178d6493a28218b8b18f1271bd9383d"
|
||||
},
|
||||
"frontend/src/components/Badge.tsx": {
|
||||
"mtime": 1791734107.4600341,
|
||||
"ast_hash": "0defba00a4f34cb05b27208fdb131c70",
|
||||
"semantic_hash": "0defba00a4f34cb05b27208fdb131c70"
|
||||
},
|
||||
"frontend/src/components/DefaultFilterForm.tsx": {
|
||||
"mtime": 1791734107.4600587,
|
||||
"ast_hash": "2bc62cd3288a7fed173ccd32a5c95de7",
|
||||
"semantic_hash": "2bc62cd3288a7fed173ccd32a5c95de7"
|
||||
},
|
||||
"frontend/src/components/FaultCard.tsx": {
|
||||
"mtime": 1791740629.6666284,
|
||||
"ast_hash": "591c3eaf2b4836a12f6c3d3502436fd2",
|
||||
"semantic_hash": "591c3eaf2b4836a12f6c3d3502436fd2"
|
||||
},
|
||||
"frontend/src/components/FaultDetailDialog.tsx": {
|
||||
"mtime": 1791740620.2902248,
|
||||
"ast_hash": "0395f54aef018a0e3fe4c62945606461",
|
||||
"semantic_hash": "0395f54aef018a0e3fe4c62945606461"
|
||||
},
|
||||
"frontend/src/components/FaultFilters.tsx": {
|
||||
"mtime": 1791734107.4600587,
|
||||
"ast_hash": "36b973be0c9758d52d0339467c161f2c",
|
||||
"semantic_hash": "36b973be0c9758d52d0339467c161f2c"
|
||||
},
|
||||
"frontend/src/components/FaultForm.tsx": {
|
||||
"mtime": 1791740629.6672328,
|
||||
"ast_hash": "596e91d5ed0348bb6e52af351c76605d",
|
||||
"semantic_hash": "596e91d5ed0348bb6e52af351c76605d"
|
||||
},
|
||||
"frontend/src/components/FaultTypeChips.tsx": {
|
||||
"mtime": 1791734107.4600587,
|
||||
"ast_hash": "04a1040d81ba4083150a229a36804609",
|
||||
"semantic_hash": "04a1040d81ba4083150a229a36804609"
|
||||
},
|
||||
"frontend/src/components/MPFeuerSettings.tsx": {
|
||||
"mtime": 1791734107.4600587,
|
||||
"ast_hash": "77c9fae2408e1728d3b88b529b452413",
|
||||
"semantic_hash": "77c9fae2408e1728d3b88b529b452413"
|
||||
},
|
||||
"frontend/src/components/Modal.tsx": {
|
||||
"mtime": 1791734107.4600587,
|
||||
"ast_hash": "fa17c9593eee49363f1175c5daae0dfb",
|
||||
"semantic_hash": "fa17c9593eee49363f1175c5daae0dfb"
|
||||
},
|
||||
"frontend/src/components/NotificationSettings.tsx": {
|
||||
"mtime": 1791742104.4693716,
|
||||
"ast_hash": "6ee50dff5940f837f509abde71466456",
|
||||
"semantic_hash": ""
|
||||
},
|
||||
"frontend/src/components/Pagination.tsx": {
|
||||
"mtime": 1791734107.4600587,
|
||||
"ast_hash": "511075af4f11e0244498ea1d7310204e",
|
||||
"semantic_hash": "511075af4f11e0244498ea1d7310204e"
|
||||
},
|
||||
"frontend/src/components/RepairOrderForm.tsx": {
|
||||
"mtime": 1791739447.9451702,
|
||||
"ast_hash": "0ec59f93a1aeb9402f5e8490c727dce5",
|
||||
"semantic_hash": "0ec59f93a1aeb9402f5e8490c727dce5"
|
||||
},
|
||||
"frontend/src/components/ResolveForm.tsx": {
|
||||
"mtime": 1791734107.4600587,
|
||||
"ast_hash": "39fdf2c058c5a98adc318c63d8322a11",
|
||||
"semantic_hash": "39fdf2c058c5a98adc318c63d8322a11"
|
||||
},
|
||||
"frontend/src/components/StatCard.tsx": {
|
||||
"mtime": 1791734107.4600587,
|
||||
"ast_hash": "153ef59792c6d16a1e9ec7cf717cf678",
|
||||
"semantic_hash": "153ef59792c6d16a1e9ec7cf717cf678"
|
||||
},
|
||||
"frontend/src/components/ThemeToggle.tsx": {
|
||||
"mtime": 1791734107.4600587,
|
||||
"ast_hash": "6df83a44c5e09015860302fb46b454c0",
|
||||
"semantic_hash": "6df83a44c5e09015860302fb46b454c0"
|
||||
},
|
||||
"frontend/src/dashboard/Clock.tsx": {
|
||||
"mtime": 1791734107.4600587,
|
||||
"ast_hash": "952ef8f224da870dcf4309ff732a3388",
|
||||
"semantic_hash": "952ef8f224da870dcf4309ff732a3388"
|
||||
},
|
||||
"frontend/src/dashboard/DashboardApp.tsx": {
|
||||
"mtime": 1791741171.8074756,
|
||||
"ast_hash": "c9606ac689f44d1f187ae5fe40c501a9",
|
||||
"semantic_hash": "c9606ac689f44d1f187ae5fe40c501a9"
|
||||
},
|
||||
"frontend/src/dashboard/KioskView.tsx": {
|
||||
"mtime": 1791734107.4603097,
|
||||
"ast_hash": "8fd01a81f642c3d760ca41752554a01f",
|
||||
"semantic_hash": "8fd01a81f642c3d760ca41752554a01f"
|
||||
},
|
||||
"frontend/src/dashboard/RegisterScreen.tsx": {
|
||||
"mtime": 1791734107.4603097,
|
||||
"ast_hash": "f0b9fff76cc87b6e6e2999736a529c4e",
|
||||
"semantic_hash": "f0b9fff76cc87b6e6e2999736a529c4e"
|
||||
},
|
||||
"frontend/src/dashboard/dashboardApi.ts": {
|
||||
"mtime": 1791734107.4603097,
|
||||
"ast_hash": "dce603363a4db766210031c65e7e41ee",
|
||||
"semantic_hash": "dce603363a4db766210031c65e7e41ee"
|
||||
},
|
||||
"frontend/src/lib/api.ts": {
|
||||
"mtime": 1791739434.1608331,
|
||||
"ast_hash": "fd8ac3cd5df596201eee0273f2cf8e68",
|
||||
"semantic_hash": "fd8ac3cd5df596201eee0273f2cf8e68"
|
||||
},
|
||||
"frontend/src/lib/constants.ts": {
|
||||
"mtime": 1791734107.4604146,
|
||||
"ast_hash": "abbd4acfb49cccc300bbb94ddeeefc16",
|
||||
"semantic_hash": "abbd4acfb49cccc300bbb94ddeeefc16"
|
||||
},
|
||||
"frontend/src/lib/faultApi.ts": {
|
||||
"mtime": 1791740015.9739907,
|
||||
"ast_hash": "954270d7a93982cbb2b369424f514429",
|
||||
"semantic_hash": "954270d7a93982cbb2b369424f514429"
|
||||
},
|
||||
"frontend/src/lib/formatters.ts": {
|
||||
"mtime": 1791734107.4604146,
|
||||
"ast_hash": "d974a84c8d33984583af11424ec6ddb2",
|
||||
"semantic_hash": "d974a84c8d33984583af11424ec6ddb2"
|
||||
},
|
||||
"frontend/src/lib/hooks.ts": {
|
||||
"mtime": 1791734107.4604146,
|
||||
"ast_hash": "4a4356c537c05fb2452f0ca0014eab03",
|
||||
"semantic_hash": "4a4356c537c05fb2452f0ca0014eab03"
|
||||
},
|
||||
"frontend/src/lib/notifications.ts": {
|
||||
"mtime": 1791734107.4604146,
|
||||
"ast_hash": "ea7040d0f24fb84e24b9d2acaaf6e251",
|
||||
"semantic_hash": "ea7040d0f24fb84e24b9d2acaaf6e251"
|
||||
},
|
||||
"frontend/src/lib/pwa.ts": {
|
||||
"mtime": 1791741322.1103435,
|
||||
"ast_hash": "b02025f6bea608f9c09bea1c085376ae",
|
||||
"semantic_hash": "b02025f6bea608f9c09bea1c085376ae"
|
||||
},
|
||||
"frontend/src/lib/router.ts": {
|
||||
"mtime": 1791740590.582397,
|
||||
"ast_hash": "b1b206eff7d850a3d8bab2f04fac0817",
|
||||
"semantic_hash": "b1b206eff7d850a3d8bab2f04fac0817"
|
||||
},
|
||||
"frontend/src/lib/theme.ts": {
|
||||
"mtime": 1791734107.4604146,
|
||||
"ast_hash": "e81d6e0775c74c903874ff2ae679417b",
|
||||
"semantic_hash": "e81d6e0775c74c903874ff2ae679417b"
|
||||
},
|
||||
"frontend/src/lib/types.ts": {
|
||||
"mtime": 1791742032.4784594,
|
||||
"ast_hash": "8ffc96f3fee4e8ced52a5b58f8355eb2",
|
||||
"semantic_hash": ""
|
||||
},
|
||||
"frontend/src/main.tsx": {
|
||||
"mtime": 1791740788.4451668,
|
||||
"ast_hash": "7142a9c6870914085fa2fd0142a464f8",
|
||||
"semantic_hash": "7142a9c6870914085fa2fd0142a464f8"
|
||||
},
|
||||
"frontend/src/views/AdminView.tsx": {
|
||||
"mtime": 1791740700.495374,
|
||||
"ast_hash": "101bce6201b113ccd1d02295418837f1",
|
||||
"semantic_hash": "101bce6201b113ccd1d02295418837f1"
|
||||
},
|
||||
"frontend/src/views/HistoryView.tsx": {
|
||||
"mtime": 1791740676.4053187,
|
||||
"ast_hash": "4f86faee4ce780428f874a1274ecec49",
|
||||
"semantic_hash": "4f86faee4ce780428f874a1274ecec49"
|
||||
},
|
||||
"frontend/src/views/OverviewView.tsx": {
|
||||
"mtime": 1791740676.4062672,
|
||||
"ast_hash": "094232e3b19b7a1e5ce9e2a8421247c0",
|
||||
"semantic_hash": "094232e3b19b7a1e5ce9e2a8421247c0"
|
||||
},
|
||||
"frontend/src/views/SettingsView.tsx": {
|
||||
"mtime": 1791742032.4787722,
|
||||
"ast_hash": "13b1947564e3743cc012522d084f23e9",
|
||||
"semantic_hash": ""
|
||||
},
|
||||
"frontend/src/views/admin/BrandingForm.tsx": {
|
||||
"mtime": 1791734107.4606335,
|
||||
"ast_hash": "7518bf1708b8c92b24b556af7eb32aec",
|
||||
"semantic_hash": "7518bf1708b8c92b24b556af7eb32aec"
|
||||
},
|
||||
"frontend/src/views/admin/CatalogManager.tsx": {
|
||||
"mtime": 1791734107.4607704,
|
||||
"ast_hash": "98f77ad83d73a361b37fe11d52a8d2b7",
|
||||
"semantic_hash": "98f77ad83d73a361b37fe11d52a8d2b7"
|
||||
},
|
||||
"frontend/src/views/admin/DashboardManager.tsx": {
|
||||
"mtime": 1791734107.4607704,
|
||||
"ast_hash": "be1784b263073c14b72e4942e3e68aea",
|
||||
"semantic_hash": "be1784b263073c14b72e4942e3e68aea"
|
||||
},
|
||||
"frontend/src/views/admin/LocationMappingDialog.tsx": {
|
||||
"mtime": 1791734107.4607704,
|
||||
"ast_hash": "33a909e0607f3b31db5872d61ea4a51d",
|
||||
"semantic_hash": "33a909e0607f3b31db5872d61ea4a51d"
|
||||
},
|
||||
"frontend/src/views/admin/UserList.tsx": {
|
||||
"mtime": 1791734107.4607704,
|
||||
"ast_hash": "ac47834fdc442680348a286dbbf5b22d",
|
||||
"semantic_hash": "ac47834fdc442680348a286dbbf5b22d"
|
||||
},
|
||||
"frontend/src/vite-env.d.ts": {
|
||||
"mtime": 1791734107.4607704,
|
||||
"ast_hash": "0352474ba2918efe13895edbc3780d94",
|
||||
"semantic_hash": "0352474ba2918efe13895edbc3780d94"
|
||||
},
|
||||
".gitlab-ci.yml": {
|
||||
"mtime": 1791734107.4572198,
|
||||
"ast_hash": "03f3699daffcbe8d6ccb18df978621d3",
|
||||
"semantic_hash": "03f3699daffcbe8d6ccb18df978621d3"
|
||||
},
|
||||
"README.md": {
|
||||
"mtime": 1791741356.6802206,
|
||||
"ast_hash": "5c73bb311f245887b60da4876fc1ab0e",
|
||||
"semantic_hash": "5c73bb311f245887b60da4876fc1ab0e"
|
||||
},
|
||||
"backend/docs/swagger.yaml": {
|
||||
"mtime": 1791742017.1669517,
|
||||
"ast_hash": "eb22112460cbea6596a69e97d5447cc0",
|
||||
"semantic_hash": ""
|
||||
},
|
||||
"frontend/index.html": {
|
||||
"mtime": 1791740755.3539035,
|
||||
"ast_hash": "5e8e8b34b0d6b437d57ec88443dd1769",
|
||||
"semantic_hash": "5e8e8b34b0d6b437d57ec88443dd1769"
|
||||
},
|
||||
"helm/Chart.yaml": {
|
||||
"mtime": 1791734107.4610245,
|
||||
"ast_hash": "a96b36ebc9d368a0f9b73f5c26e4c63d",
|
||||
"semantic_hash": "a96b36ebc9d368a0f9b73f5c26e4c63d"
|
||||
},
|
||||
"helm/templates/NOTES.txt": {
|
||||
"mtime": 1791734107.4610245,
|
||||
"ast_hash": "86cb086035e77251cf6960e488470836",
|
||||
"semantic_hash": "86cb086035e77251cf6960e488470836"
|
||||
},
|
||||
"helm/templates/deployment-backend.yaml": {
|
||||
"mtime": 1791734107.461081,
|
||||
"ast_hash": "fbd63b06a15dee66068ac7b3c9603d06",
|
||||
"semantic_hash": "fbd63b06a15dee66068ac7b3c9603d06"
|
||||
},
|
||||
"helm/templates/deployment-frontend.yaml": {
|
||||
"mtime": 1791734107.461081,
|
||||
"ast_hash": "584809f30283c3afb839704ad453280b",
|
||||
"semantic_hash": "584809f30283c3afb839704ad453280b"
|
||||
},
|
||||
"helm/templates/ingress.yaml": {
|
||||
"mtime": 1791734107.461081,
|
||||
"ast_hash": "c5c6a2771e53a34c3313c9c5f6822894",
|
||||
"semantic_hash": "c5c6a2771e53a34c3313c9c5f6822894"
|
||||
},
|
||||
"helm/templates/service-backend.yaml": {
|
||||
"mtime": 1791734107.461081,
|
||||
"ast_hash": "7d446c3b7b585bb0da3d13d2bb6d4c4a",
|
||||
"semantic_hash": "7d446c3b7b585bb0da3d13d2bb6d4c4a"
|
||||
},
|
||||
"helm/templates/service-frontend.yaml": {
|
||||
"mtime": 1791734107.461081,
|
||||
"ast_hash": "240e81cc3d2994a612b5609e856c99ef",
|
||||
"semantic_hash": "240e81cc3d2994a612b5609e856c99ef"
|
||||
},
|
||||
"helm/templates/tests/test-connection.yaml": {
|
||||
"mtime": 1791734107.461081,
|
||||
"ast_hash": "814013ec295927e150b5af612a461617",
|
||||
"semantic_hash": "814013ec295927e150b5af612a461617"
|
||||
},
|
||||
"helm/values.yaml": {
|
||||
"mtime": 1791734107.461081,
|
||||
"ast_hash": "290bc6e2d23f7ff7efdbb74ab7f0374f",
|
||||
"semantic_hash": "290bc6e2d23f7ff7efdbb74ab7f0374f"
|
||||
},
|
||||
"frontend/public/apple-touch-icon.png": {
|
||||
"mtime": 1791740733.8582847,
|
||||
"ast_hash": "a3ca4d243e47a2a55376d3e329303598",
|
||||
"semantic_hash": "a3ca4d243e47a2a55376d3e329303598"
|
||||
},
|
||||
"frontend/public/logo.svg": {
|
||||
"mtime": 1791734107.4598868,
|
||||
"ast_hash": "514ad610e7929b275e6f80a9deb92f5e",
|
||||
"semantic_hash": "514ad610e7929b275e6f80a9deb92f5e"
|
||||
},
|
||||
"frontend/public/pwa-192.png": {
|
||||
"mtime": 1791740733.4992921,
|
||||
"ast_hash": "26dfca9ac9d9a133ad2a09eb8ec61674",
|
||||
"semantic_hash": "26dfca9ac9d9a133ad2a09eb8ec61674"
|
||||
},
|
||||
"frontend/public/pwa-192.svg": {
|
||||
"mtime": 1791734107.4599407,
|
||||
"ast_hash": "514ad610e7929b275e6f80a9deb92f5e",
|
||||
"semantic_hash": "514ad610e7929b275e6f80a9deb92f5e"
|
||||
},
|
||||
"frontend/public/pwa-512.png": {
|
||||
"mtime": 1791740733.6040735,
|
||||
"ast_hash": "adf0d6abf05ccebe227ee474001ab4b4",
|
||||
"semantic_hash": "adf0d6abf05ccebe227ee474001ab4b4"
|
||||
},
|
||||
"frontend/public/pwa-512.svg": {
|
||||
"mtime": 1791734107.4599407,
|
||||
"ast_hash": "514ad610e7929b275e6f80a9deb92f5e",
|
||||
"semantic_hash": "514ad610e7929b275e6f80a9deb92f5e"
|
||||
},
|
||||
"frontend/public/pwa-maskable-512.png": {
|
||||
"mtime": 1791740733.7756467,
|
||||
"ast_hash": "c850f631e9951a520ac8fe69780514f4",
|
||||
"semantic_hash": "c850f631e9951a520ac8fe69780514f4"
|
||||
},
|
||||
"backend/docs/swagger.json": {
|
||||
"mtime": 1791740150.7904375,
|
||||
"ast_hash": "",
|
||||
"semantic_hash": ""
|
||||
},
|
||||
"frontend/package.json": {
|
||||
"mtime": 1791734107.4598868,
|
||||
"ast_hash": "",
|
||||
"semantic_hash": ""
|
||||
},
|
||||
"frontend/public/sw.js": {
|
||||
"mtime": 1791740788.4440753,
|
||||
"ast_hash": "",
|
||||
"semantic_hash": ""
|
||||
},
|
||||
"frontend/tsconfig.json": {
|
||||
"mtime": 1791734107.4607704,
|
||||
"ast_hash": "",
|
||||
"semantic_hash": ""
|
||||
},
|
||||
"frontend/vite.config.js": {
|
||||
"mtime": 1791734107.4607704,
|
||||
"ast_hash": "",
|
||||
"semantic_hash": ""
|
||||
},
|
||||
"renovate.json": {
|
||||
"mtime": 1791734107.461081,
|
||||
"ast_hash": "",
|
||||
"semantic_hash": ""
|
||||
},
|
||||
"CLAUDE.md": {
|
||||
"mtime": 1791741785.3939395,
|
||||
"ast_hash": "82efb97a359f5c7290bf2513d14686be",
|
||||
"semantic_hash": ""
|
||||
},
|
||||
"backend/internal/webpush/webpush.go": {
|
||||
"mtime": 1791741837.114069,
|
||||
"ast_hash": "fcf80276d6cc920453277af6c22e5dce",
|
||||
"semantic_hash": ""
|
||||
},
|
||||
"backend/api/meroutes/push.go": {
|
||||
"mtime": 1791741922.0710022,
|
||||
"ast_hash": "684f4e82af0185237a5e7e8e2b6fd210",
|
||||
"semantic_hash": ""
|
||||
},
|
||||
"backend/api/push_test.go": {
|
||||
"mtime": 1791741973.1642857,
|
||||
"ast_hash": "862ffa278ff9e526d8689d6f40be6c61",
|
||||
"semantic_hash": ""
|
||||
},
|
||||
"backend/database/migrate_test.go": {
|
||||
"mtime": 1791741991.1892557,
|
||||
"ast_hash": "b0daa963a27f1bc86b67c2e828acae28",
|
||||
"semantic_hash": ""
|
||||
},
|
||||
"frontend/src/lib/push.ts": {
|
||||
"mtime": 1791742085.0693936,
|
||||
"ast_hash": "49b75d54f9ccdf53d6418b37013b5214",
|
||||
"semantic_hash": ""
|
||||
}
|
||||
}
|
||||
|
|
@ -1,61 +1,76 @@
|
|||
# Graph Report - . (2026-10-11)
|
||||
# Graph Report - feuerwehr-schadensmeldung (2026-10-11)
|
||||
|
||||
## Corpus Check
|
||||
- 146 files · ~67,108 words
|
||||
- 134 files · ~73,639 words
|
||||
- Verdict: corpus is large enough that graph structure adds value.
|
||||
|
||||
## Summary
|
||||
- 713 nodes · 1897 edges · 25 communities (23 shown, 2 thin omitted)
|
||||
- Extraction: 95% EXTRACTED · 5% INFERRED · 0% AMBIGUOUS · INFERRED: 92 edges (avg confidence: 0.83)
|
||||
- Token cost: 104,075 input · 0 output
|
||||
- 767 nodes · 2031 edges · 35 communities (32 shown, 3 thin omitted)
|
||||
- Extraction: 96% EXTRACTED · 4% INFERRED · 0% AMBIGUOUS · INFERRED: 80 edges (avg confidence: 0.81)
|
||||
- Token cost: 0 input · 0 output
|
||||
|
||||
## Graph Freshness
|
||||
- Built from commit: `81bfdeb5`
|
||||
- Run `git rev-parse HEAD` and compare to check if the graph is stale.
|
||||
- Run `graphify update .` after code changes (no API cost).
|
||||
|
||||
## Community Hubs (Navigation)
|
||||
- Admin API Handlers
|
||||
- API Spec & Deployment Docs
|
||||
- Database Models
|
||||
- Route Registration
|
||||
- Backend Integration Tests
|
||||
- OIDC Auth & Sessions
|
||||
- Settings & Assignment UI
|
||||
- Fault Detail UI Components
|
||||
- MP-Feuer Integration
|
||||
- Frontend App Shell & Routing
|
||||
- Kiosk Dashboard & Theming
|
||||
- Fault Forms & Filters
|
||||
- Fault & Common DTOs
|
||||
- Fault Type Catalog
|
||||
- Frontend Type Definitions
|
||||
- User & Token DTOs
|
||||
- Badges & Formatters
|
||||
- Admin View & Branding
|
||||
- github.com/gin-gonic/gin.Context
|
||||
- Swagger API Spec
|
||||
- user.go
|
||||
- registerRoutes
|
||||
- testing.T
|
||||
- HashToken
|
||||
- errorMessage
|
||||
- App.tsx
|
||||
- insertMangel
|
||||
- Fault
|
||||
- DashboardApp.tsx
|
||||
- webpush.go
|
||||
- fault.go
|
||||
- catalog.go
|
||||
- types.ts
|
||||
- Helm values.yaml
|
||||
- push.ts
|
||||
- OverviewView.tsx
|
||||
- Brand Icons
|
||||
- Kiosk Clock
|
||||
- Fault
|
||||
- Go Module
|
||||
- PWA Icon Set
|
||||
- resolveHandler
|
||||
- constants.ts
|
||||
- Frontend index.html (SPA shell)
|
||||
- CLAUDE.md
|
||||
- applyFaultType
|
||||
- dashboard.go
|
||||
- MustCurrentUser
|
||||
- BindJSON
|
||||
- ParseID
|
||||
- Clock.tsx
|
||||
|
||||
## God Nodes (most connected - your core abstractions)
|
||||
1. `errorMessage()` - 39 edges
|
||||
2. `Fault` - 32 edges
|
||||
3. `api()` - 31 edges
|
||||
4. `jsonBody()` - 29 edges
|
||||
5. `User` - 26 edges
|
||||
6. `Swagger API Spec` - 25 edges
|
||||
7. `Feuerwehr Schadensmeldung README` - 24 edges
|
||||
8. `ParseID()` - 20 edges
|
||||
9. `BindJSON()` - 18 edges
|
||||
10. `useRemoteData()` - 18 edges
|
||||
1. `errorMessage()` - 40 edges
|
||||
2. `Fault` - 34 edges
|
||||
3. `api()` - 34 edges
|
||||
4. `User` - 33 edges
|
||||
5. `jsonBody()` - 33 edges
|
||||
6. `Swagger API Spec` - 24 edges
|
||||
7. `ParseID()` - 21 edges
|
||||
8. `MustCurrentUser()` - 21 edges
|
||||
9. `useRemoteData()` - 20 edges
|
||||
10. `BindJSON()` - 19 edges
|
||||
|
||||
## Surprising Connections (you probably didn't know these)
|
||||
- `OIDC Login with Role Mapping` --implements--> `/api/v1/auth endpoints` [INFERRED]
|
||||
README.md → backend/docs/swagger.yaml
|
||||
- `Backend Deployment` --implements--> `Environment Variable Configuration` [INFERRED]
|
||||
helm/templates/deployment-backend.yaml → README.md
|
||||
- `Backend Deployment` --references--> `GET /api/v1/health` [INFERRED]
|
||||
helm/templates/deployment-backend.yaml → backend/docs/swagger.yaml
|
||||
- `Backend Deployment` --references--> `GET /api/v1/health/liveness` [INFERRED]
|
||||
helm/templates/deployment-backend.yaml → backend/docs/swagger.yaml
|
||||
- `Backend Deployment` --shares_data_with--> `BackendDocker CI Job` [INFERRED]
|
||||
helm/templates/deployment-backend.yaml → .gitlab-ci.yml
|
||||
- `Standort mapping` --implements--> `PUT /api/v1/admin/locations/{id}/mp-feuer-mappings` [INFERRED]
|
||||
README.md → backend/docs/swagger.yaml
|
||||
- `Public dashboards` --implements--> `/api/v1/dashboard endpoints` [INFERRED]
|
||||
README.md → backend/docs/swagger.yaml
|
||||
- `Public dashboards` --implements--> `DashboardTokenAuth` [INFERRED]
|
||||
README.md → backend/docs/swagger.yaml
|
||||
|
||||
## Import Cycles
|
||||
- None detected.
|
||||
|
|
@ -63,110 +78,145 @@
|
|||
## Hyperedges (group relationships)
|
||||
- **CI build -> Helm package -> registry publish flow** — gitlab_ci_backenddocker, gitlab_ci_frontenddocker, gitlab_ci_helm, gitlab_ci_deploy_helm, helm_chart [EXTRACTED 1.00]
|
||||
- **Kubernetes request routing (ingress, services, deployments)** — helm_templates_ingress, helm_templates_service_backend, helm_templates_service_frontend, helm_templates_deployment_backend, helm_templates_deployment_frontend [EXTRACTED 1.00]
|
||||
- **MP-Feuer integration** — readme_mpfeuer_handover, readme_mpfeuer_barcode_lookup, readme_standort_mapping, docs_swagger_mpfeuer_device, docs_swagger_fault_mpfeuer_endpoint, docs_swagger_admin_mpfeuer_mappings [INFERRED 0.85]
|
||||
- **PWA / home-screen icon set sharing the Schadensmeldung brand mark** — frontend_public_pwa_192, frontend_public_pwa_512, frontend_public_pwa_maskable_512, frontend_public_apple_touch_icon, frontend_public_pwa_192_svg, frontend_public_pwa_512_svg, public_pwa_icon_set [INFERRED 0.85]
|
||||
|
||||
## Communities (25 total, 2 thin omitted)
|
||||
## Communities (35 total, 3 thin omitted)
|
||||
|
||||
### Community 0 - "Admin API Handlers"
|
||||
Cohesion: 0.05
|
||||
Nodes (76): getBrandingHandler(), updateBrandingHandler(), createDashboardHandler(), deleteDashboardHandler(), listDashboardsHandler(), loadFaultTypes(), newDashboardSecret(), rotateDashboardSecretHandler() (+68 more)
|
||||
### Community 0 - "github.com/gin-gonic/gin.Context"
|
||||
Cohesion: 0.18
|
||||
Nodes (21): Error(), FaultError(), ParseListQuery(), queryInt(), queryUint(), RespondFaultList(), RespondSummary(), createHandler() (+13 more)
|
||||
|
||||
### Community 1 - "API Spec & Deployment Docs"
|
||||
Cohesion: 0.05
|
||||
Nodes (72): Swagger API Spec, /api/v1/admin endpoints, PUT /api/v1/admin/locations/{id}/mp-feuer-mappings, appsettings.Branding, /api/v1/auth endpoints, BearerTokenAuth, GET /api/v1/catalog, /api/v1/dashboard endpoints (+64 more)
|
||||
|
||||
### Community 2 - "Database Models"
|
||||
### Community 1 - "Swagger API Spec"
|
||||
Cohesion: 0.07
|
||||
Nodes (56): APIToken, Dashboard, Fault, FaultPriority, FaultSource, FaultStatus, FaultType, Location (+48 more)
|
||||
Nodes (37): Swagger API Spec, /api/v1/admin endpoints, PUT /api/v1/admin/locations/{id}/mp-feuer-mappings, appsettings.Branding, /api/v1/auth endpoints, BearerTokenAuth, GET /api/v1/catalog, /api/v1/dashboard endpoints (+29 more)
|
||||
|
||||
### Community 3 - "Route Registration"
|
||||
Cohesion: 0.06
|
||||
Nodes (34): Register(), Register(), catalogHandler(), Register(), Register(), Register(), Register(), Register() (+26 more)
|
||||
### Community 2 - "user.go"
|
||||
Cohesion: 0.13
|
||||
Nodes (25): newNotificationPreferences(), NewPushSubscription(), NewUser(), nonNil(), DefaultFilter, APITokenCreateResponse, APITokenListResponse, APITokenPayload (+17 more)
|
||||
|
||||
### Community 4 - "Backend Integration Tests"
|
||||
Cohesion: 0.09
|
||||
Nodes (35): client, fakeProvider, faultList, createSession(), itoa(), setupServer(), TestFaultLifecycle(), TestFaultAssignees() (+27 more)
|
||||
|
||||
### Community 5 - "OIDC Auth & Sessions"
|
||||
### Community 3 - "registerRoutes"
|
||||
Cohesion: 0.08
|
||||
Nodes (34): Claims, provider, callbackHandler(), loginHandler(), safeRedirectPath(), logoutHandler(), groupsHandler(), newVerifier() (+26 more)
|
||||
Nodes (29): Register(), Register(), catalogHandler(), Register(), Register(), Register(), Register(), Register() (+21 more)
|
||||
|
||||
### Community 6 - "Settings & Assignment UI"
|
||||
Cohesion: 0.17
|
||||
Nodes (29): AssigneePicker(), normalize(), DefaultFilterForm(), MPFeuerSettings(), MPFeuerSettingsProps, messages, NotificationSettings(), NotificationSettingsProps (+21 more)
|
||||
### Community 4 - "testing.T"
|
||||
Cohesion: 0.07
|
||||
Nodes (41): client, fakeProvider, faultList, createSession(), itoa(), setupServer(), TestFaultLifecycle(), TestFaultAssignees() (+33 more)
|
||||
|
||||
### Community 7 - "Fault Detail UI Components"
|
||||
Cohesion: 0.09
|
||||
Nodes (30): FaultCardProps, FaultAction, FaultDetailDialog(), FaultDetailDialogProps, FaultTypeChips(), FaultTypeChipsProps, Modal(), ModalProps (+22 more)
|
||||
### Community 5 - "HashToken"
|
||||
Cohesion: 0.07
|
||||
Nodes (38): Claims, hybridKeySet, provider, callbackHandler(), configHandler(), loginHandler(), safeRedirectPath(), logoutHandler() (+30 more)
|
||||
|
||||
### Community 8 - "MP-Feuer Integration"
|
||||
Cohesion: 0.13
|
||||
Nodes (29): hybridKeySet, CreateMangel(), hasTransferMode(), infoText(), insertMangel(), loadColumns(), localDate(), localTime() (+21 more)
|
||||
|
||||
### Community 9 - "Frontend App Shell & Routing"
|
||||
Cohesion: 0.13
|
||||
Nodes (28): App(), emptyCatalog, viewTitles, KioskView(), queryString(), defaultBranding, faultPayload(), faultQuery() (+20 more)
|
||||
|
||||
### Community 10 - "Kiosk Dashboard & Theming"
|
||||
Cohesion: 0.12
|
||||
Nodes (23): themeNames, ThemeToggle(), ThemeToggleProps, dashboardApi(), readStoredSecret(), storeSecret(), takeSecretFromHash(), DashboardApp() (+15 more)
|
||||
|
||||
### Community 11 - "Fault Forms & Filters"
|
||||
Cohesion: 0.16
|
||||
Nodes (23): DefaultFilterFormProps, emptyDefaultFilter, FaultFilters(), FaultFiltersProps, BarcodeLookup, FaultForm(), FaultFormProps, FaultFormSubmit (+15 more)
|
||||
|
||||
### Community 12 - "Fault & Common DTOs"
|
||||
Cohesion: 0.10
|
||||
Nodes (24): usersHandler(), NewPagination(), FaultPayload, NewUserRefs(), BrandingEnvelope, BrandingPayload, CatalogRef, DashboardFaultPayload (+16 more)
|
||||
|
||||
### Community 13 - "Fault Type Catalog"
|
||||
### Community 6 - "errorMessage"
|
||||
Cohesion: 0.15
|
||||
Nodes (21): applyFaultType(), createFaultTypeHandler(), listFaultTypesHandler(), updateFaultTypeHandler(), adminFaultType(), normalizeColor(), normalizeGroups(), LoadCatalog() (+13 more)
|
||||
Nodes (34): DefaultFilterForm(), DefaultFilterFormProps, emptyDefaultFilter, FaultDetailDialog(), MPFeuerSettings(), MPFeuerSettingsProps, NotificationSettings(), NotificationSettingsProps (+26 more)
|
||||
|
||||
### Community 14 - "Frontend Type Definitions"
|
||||
### Community 7 - "App.tsx"
|
||||
Cohesion: 0.13
|
||||
Nodes (24): App(), emptyCatalog, viewTitles, defaultBranding, Notification, useNotification(), adminPath(), AdminTab (+16 more)
|
||||
|
||||
### Community 8 - "insertMangel"
|
||||
Cohesion: 0.16
|
||||
Nodes (28): TransferToMPFeuer(), CreateMangel(), hasTransferMode(), infoText(), insertMangel(), loadColumns(), localDate(), localTime() (+20 more)
|
||||
|
||||
### Community 9 - "Fault"
|
||||
Cohesion: 0.06
|
||||
Nodes (69): APIToken, Dashboard, Fault, FaultPriority, FaultSource, FaultStatus, FaultType, Location (+61 more)
|
||||
|
||||
### Community 10 - "DashboardApp.tsx"
|
||||
Cohesion: 0.13
|
||||
Nodes (24): themeNames, ThemeToggle(), ThemeToggleProps, dashboardApi(), readStoredSecret(), storeSecret(), takeSecretFromHash(), DashboardApp() (+16 more)
|
||||
|
||||
### Community 11 - "webpush.go"
|
||||
Cohesion: 0.27
|
||||
Nodes (12): createPushSubscriptionHandler(), testPushHandler(), validPushEndpoint(), Enabled(), Message, HashEndpoint(), keys(), PublicKey() (+4 more)
|
||||
|
||||
### Community 12 - "fault.go"
|
||||
Cohesion: 0.10
|
||||
Nodes (25): usersHandler(), NewPagination(), FaultPayload, NewFaultList(), NewUserRefs(), BrandingEnvelope, BrandingPayload, CatalogRef (+17 more)
|
||||
|
||||
### Community 13 - "catalog.go"
|
||||
Cohesion: 0.20
|
||||
Nodes (16): AdminLocation(), LoadCatalog(), mappingTarget(), LocationMPFeuerMapping, CatalogItemResponse, CatalogResponse, MPFeuerTarget, NewFaultType() (+8 more)
|
||||
|
||||
### Community 14 - "types.ts"
|
||||
Cohesion: 0.08
|
||||
Nodes (30): AssigneePicker(), AssigneePickerProps, normalize(), emptyCatalogItemForm, ApiToken, ApiTokenCreateResponse, CatalogItem, CatalogItemForm (+22 more)
|
||||
|
||||
### Community 15 - "Helm values.yaml"
|
||||
Cohesion: 0.20
|
||||
Nodes (21): GET /api/v1/health, GET /api/v1/health/liveness, GitLab CI Pipeline, BackendDocker CI Job, Deploy Helm CI Job, FrontendDocker CI Job, Helm Package CI Job, Helm Chart feuerwehr-schadensmeldung (+13 more)
|
||||
|
||||
### Community 16 - "push.ts"
|
||||
Cohesion: 0.33
|
||||
Nodes (10): base64UrlToBytes(), currentPushSubscription(), disablePush(), enablePush(), isIOS(), isStandalone(), pushSupport, registration() (+2 more)
|
||||
|
||||
### Community 17 - "OverviewView.tsx"
|
||||
Cohesion: 0.11
|
||||
Nodes (19): AssigneePickerProps, ApiToken, ApiTokenCreateResponse, CatalogItem, CatalogItemForm, CatalogRef, DashboardDevice, DashboardSecret (+11 more)
|
||||
|
||||
### Community 15 - "User & Token DTOs"
|
||||
Cohesion: 0.19
|
||||
Nodes (15): NewAPIToken(), nonNil(), DefaultFilter, APITokenCreateResponse, APITokenListResponse, APITokenPayload, APITokenResponse, AuthConfigResponse (+7 more)
|
||||
|
||||
### Community 16 - "Badges & Formatters"
|
||||
Cohesion: 0.26
|
||||
Nodes (9): ColorBadge(), PriorityBadge(), StatusBadge(), FaultCard(), viaLabel(), dateTimeFormat, formatDateTime(), relativeFormat (+1 more)
|
||||
|
||||
### Community 17 - "Admin View & Branding"
|
||||
Cohesion: 0.31
|
||||
Nodes (9): adminPath(), AdminTab, linkHandler(), Branding, BrandingForm(), BrandingFormProps, AdminView(), AdminViewProps (+1 more)
|
||||
Nodes (34): FaultFilters(), FaultTypeChips(), FaultTypeChipsProps, entries(), Pagination(), PaginationProps, StatCard(), StatCardProps (+26 more)
|
||||
|
||||
### Community 18 - "Brand Icons"
|
||||
Cohesion: 0.32
|
||||
Nodes (8): Apple Touch Icon (PNG), Schadensmeldung Logo (logo.svg), Shield + Wrench + Warning Bar Brand Mark (fire brigade colors #F4511E->#B71C1C, #F9A825 accent), PWA Icon 192 (PNG), PWA Icon 192 (SVG), PWA Icon 512 (PNG), PWA Icon 512 (SVG), PWA Maskable Icon 512 (PNG, dark background)
|
||||
|
||||
### Community 19 - "Kiosk Clock"
|
||||
### Community 19 - "Fault"
|
||||
Cohesion: 0.19
|
||||
Nodes (11): FaultCardProps, FaultAction, FaultDetailDialogProps, FaultFormProps, Modal(), ModalProps, RepairOrderFormProps, ResolveFormProps (+3 more)
|
||||
|
||||
### Community 25 - "resolveHandler"
|
||||
Cohesion: 0.26
|
||||
Nodes (8): createHandler(), toInput(), getHandler(), getVisible(), reopenHandler(), resolveHandler(), updateHandler(), NewFault()
|
||||
|
||||
### Community 26 - "constants.ts"
|
||||
Cohesion: 0.15
|
||||
Nodes (20): ColorBadge(), PriorityBadge(), StatusBadge(), FaultCard(), viaLabel(), FaultFiltersProps, BarcodeLookup, FaultForm() (+12 more)
|
||||
|
||||
### Community 27 - "Frontend index.html (SPA shell)"
|
||||
Cohesion: 0.67
|
||||
Nodes (3): Frontend index.html (SPA shell), PWA manifest link (manifest.webmanifest), #root mount point
|
||||
|
||||
### Community 29 - "applyFaultType"
|
||||
Cohesion: 0.31
|
||||
Nodes (8): applyFaultType(), createFaultTypeHandler(), listFaultTypesHandler(), updateFaultTypeHandler(), adminFaultType(), normalizeColor(), normalizeGroups(), CatalogItemPayload
|
||||
|
||||
### Community 30 - "dashboard.go"
|
||||
Cohesion: 0.48
|
||||
Nodes (6): DashboardEnvelope, DashboardListResponse, DashboardPayload, DashboardResponse, DashboardSecretResponse, DashboardSessionResponse
|
||||
|
||||
### Community 32 - "MustCurrentUser"
|
||||
Cohesion: 0.16
|
||||
Nodes (12): deleteUserHandler(), listUsersHandler(), createTokenHandler(), deleteTokenHandler(), listTokensHandler(), meHandler(), nonZero(), updatePreferencesHandler() (+4 more)
|
||||
|
||||
### Community 33 - "BindJSON"
|
||||
Cohesion: 0.17
|
||||
Nodes (11): getBrandingHandler(), updateBrandingHandler(), applyLocation(), createLocationHandler(), listLocationsHandler(), updateLocationHandler(), searchMPFeuerHandler(), updateLocationMappingsHandler() (+3 more)
|
||||
|
||||
### Community 34 - "ParseID"
|
||||
Cohesion: 0.23
|
||||
Nodes (13): createDashboardHandler(), deleteDashboardHandler(), listDashboardsHandler(), loadFaultTypes(), newDashboardSecret(), rotateDashboardSecretHandler(), updateDashboardHandler(), deleteFaultTypeHandler() (+5 more)
|
||||
|
||||
### Community 35 - "Clock.tsx"
|
||||
Cohesion: 0.50
|
||||
Nodes (3): Clock(), dateFormat, timeFormat
|
||||
|
||||
## Knowledge Gaps
|
||||
- **50 isolated node(s):** `jonasled.dev/jonasled/feuerwehr-schadensmeldung/backend`, `ErrorResponse`, `StatusResponse`, `BrandingPayload`, `DashboardPayload` (+45 more)
|
||||
- **67 isolated node(s):** `jonasled.dev/jonasled/feuerwehr-schadensmeldung/backend`, `ErrorResponse`, `StatusResponse`, `BrandingPayload`, `DashboardPayload` (+62 more)
|
||||
These have ≤1 connection - possible missing edges or undocumented components.
|
||||
- **2 thin communities (<3 nodes) omitted from report** — run `graphify query` to explore isolated nodes.
|
||||
- **3 thin communities (<3 nodes) omitted from report** — run `graphify query` to explore isolated nodes.
|
||||
|
||||
## Suggested Questions
|
||||
_Questions this graph is uniquely positioned to answer:_
|
||||
|
||||
- **Why does `User` connect `Database Models` to `Admin API Handlers`, `Route Registration`, `Fault & Common DTOs`, `OIDC Auth & Sessions`?**
|
||||
_High betweenness centrality (0.041) - this node is a cross-community bridge._
|
||||
- **Why does `Fault` connect `Database Models` to `Admin API Handlers`?**
|
||||
_High betweenness centrality (0.030) - this node is a cross-community bridge._
|
||||
- **Why does `User` connect `Fault` to `MustCurrentUser`, `user.go`, `registerRoutes`, `HashToken`, `fault.go`?**
|
||||
_High betweenness centrality (0.057) - this node is a cross-community bridge._
|
||||
- **Why does `createSession()` connect `testing.T` to `Fault`, `HashToken`?**
|
||||
_High betweenness centrality (0.028) - this node is a cross-community bridge._
|
||||
- **Why does `Fault` connect `Fault` to `insertMangel`, `resolveHandler`, `fault.go`?**
|
||||
_High betweenness centrality (0.028) - this node is a cross-community bridge._
|
||||
- **What connects `jonasled.dev/jonasled/feuerwehr-schadensmeldung/backend`, `ErrorResponse`, `StatusResponse` to the rest of the system?**
|
||||
_50 weakly-connected nodes found - possible documentation gaps or missing edges._
|
||||
- **Should `Admin API Handlers` be split into smaller, more focused modules?**
|
||||
_Cohesion score 0.05112560488112771 - nodes in this community are weakly interconnected._
|
||||
- **Should `API Spec & Deployment Docs` be split into smaller, more focused modules?**
|
||||
_Cohesion score 0.054773082942097026 - nodes in this community are weakly interconnected._
|
||||
- **Should `Database Models` be split into smaller, more focused modules?**
|
||||
_Cohesion score 0.07412008281573498 - nodes in this community are weakly interconnected._
|
||||
- **Should `Route Registration` be split into smaller, more focused modules?**
|
||||
_Cohesion score 0.061224489795918366 - nodes in this community are weakly interconnected._
|
||||
_67 weakly-connected nodes found - possible documentation gaps or missing edges._
|
||||
- **Should `Swagger API Spec` be split into smaller, more focused modules?**
|
||||
_Cohesion score 0.07396870554765292 - nodes in this community are weakly interconnected._
|
||||
- **Should `user.go` be split into smaller, more focused modules?**
|
||||
_Cohesion score 0.12615384615384614 - nodes in this community are weakly interconnected._
|
||||
- **Should `registerRoutes` be split into smaller, more focused modules?**
|
||||
_Cohesion score 0.07549361207897794 - nodes in this community are weakly interconnected._
|
||||
File diff suppressed because one or more lines are too long
|
|
@ -0,0 +1 @@
|
|||
{"nodes": [{"id": "$graphify-root$_backend_docs_docs_go", "label": "docs.go", "file_type": "code", "source_file": "backend/docs/docs.go", "source_location": "L1"}, {"id": "$graphify-root$_backend_docs_docs_init", "label": "init()", "file_type": "code", "source_file": "backend/docs/docs.go", "source_location": "L4006"}], "edges": [{"source": "$graphify-root$_backend_docs_docs_go", "target": "go_pkg_github_com_swaggo_swag", "relation": "imports_from", "confidence": "EXTRACTED", "source_file": "backend/docs/docs.go", "source_location": "L4", "weight": 1.0, "context": "import"}, {"source": "$graphify-root$_backend_docs_docs_go", "target": "$graphify-root$_backend_docs_docs_init", "relation": "contains", "confidence": "EXTRACTED", "source_file": "backend/docs/docs.go", "source_location": "L4006", "weight": 1.0}], "raw_calls": [{"caller_nid": "$graphify-root$_backend_docs_docs_init", "callee": "Register", "is_member_call": false, "language": "go", "receiver": "swag", "import_path": "github.com/swaggo/swag", "source_file": "backend/docs/docs.go", "source_location": "L4007"}, {"caller_nid": "$graphify-root$_backend_docs_docs_init", "callee": "InstanceName", "is_member_call": true, "language": "go", "receiver": null, "import_path": null, "source_file": "backend/docs/docs.go", "source_location": "L4007"}], "go_imports": {"swag": "github.com/swaggo/swag"}}
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -0,0 +1 @@
|
|||
{"nodes": [{"id": "$graphify-root$_claude_md", "label": "CLAUDE.md", "file_type": "document", "source_file": "CLAUDE.md", "source_location": "L1"}, {"id": "$graphify-root$_claude_graphify", "label": "graphify", "file_type": "document", "source_file": "CLAUDE.md", "source_location": "L1"}], "edges": [{"source": "$graphify-root$_claude_md", "target": "$graphify-root$_claude_graphify", "relation": "contains", "confidence": "EXTRACTED", "source_file": "CLAUDE.md", "source_location": "L1", "weight": 1.0}], "input_tokens": 0, "output_tokens": 0}
|
||||
File diff suppressed because one or more lines are too long
|
|
@ -0,0 +1 @@
|
|||
{"nodes": [{"id": "$graphify-root$_backend_api_meroutes_register_go", "label": "register.go", "file_type": "code", "source_file": "backend/api/meroutes/register.go", "source_location": "L1"}, {"id": "$graphify-root$_backend_api_meroutes_register_register", "label": "Register()", "file_type": "code", "source_file": "backend/api/meroutes/register.go", "source_location": "L6"}, {"id": "gin_routergroup", "label": "gin.RouterGroup", "file_type": "code", "source_file": "", "source_location": "", "origin_file": "$graphify-root$/backend/api/meroutes/register.go"}], "edges": [{"source": "$graphify-root$_backend_api_meroutes_register_go", "target": "go_pkg_github_com_gin_gonic_gin", "relation": "imports_from", "confidence": "EXTRACTED", "source_file": "backend/api/meroutes/register.go", "source_location": "L4", "weight": 1.0, "context": "import"}, {"source": "$graphify-root$_backend_api_meroutes_register_go", "target": "$graphify-root$_backend_api_meroutes_register_register", "relation": "contains", "confidence": "EXTRACTED", "source_file": "backend/api/meroutes/register.go", "source_location": "L6", "weight": 1.0}, {"source": "$graphify-root$_backend_api_meroutes_register_register", "target": "gin_routergroup", "relation": "references", "confidence": "EXTRACTED", "source_file": "backend/api/meroutes/register.go", "source_location": "L6", "weight": 1.0, "context": "parameter_type"}], "raw_calls": [{"caller_nid": "$graphify-root$_backend_api_meroutes_register_register", "callee": "Group", "is_member_call": true, "language": "go", "receiver": null, "import_path": null, "source_file": "backend/api/meroutes/register.go", "source_location": "L7"}, {"caller_nid": "$graphify-root$_backend_api_meroutes_register_register", "callee": "GET", "is_member_call": true, "language": "go", "receiver": null, "import_path": null, "source_file": "backend/api/meroutes/register.go", "source_location": "L8"}, {"caller_nid": "$graphify-root$_backend_api_meroutes_register_register", "callee": "PUT", "is_member_call": true, "language": "go", "receiver": null, "import_path": null, "source_file": "backend/api/meroutes/register.go", "source_location": "L9"}, {"caller_nid": "$graphify-root$_backend_api_meroutes_register_register", "callee": "GET", "is_member_call": true, "language": "go", "receiver": null, "import_path": null, "source_file": "backend/api/meroutes/register.go", "source_location": "L10"}, {"caller_nid": "$graphify-root$_backend_api_meroutes_register_register", "callee": "GET", "is_member_call": true, "language": "go", "receiver": null, "import_path": null, "source_file": "backend/api/meroutes/register.go", "source_location": "L11"}, {"caller_nid": "$graphify-root$_backend_api_meroutes_register_register", "callee": "POST", "is_member_call": true, "language": "go", "receiver": null, "import_path": null, "source_file": "backend/api/meroutes/register.go", "source_location": "L12"}, {"caller_nid": "$graphify-root$_backend_api_meroutes_register_register", "callee": "DELETE", "is_member_call": true, "language": "go", "receiver": null, "import_path": null, "source_file": "backend/api/meroutes/register.go", "source_location": "L13"}, {"caller_nid": "$graphify-root$_backend_api_meroutes_register_register", "callee": "GET", "is_member_call": true, "language": "go", "receiver": null, "import_path": null, "source_file": "backend/api/meroutes/register.go", "source_location": "L14"}, {"caller_nid": "$graphify-root$_backend_api_meroutes_register_register", "callee": "POST", "is_member_call": true, "language": "go", "receiver": null, "import_path": null, "source_file": "backend/api/meroutes/register.go", "source_location": "L15"}, {"caller_nid": "$graphify-root$_backend_api_meroutes_register_register", "callee": "POST", "is_member_call": true, "language": "go", "receiver": null, "import_path": null, "source_file": "backend/api/meroutes/register.go", "source_location": "L16"}, {"caller_nid": "$graphify-root$_backend_api_meroutes_register_register", "callee": "DELETE", "is_member_call": true, "language": "go", "receiver": null, "import_path": null, "source_file": "backend/api/meroutes/register.go", "source_location": "L17"}], "go_imports": {"gin": "github.com/gin-gonic/gin"}}
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1
graphify-out/cache/last_query_stamp
vendored
Normal file
1
graphify-out/cache/last_query_stamp
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
1791741711.8535383
|
||||
2
graphify-out/cache/stat-index.json
vendored
2
graphify-out/cache/stat-index.json
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
10809
graphify-out/graph.json
10809
graphify-out/graph.json
File diff suppressed because it is too large
Load diff
|
|
@ -50,9 +50,9 @@
|
|||
"semantic_hash": "1d35dedd8ef2cfbb29298d829199a10e"
|
||||
},
|
||||
"backend/api/assignee_test.go": {
|
||||
"mtime": 1791740132.0994835,
|
||||
"ast_hash": "c380dd5239be64f4422be1eff8930ee3",
|
||||
"semantic_hash": "c380dd5239be64f4422be1eff8930ee3"
|
||||
"mtime": 1791741938.6401608,
|
||||
"ast_hash": "d2700ae0b2a4d378d76176020a86ccf7",
|
||||
"semantic_hash": ""
|
||||
},
|
||||
"backend/api/authroutes/callback.go": {
|
||||
"mtime": 1791734107.457699,
|
||||
|
|
@ -60,9 +60,9 @@
|
|||
"semantic_hash": "a650180bbce4aa1bfc34436e798903fc"
|
||||
},
|
||||
"backend/api/authroutes/config.go": {
|
||||
"mtime": 1791734107.457951,
|
||||
"ast_hash": "5c19b22d52bbc3c16b3e98d169d8f078",
|
||||
"semantic_hash": "5c19b22d52bbc3c16b3e98d169d8f078"
|
||||
"mtime": 1791741898.7634342,
|
||||
"ast_hash": "3752ad789725fca5123a5b82fe0af527",
|
||||
"semantic_hash": ""
|
||||
},
|
||||
"backend/api/authroutes/login.go": {
|
||||
"mtime": 1791734107.457951,
|
||||
|
|
@ -165,14 +165,14 @@
|
|||
"semantic_hash": "9f41e2019e171fc2e2cd8dd038cb9702"
|
||||
},
|
||||
"backend/api/meroutes/preferences.go": {
|
||||
"mtime": 1791740102.4681222,
|
||||
"ast_hash": "c00c3456b0d1e0f1420fa7302371d9f9",
|
||||
"semantic_hash": "c00c3456b0d1e0f1420fa7302371d9f9"
|
||||
"mtime": 1791741898.7631993,
|
||||
"ast_hash": "8c747b4083723dd73079041abbda9284",
|
||||
"semantic_hash": ""
|
||||
},
|
||||
"backend/api/meroutes/register.go": {
|
||||
"mtime": 1791734107.4583547,
|
||||
"ast_hash": "87136ce980fc9e9ad2fafa5c028b42b2",
|
||||
"semantic_hash": "87136ce980fc9e9ad2fafa5c028b42b2"
|
||||
"mtime": 1791741898.7633417,
|
||||
"ast_hash": "829b071acba30ca1bcd3975cf5301b33",
|
||||
"semantic_hash": ""
|
||||
},
|
||||
"backend/api/mpfeuer_mapping_test.go": {
|
||||
"mtime": 1791734107.4583547,
|
||||
|
|
@ -190,9 +190,9 @@
|
|||
"semantic_hash": "a0a2ad0dca2e0248bdd6beb363d85cab"
|
||||
},
|
||||
"backend/api/responsibility_test.go": {
|
||||
"mtime": 1791734107.4583547,
|
||||
"ast_hash": "3d0b18377fae886a1974008b8e9328ee",
|
||||
"semantic_hash": "3d0b18377fae886a1974008b8e9328ee"
|
||||
"mtime": 1791741938.6398892,
|
||||
"ast_hash": "9a08d7d6e13e5f2bf353b48dee6051b2",
|
||||
"semantic_hash": ""
|
||||
},
|
||||
"backend/api/routes.go": {
|
||||
"mtime": 1791734107.4583547,
|
||||
|
|
@ -210,19 +210,19 @@
|
|||
"semantic_hash": "2730a3195754125ecda2505be8b768c4"
|
||||
},
|
||||
"backend/database/gorm.go": {
|
||||
"mtime": 1791734107.4583547,
|
||||
"ast_hash": "1d0872a24a562e0cc51f70282b2b240d",
|
||||
"semantic_hash": "1d0872a24a562e0cc51f70282b2b240d"
|
||||
"mtime": 1791741814.5109692,
|
||||
"ast_hash": "0bc54d853674331d90818746e3ab423f",
|
||||
"semantic_hash": ""
|
||||
},
|
||||
"backend/database/migrate.go": {
|
||||
"mtime": 1791734107.4586947,
|
||||
"ast_hash": "b67656b1fa7850e117696b427afbd79a",
|
||||
"semantic_hash": "b67656b1fa7850e117696b427afbd79a"
|
||||
"mtime": 1791741814.5110605,
|
||||
"ast_hash": "68408ae615101723fbf3b36f6ecbf29d",
|
||||
"semantic_hash": ""
|
||||
},
|
||||
"backend/database/models.go": {
|
||||
"mtime": 1791740102.4671562,
|
||||
"ast_hash": "2503bf701accee2249f8fbb7dc19a161",
|
||||
"semantic_hash": "2503bf701accee2249f8fbb7dc19a161"
|
||||
"mtime": 1791742003.239849,
|
||||
"ast_hash": "eebe70afae82b0999d273258b79ffb21",
|
||||
"semantic_hash": ""
|
||||
},
|
||||
"backend/database/seed.go": {
|
||||
"mtime": 1791734107.4586947,
|
||||
|
|
@ -230,14 +230,14 @@
|
|||
"semantic_hash": "4f6a130c02306ed22b90a241a0f398ce"
|
||||
},
|
||||
"backend/docs/docs.go": {
|
||||
"mtime": 1791740150.7864375,
|
||||
"ast_hash": "22606494178bde343098505e4ca62f83",
|
||||
"semantic_hash": "22606494178bde343098505e4ca62f83"
|
||||
"mtime": 1791742017.1529515,
|
||||
"ast_hash": "aeb17a21aa221f055e33606ede009432",
|
||||
"semantic_hash": ""
|
||||
},
|
||||
"backend/go.mod": {
|
||||
"mtime": 1791739272.8065789,
|
||||
"ast_hash": "09eb96e592c91fdf0ae318da211b1dd9",
|
||||
"semantic_hash": "09eb96e592c91fdf0ae318da211b1dd9"
|
||||
"mtime": 1791741930.8738563,
|
||||
"ast_hash": "9ca0f1a1cedea3c1cb31b91b30d9c6be",
|
||||
"semantic_hash": ""
|
||||
},
|
||||
"backend/internal/appsettings/appsettings.go": {
|
||||
"mtime": 1791734107.4591398,
|
||||
|
|
@ -300,9 +300,9 @@
|
|||
"semantic_hash": "8f6c453cda54dbe579f2cbe0b5bffd80"
|
||||
},
|
||||
"backend/internal/dto/user.go": {
|
||||
"mtime": 1791740102.4675567,
|
||||
"ast_hash": "152c851001ad3eacd24204322c2760f5",
|
||||
"semantic_hash": "152c851001ad3eacd24204322c2760f5"
|
||||
"mtime": 1791741885.7214055,
|
||||
"ast_hash": "3546cae35d24134bca4b9627d568b9be",
|
||||
"semantic_hash": ""
|
||||
},
|
||||
"backend/internal/faults/errors.go": {
|
||||
"mtime": 1791739919.7018714,
|
||||
|
|
@ -365,9 +365,9 @@
|
|||
"semantic_hash": "e25ee60b74043c56606ec83dbd5f944c"
|
||||
},
|
||||
"backend/internal/notify/notify.go": {
|
||||
"mtime": 1791740722.2745593,
|
||||
"ast_hash": "4a12021dc4e05829b31f66369af7f431",
|
||||
"semantic_hash": "4a12021dc4e05829b31f66369af7f431"
|
||||
"mtime": 1791741885.7167108,
|
||||
"ast_hash": "94138bf7a02de75410ba1e9049512f8d",
|
||||
"semantic_hash": ""
|
||||
},
|
||||
"backend/internal/repairorder/repairorder.go": {
|
||||
"mtime": 1791739643.9659722,
|
||||
|
|
@ -385,9 +385,9 @@
|
|||
"semantic_hash": "978e4c0e72ae18dd1fa831ab941ba892"
|
||||
},
|
||||
"frontend/src/App.tsx": {
|
||||
"mtime": 1791741302.7242854,
|
||||
"ast_hash": "b09dae06d4904bb588b4af6f9fdeacad",
|
||||
"semantic_hash": "b09dae06d4904bb588b4af6f9fdeacad"
|
||||
"mtime": 1791742104.4695997,
|
||||
"ast_hash": "9227b36576a79e573caac66f64384501",
|
||||
"semantic_hash": ""
|
||||
},
|
||||
"frontend/src/components/AssigneePicker.tsx": {
|
||||
"mtime": 1791740441.1169918,
|
||||
|
|
@ -440,9 +440,9 @@
|
|||
"semantic_hash": "fa17c9593eee49363f1175c5daae0dfb"
|
||||
},
|
||||
"frontend/src/components/NotificationSettings.tsx": {
|
||||
"mtime": 1791740145.4414506,
|
||||
"ast_hash": "63b02feb17f2ec67415016b7e8e78309",
|
||||
"semantic_hash": "63b02feb17f2ec67415016b7e8e78309"
|
||||
"mtime": 1791742104.4693716,
|
||||
"ast_hash": "6ee50dff5940f837f509abde71466456",
|
||||
"semantic_hash": ""
|
||||
},
|
||||
"frontend/src/components/Pagination.tsx": {
|
||||
"mtime": 1791734107.4600587,
|
||||
|
|
@ -540,9 +540,9 @@
|
|||
"semantic_hash": "e81d6e0775c74c903874ff2ae679417b"
|
||||
},
|
||||
"frontend/src/lib/types.ts": {
|
||||
"mtime": 1791740145.4374828,
|
||||
"ast_hash": "afa719a30daa1929accc97bacdb0bf58",
|
||||
"semantic_hash": "afa719a30daa1929accc97bacdb0bf58"
|
||||
"mtime": 1791742032.4784594,
|
||||
"ast_hash": "8ffc96f3fee4e8ced52a5b58f8355eb2",
|
||||
"semantic_hash": ""
|
||||
},
|
||||
"frontend/src/main.tsx": {
|
||||
"mtime": 1791740788.4451668,
|
||||
|
|
@ -565,9 +565,9 @@
|
|||
"semantic_hash": "094232e3b19b7a1e5ce9e2a8421247c0"
|
||||
},
|
||||
"frontend/src/views/SettingsView.tsx": {
|
||||
"mtime": 1791734107.4606335,
|
||||
"ast_hash": "c73cd72b7c47d4f304ddeeede2005b99",
|
||||
"semantic_hash": "c73cd72b7c47d4f304ddeeede2005b99"
|
||||
"mtime": 1791742032.4787722,
|
||||
"ast_hash": "13b1947564e3743cc012522d084f23e9",
|
||||
"semantic_hash": ""
|
||||
},
|
||||
"frontend/src/views/admin/BrandingForm.tsx": {
|
||||
"mtime": 1791734107.4606335,
|
||||
|
|
@ -605,14 +605,14 @@
|
|||
"semantic_hash": "03f3699daffcbe8d6ccb18df978621d3"
|
||||
},
|
||||
"README.md": {
|
||||
"mtime": 1791741356.6802206,
|
||||
"ast_hash": "5c73bb311f245887b60da4876fc1ab0e",
|
||||
"semantic_hash": "5c73bb311f245887b60da4876fc1ab0e"
|
||||
"mtime": 1791742122.9903812,
|
||||
"ast_hash": "e0c5a1bc8227c38bccebbf5b859a8892",
|
||||
"semantic_hash": ""
|
||||
},
|
||||
"backend/docs/swagger.yaml": {
|
||||
"mtime": 1791740150.7994373,
|
||||
"ast_hash": "e73839e3ede93ebe7a0216f66de9a3ef",
|
||||
"semantic_hash": "e73839e3ede93ebe7a0216f66de9a3ef"
|
||||
"mtime": 1791742017.1669517,
|
||||
"ast_hash": "eb22112460cbea6596a69e97d5447cc0",
|
||||
"semantic_hash": ""
|
||||
},
|
||||
"frontend/index.html": {
|
||||
"mtime": 1791740755.3539035,
|
||||
|
|
@ -630,9 +630,9 @@
|
|||
"semantic_hash": "86cb086035e77251cf6960e488470836"
|
||||
},
|
||||
"helm/templates/deployment-backend.yaml": {
|
||||
"mtime": 1791734107.461081,
|
||||
"ast_hash": "fbd63b06a15dee66068ac7b3c9603d06",
|
||||
"semantic_hash": "fbd63b06a15dee66068ac7b3c9603d06"
|
||||
"mtime": 1791742122.9907205,
|
||||
"ast_hash": "a4d2d908243982c1cae6a28ccfed9507",
|
||||
"semantic_hash": ""
|
||||
},
|
||||
"helm/templates/deployment-frontend.yaml": {
|
||||
"mtime": 1791734107.461081,
|
||||
|
|
@ -660,9 +660,9 @@
|
|||
"semantic_hash": "814013ec295927e150b5af612a461617"
|
||||
},
|
||||
"helm/values.yaml": {
|
||||
"mtime": 1791734107.461081,
|
||||
"ast_hash": "290bc6e2d23f7ff7efdbb74ab7f0374f",
|
||||
"semantic_hash": "290bc6e2d23f7ff7efdbb74ab7f0374f"
|
||||
"mtime": 1791742122.9905963,
|
||||
"ast_hash": "19fb726b0c13784adc2cdcc4015bb3fa",
|
||||
"semantic_hash": ""
|
||||
},
|
||||
"frontend/public/apple-touch-icon.png": {
|
||||
"mtime": 1791740733.8582847,
|
||||
|
|
@ -728,5 +728,35 @@
|
|||
"mtime": 1791734107.461081,
|
||||
"ast_hash": "",
|
||||
"semantic_hash": ""
|
||||
},
|
||||
"CLAUDE.md": {
|
||||
"mtime": 1791741785.3939395,
|
||||
"ast_hash": "82efb97a359f5c7290bf2513d14686be",
|
||||
"semantic_hash": ""
|
||||
},
|
||||
"backend/internal/webpush/webpush.go": {
|
||||
"mtime": 1791741837.114069,
|
||||
"ast_hash": "fcf80276d6cc920453277af6c22e5dce",
|
||||
"semantic_hash": ""
|
||||
},
|
||||
"backend/api/meroutes/push.go": {
|
||||
"mtime": 1791741922.0710022,
|
||||
"ast_hash": "684f4e82af0185237a5e7e8e2b6fd210",
|
||||
"semantic_hash": ""
|
||||
},
|
||||
"backend/api/push_test.go": {
|
||||
"mtime": 1791741973.1642857,
|
||||
"ast_hash": "862ffa278ff9e526d8689d6f40be6c61",
|
||||
"semantic_hash": ""
|
||||
},
|
||||
"backend/database/migrate_test.go": {
|
||||
"mtime": 1791741991.1892557,
|
||||
"ast_hash": "b0daa963a27f1bc86b67c2e828acae28",
|
||||
"semantic_hash": ""
|
||||
},
|
||||
"frontend/src/lib/push.ts": {
|
||||
"mtime": 1791742085.0693936,
|
||||
"ast_hash": "49b75d54f9ccdf53d6418b37013b5214",
|
||||
"semantic_hash": ""
|
||||
}
|
||||
}
|
||||
|
|
@ -183,6 +183,12 @@ spec:
|
|||
name: {{ if .Values.backend.smtp.existingSecret }}{{ .Values.backend.smtp.existingSecret }}{{ else }}{{ include "feuerwehr-schadensmeldung.fullname" . }}-backend{{ end }}
|
||||
key: {{ if .Values.backend.smtp.existingSecret }}{{ .Values.backend.smtp.existingSecretKey }}{{ else }}SMTP_PASSWORD{{ end }}
|
||||
{{- end }}
|
||||
- name: WEBPUSH_ENABLED
|
||||
value: {{ .Values.backend.webPush.enabled | toString | quote }}
|
||||
{{- with .Values.backend.webPush.subject }}
|
||||
- name: VAPID_SUBJECT
|
||||
value: {{ . | quote }}
|
||||
{{- end }}
|
||||
{{- with .Values.backend.extraEnv }}
|
||||
{{- toYaml . | nindent 12 }}
|
||||
{{- end }}
|
||||
|
|
|
|||
|
|
@ -104,6 +104,10 @@ backend:
|
|||
password: ""
|
||||
existingSecret: ""
|
||||
existingSecretKey: SMTP_PASSWORD
|
||||
webPush:
|
||||
enabled: true
|
||||
# Contact for push services (mailto: or https: URL), defaults to the SMTP sender or appURL.
|
||||
subject: ""
|
||||
extraEnv: []
|
||||
|
||||
frontend:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue