Files
ai-agent/internal/builders/agent_revision_builder.go
T
t 2bbf42b741 refactor(auth): delegate access control to be-system
Remove Agent Desk users, roles, login sessions, tokens, and local permission persistence. Expose the backend as an embeddable ai-agent module with host-provided subject lookup and operation authorization callbacks, and complete the frontend/backend repository split.
2026-08-21 00:41:07 +08:00

30 lines
919 B
Go

package builders
import (
"code.tczkiot.com/wlw/ai-agent/internal/models"
"code.tczkiot.com/wlw/ai-agent/internal/pkg/dto/response"
)
func BuildAgentRevision(item *models.AgentRevision) response.AgentRevisionResponse {
if item == nil {
return response.AgentRevisionResponse{}
}
publishedAt := ""
if item.PublishedAt != nil {
publishedAt = item.PublishedAt.Format("2006-01-02 15:04:05")
}
return response.AgentRevisionResponse{
ID: item.ID, AgentID: item.AgentID, Revision: item.Revision,
Status: item.Status, DefinitionHash: item.DefinitionHash, PublishedAt: publishedAt,
PublishedByID: item.PublishedByID, PublishedByName: item.PublishedByName,
}
}
func BuildAgentRevisionList(items []models.AgentRevision) []response.AgentRevisionResponse {
ret := make([]response.AgentRevisionResponse, 0, len(items))
for i := range items {
ret = append(ret, BuildAgentRevision(&items[i]))
}
return ret
}