refactor: shorten model and table prefixes

This commit is contained in:
2026-07-23 14:30:17 +08:00
parent 6e7be2f3a4
commit 0ca2898ac0
71 changed files with 707 additions and 638 deletions

View File

@@ -14,11 +14,11 @@ func NewService() *Service {
return &Service{}
}
func (s *Service) CreateProject(ownerID uint, name string, description string) (*models.SenlinAgentProject, error) {
func (s *Service) CreateProject(ownerID uint, name string, description string) (*models.SaProject, error) {
return s.CreateProjectWithInput(ownerID, CreateProjectRequest{Name: name, Description: description})
}
func (s *Service) CreateProjectWithInput(ownerID uint, input CreateProjectRequest) (*models.SenlinAgentProject, error) {
func (s *Service) CreateProjectWithInput(ownerID uint, input CreateProjectRequest) (*models.SaProject, error) {
name := strings.TrimSpace(input.Name)
if name == "" {
return nil, ErrProjectNameRequired
@@ -27,7 +27,7 @@ func (s *Service) CreateProjectWithInput(ownerID uint, input CreateProjectReques
if identifier == "" {
identifier = projectInitials(name)
}
project := &models.SenlinAgentProject{
project := &models.SaProject{
OwnerID: ownerID, Name: name, Identifier: identifier,
Icon: strings.TrimSpace(input.Icon), Background: strings.TrimSpace(input.Background),
Description: strings.TrimSpace(input.Description),
@@ -40,7 +40,7 @@ func (s *Service) CreateProjectWithInput(ownerID uint, input CreateProjectReques
// ListProjects 只返回当前所有者的公开 DTO不让 handler 接触或序列化数据库模型。
func (s *Service) ListProjects(ownerID uint) ([]ProjectDTO, error) {
var projects []models.SenlinAgentProject
var projects []models.SaProject
if err := models.DBService.Where("owner_id = ?", ownerID).Order("updated_at desc").Find(&projects).Error; err != nil {
return nil, err
}