You've already forked agentic-coding-workflow
bugfix
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
// Code generated by sqlc. DO NOT EDIT.
|
||||
// versions:
|
||||
// sqlc v1.31.1
|
||||
// source: prefs.sql
|
||||
|
||||
package notifysqlc
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/jackc/pgx/v5/pgtype"
|
||||
)
|
||||
|
||||
const getNotificationPrefs = `-- name: GetNotificationPrefs :one
|
||||
SELECT user_id, email_enabled, im_enabled, im_webhook_url_enc, min_severity, updated_at
|
||||
FROM notification_prefs
|
||||
WHERE user_id = $1
|
||||
`
|
||||
|
||||
func (q *Queries) GetNotificationPrefs(ctx context.Context, userID pgtype.UUID) (NotificationPref, error) {
|
||||
row := q.db.QueryRow(ctx, getNotificationPrefs, userID)
|
||||
var i NotificationPref
|
||||
err := row.Scan(
|
||||
&i.UserID,
|
||||
&i.EmailEnabled,
|
||||
&i.ImEnabled,
|
||||
&i.ImWebhookUrlEnc,
|
||||
&i.MinSeverity,
|
||||
&i.UpdatedAt,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
|
||||
const upsertNotificationPrefs = `-- name: UpsertNotificationPrefs :exec
|
||||
INSERT INTO notification_prefs (user_id, email_enabled, im_enabled, im_webhook_url_enc, min_severity, updated_at)
|
||||
VALUES ($1, $2, $3, $4, $5, now())
|
||||
ON CONFLICT (user_id) DO UPDATE SET
|
||||
email_enabled = EXCLUDED.email_enabled,
|
||||
im_enabled = EXCLUDED.im_enabled,
|
||||
im_webhook_url_enc = EXCLUDED.im_webhook_url_enc,
|
||||
min_severity = EXCLUDED.min_severity,
|
||||
updated_at = now()
|
||||
`
|
||||
|
||||
type UpsertNotificationPrefsParams struct {
|
||||
UserID pgtype.UUID `json:"user_id"`
|
||||
EmailEnabled bool `json:"email_enabled"`
|
||||
ImEnabled bool `json:"im_enabled"`
|
||||
ImWebhookUrlEnc []byte `json:"im_webhook_url_enc"`
|
||||
MinSeverity string `json:"min_severity"`
|
||||
}
|
||||
|
||||
func (q *Queries) UpsertNotificationPrefs(ctx context.Context, arg UpsertNotificationPrefsParams) error {
|
||||
_, err := q.db.Exec(ctx, upsertNotificationPrefs,
|
||||
arg.UserID,
|
||||
arg.EmailEnabled,
|
||||
arg.ImEnabled,
|
||||
arg.ImWebhookUrlEnc,
|
||||
arg.MinSeverity,
|
||||
)
|
||||
return err
|
||||
}
|
||||
Reference in New Issue
Block a user