feat: scope articles by brand

This commit is contained in:
2026-05-20 15:37:25 +08:00
parent 5fb9d0b0dd
commit dd082e2ed1
72 changed files with 3213 additions and 432 deletions
@@ -48,13 +48,14 @@ func (q *Queries) CountArticles(ctx context.Context, arg CountArticlesParams) (i
}
const createArticle = `-- name: CreateArticle :one
INSERT INTO articles (tenant_id, source_type, template_id, kol_prompt_id, generate_status, publish_status)
VALUES ($1, $2, $3, $4, 'pending', 'unpublished')
INSERT INTO articles (tenant_id, brand_id, source_type, template_id, kol_prompt_id, generate_status, publish_status)
VALUES ($1, $2, $3, $4, $5, 'pending', 'unpublished')
RETURNING id
`
type CreateArticleParams struct {
TenantID int64 `json:"tenant_id"`
BrandID int64 `json:"brand_id"`
SourceType string `json:"source_type"`
TemplateID pgtype.Int8 `json:"template_id"`
KolPromptID pgtype.Int8 `json:"kol_prompt_id"`
@@ -63,6 +64,7 @@ type CreateArticleParams struct {
func (q *Queries) CreateArticle(ctx context.Context, arg CreateArticleParams) (int64, error) {
row := q.db.QueryRow(ctx, createArticle,
arg.TenantID,
arg.BrandID,
arg.SourceType,
arg.TemplateID,
arg.KolPromptID,