b31d8d0096
- Added migration to harden task audit tracking by modifying audit_logs and related tables. - Introduced operator_id to several tables for better tracking of actions. - Updated article_templates with new prompt templates for various article types, enhancing content generation. - Created prompt_rules and schedule_tasks tables to manage content generation rules and scheduling. - Added foreign key constraints to articles for better data integrity.
63 lines
1.4 KiB
Go
63 lines
1.4 KiB
Go
package transport
|
|
|
|
import (
|
|
"github.com/gin-gonic/gin"
|
|
|
|
"github.com/geo-platform/tenant-api/internal/bootstrap"
|
|
"github.com/geo-platform/tenant-api/internal/shared/response"
|
|
"github.com/geo-platform/tenant-api/internal/tenant/app"
|
|
"github.com/geo-platform/tenant-api/internal/tenant/repository"
|
|
)
|
|
|
|
type WorkspaceHandler struct {
|
|
svc *app.WorkspaceService
|
|
}
|
|
|
|
func NewWorkspaceHandler(a *bootstrap.App) *WorkspaceHandler {
|
|
return &WorkspaceHandler{
|
|
svc: app.NewWorkspaceService(
|
|
repository.NewWorkspaceRepository(a.DB),
|
|
repository.NewCachedTemplateRepository(
|
|
repository.NewTemplateRepository(a.DB),
|
|
a.Cache,
|
|
),
|
|
),
|
|
}
|
|
}
|
|
|
|
func (h *WorkspaceHandler) Overview(c *gin.Context) {
|
|
data, err := h.svc.Overview(c.Request.Context())
|
|
if err != nil {
|
|
response.Error(c, err)
|
|
return
|
|
}
|
|
response.Success(c, data)
|
|
}
|
|
|
|
func (h *WorkspaceHandler) RecentArticles(c *gin.Context) {
|
|
data, err := h.svc.RecentArticles(c.Request.Context())
|
|
if err != nil {
|
|
response.Error(c, err)
|
|
return
|
|
}
|
|
response.Success(c, data)
|
|
}
|
|
|
|
func (h *WorkspaceHandler) QuotaSummary(c *gin.Context) {
|
|
data, err := h.svc.QuotaSummary(c.Request.Context())
|
|
if err != nil {
|
|
response.Error(c, err)
|
|
return
|
|
}
|
|
response.Success(c, data)
|
|
}
|
|
|
|
func (h *WorkspaceHandler) TemplateCards(c *gin.Context) {
|
|
data, err := h.svc.TemplateCards(c.Request.Context())
|
|
if err != nil {
|
|
response.Error(c, err)
|
|
return
|
|
}
|
|
response.Success(c, data)
|
|
}
|