Fix BASE_URL config loading, add tasks/projects; robust .env path resolution
- Config: try ENV_FILE, .env, ../.env for loading; trim trailing slash from BaseURL - Log BASE_URL at server startup for verification - .env.example: document BASE_URL - Tasks, projects, tags, migrations and related API/handlers Made-with: Cursor
This commit is contained in:
117
internal/repository/task_webhooks.sql.go
Normal file
117
internal/repository/task_webhooks.sql.go
Normal file
@@ -0,0 +1,117 @@
|
||||
// Code generated by sqlc. DO NOT EDIT.
|
||||
// versions:
|
||||
// sqlc v1.30.0
|
||||
// source: task_webhooks.sql
|
||||
|
||||
package repository
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/jackc/pgx/v5/pgtype"
|
||||
)
|
||||
|
||||
const createTaskWebhook = `-- name: CreateTaskWebhook :one
|
||||
INSERT INTO task_webhooks (id, owner_id, url, events, secret)
|
||||
VALUES ($1, $2, $3, COALESCE($4, '[]'), $5)
|
||||
RETURNING id, owner_id, url, events, secret, created_at
|
||||
`
|
||||
|
||||
type CreateTaskWebhookParams struct {
|
||||
ID pgtype.UUID `json:"id"`
|
||||
OwnerID pgtype.UUID `json:"owner_id"`
|
||||
Url string `json:"url"`
|
||||
Column4 interface{} `json:"column_4"`
|
||||
Secret pgtype.Text `json:"secret"`
|
||||
}
|
||||
|
||||
func (q *Queries) CreateTaskWebhook(ctx context.Context, arg CreateTaskWebhookParams) (TaskWebhook, error) {
|
||||
row := q.db.QueryRow(ctx, createTaskWebhook,
|
||||
arg.ID,
|
||||
arg.OwnerID,
|
||||
arg.Url,
|
||||
arg.Column4,
|
||||
arg.Secret,
|
||||
)
|
||||
var i TaskWebhook
|
||||
err := row.Scan(
|
||||
&i.ID,
|
||||
&i.OwnerID,
|
||||
&i.Url,
|
||||
&i.Events,
|
||||
&i.Secret,
|
||||
&i.CreatedAt,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
|
||||
const deleteTaskWebhook = `-- name: DeleteTaskWebhook :exec
|
||||
DELETE FROM task_webhooks WHERE id = $1 AND owner_id = $2
|
||||
`
|
||||
|
||||
type DeleteTaskWebhookParams struct {
|
||||
ID pgtype.UUID `json:"id"`
|
||||
OwnerID pgtype.UUID `json:"owner_id"`
|
||||
}
|
||||
|
||||
func (q *Queries) DeleteTaskWebhook(ctx context.Context, arg DeleteTaskWebhookParams) error {
|
||||
_, err := q.db.Exec(ctx, deleteTaskWebhook, arg.ID, arg.OwnerID)
|
||||
return err
|
||||
}
|
||||
|
||||
const getTaskWebhookByID = `-- name: GetTaskWebhookByID :one
|
||||
SELECT id, owner_id, url, events, secret, created_at FROM task_webhooks
|
||||
WHERE id = $1 AND owner_id = $2
|
||||
`
|
||||
|
||||
type GetTaskWebhookByIDParams struct {
|
||||
ID pgtype.UUID `json:"id"`
|
||||
OwnerID pgtype.UUID `json:"owner_id"`
|
||||
}
|
||||
|
||||
func (q *Queries) GetTaskWebhookByID(ctx context.Context, arg GetTaskWebhookByIDParams) (TaskWebhook, error) {
|
||||
row := q.db.QueryRow(ctx, getTaskWebhookByID, arg.ID, arg.OwnerID)
|
||||
var i TaskWebhook
|
||||
err := row.Scan(
|
||||
&i.ID,
|
||||
&i.OwnerID,
|
||||
&i.Url,
|
||||
&i.Events,
|
||||
&i.Secret,
|
||||
&i.CreatedAt,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
|
||||
const listTaskWebhooksByOwner = `-- name: ListTaskWebhooksByOwner :many
|
||||
SELECT id, owner_id, url, events, secret, created_at FROM task_webhooks
|
||||
WHERE owner_id = $1
|
||||
ORDER BY created_at DESC
|
||||
`
|
||||
|
||||
func (q *Queries) ListTaskWebhooksByOwner(ctx context.Context, ownerID pgtype.UUID) ([]TaskWebhook, error) {
|
||||
rows, err := q.db.Query(ctx, listTaskWebhooksByOwner, ownerID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer rows.Close()
|
||||
items := []TaskWebhook{}
|
||||
for rows.Next() {
|
||||
var i TaskWebhook
|
||||
if err := rows.Scan(
|
||||
&i.ID,
|
||||
&i.OwnerID,
|
||||
&i.Url,
|
||||
&i.Events,
|
||||
&i.Secret,
|
||||
&i.CreatedAt,
|
||||
); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
items = append(items, i)
|
||||
}
|
||||
if err := rows.Err(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return items, nil
|
||||
}
|
||||
Reference in New Issue
Block a user