feat: Refactor template handling and brand management
- Removed schema_json from article templates and related queries. - Updated brand service to include website field in requests and responses. - Simplified template wizard view by eliminating unused schema fields and related logic. - Added tests for ark text format handling. - Created migrations for dropping schema_json and adding website to brands.
This commit is contained in:
@@ -14,7 +14,6 @@ type TemplateRecord struct {
|
||||
OriginType string
|
||||
TemplateKey string
|
||||
TemplateName string
|
||||
SchemaJSON []byte
|
||||
PromptTemplate *string
|
||||
PromptVisibility string
|
||||
ProtectedPromptAssetKey *string
|
||||
@@ -25,16 +24,9 @@ type TemplateRecord struct {
|
||||
UpdatedAt time.Time
|
||||
}
|
||||
|
||||
type TemplateSchemaRecord struct {
|
||||
ID int64
|
||||
TemplateName string
|
||||
SchemaJSON []byte
|
||||
}
|
||||
|
||||
type TemplateRepository interface {
|
||||
ListTemplates(ctx context.Context, tenantID int64) ([]TemplateRecord, error)
|
||||
GetTemplateByID(ctx context.Context, id, tenantID int64) (*TemplateRecord, error)
|
||||
GetTemplateSchema(ctx context.Context, id int64) (*TemplateSchemaRecord, error)
|
||||
}
|
||||
|
||||
type templateRepository struct {
|
||||
@@ -60,7 +52,6 @@ func (r *templateRepository) ListTemplates(ctx context.Context, tenantID int64)
|
||||
OriginType: row.OriginType,
|
||||
TemplateKey: row.TemplateKey,
|
||||
TemplateName: row.TemplateName,
|
||||
SchemaJSON: row.SchemaJson,
|
||||
PromptTemplate: nullableText(row.PromptTemplate),
|
||||
PromptVisibility: row.PromptVisibility,
|
||||
CardConfigJSON: row.CardConfigJson,
|
||||
@@ -90,7 +81,6 @@ func (r *templateRepository) GetTemplateByID(ctx context.Context, id, tenantID i
|
||||
OriginType: row.OriginType,
|
||||
TemplateKey: row.TemplateKey,
|
||||
TemplateName: row.TemplateName,
|
||||
SchemaJSON: row.SchemaJson,
|
||||
PromptTemplate: nullableText(row.PromptTemplate),
|
||||
PromptVisibility: row.PromptVisibility,
|
||||
ProtectedPromptAssetKey: nullableText(row.ProtectedPromptAssetKey),
|
||||
@@ -101,16 +91,3 @@ func (r *templateRepository) GetTemplateByID(ctx context.Context, id, tenantID i
|
||||
UpdatedAt: timeFromTimestamp(row.UpdatedAt),
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (r *templateRepository) GetTemplateSchema(ctx context.Context, id int64) (*TemplateSchemaRecord, error) {
|
||||
row, err := r.q.GetTemplateSchema(ctx, id)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &TemplateSchemaRecord{
|
||||
ID: row.ID,
|
||||
TemplateName: row.TemplateName,
|
||||
SchemaJSON: row.SchemaJson,
|
||||
}, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user