Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
refactor(store): return nil instead of empty list (#809)
Yilong Li949c9bf83161
diff --git a/api/auth.go b/api/auth.goindex 4908e07733..a62a0982ba 100644--- a/api/auth.go+++ b/api/auth.go@@ -27,8 +27,8 @@ type Login struct {Password string `jsonapi:"attr,password"`}-// Signup is the API message for sign-ups.-type Signup struct {+// SignUp is the API message for sign-ups.+type SignUp struct {// Domain specific fieldsName string `jsonapi:"attr,name"`Email string `jsonapi:"attr,email"`diff --git a/api/plan.go b/api/plan.goindex 224e2e7e46..7318c487af 100644--- a/api/plan.go+++ b/api/plan.go@@ -33,11 +33,11 @@ type FeatureType stringconst (// Change Workflow- // FeatureBackwardCompatibilty checks if a DDL change is backward compatible.+ // FeatureBackwardCompatibility checks if a DDL change is backward compatible.// See https://docs.bytebase.com/features/sql-advisor/backward-compatibility-migration-check//// Currently, we only support MySQL/TiDB thanks to github.com/pingcap/parser- FeatureBackwardCompatibilty FeatureType = "bb.feature.backward-compatibility"+ FeatureBackwardCompatibility FeatureType = "bb.feature.backward-compatibility"// FeatureSchemaDrift detects if there occurs schema drift.// See https://docs.bytebase.com/features/drift-detectionFeatureSchemaDrift FeatureType = "bb.feature.schema-drift"@@ -61,7 +61,7 @@ const (//// Currently, we DO NOT expose this feature.//- // Internally Bytebase stores instance username/password in a seperate data source model.+ // Internally Bytebase stores instance username/password in a separate data source model.// This allows a single instance to have multiple data sources (e.g. one RW and one RO).// And from the user's perspective, the username/password// look like the property of the instance, which are not. They are the property of data source which@@ -98,7 +98,7 @@ const (func (e FeatureType) String() string {switch e {- case FeatureBackwardCompatibilty:+ case FeatureBackwardCompatibility:return "bb.feature.backward-compatibility"case FeatureSchemaDrift:return "bb.feature.schema-drift"@@ -125,7 +125,7 @@ func (e FeatureType) String() string {// Name returns a readable name of the featurefunc (e FeatureType) Name() string {switch e {- case FeatureBackwardCompatibilty:+ case FeatureBackwardCompatibility:return "Backward compatibility"case FeatureSchemaDrift:return "Schema drift"diff --git a/api/project.go b/api/project.goindex 9496c36292..3d4f4bc9b6 100644--- a/api/project.go+++ b/api/project.go@@ -189,8 +189,8 @@ type ProjectPatch struct {var (// DBNameToken is the token for database name.DBNameToken = "{{DB_NAME}}"- // EnvironemntToken is the token for environment.- EnvironemntToken = "{{ENV_NAME}}"+ // EnvironmentToken is the token for environment.+ EnvironmentToken = "{{ENV_NAME}}"// LocationToken is the token for location.LocationToken = "{{LOCATION}}"// TenantToken is the token for tenant.@@ -201,12 +201,12 @@ var ("{{VERSION}}": true,DBNameToken: true,"{{TYPE}}": true,- EnvironemntToken: false,+ EnvironmentToken: false,"{{DESCRIPTION}}": false,}schemaPathTemplateTokens = map[string]bool{DBNameToken: true,- EnvironemntToken: false,+ EnvironmentToken: false,}allowedProjectDBNameTemplateTokens = map[string]bool{DBNameToken: true,@@ -223,8 +223,8 @@ func ValidateRepositoryFilePathTemplate(filePathTemplate string, tenantMode ProjtokenMap[token] = true}if tenantMode == TenantModeTenant {- if _, ok := tokenMap[EnvironemntToken]; ok {- return &common.Error{Code: common.Invalid, Err: fmt.Errorf("%q is not allowed in the template for projects in tenant mode", EnvironemntToken)}+ if _, ok := tokenMap[EnvironmentToken]; ok {+ return &common.Error{Code: common.Invalid, Err: fmt.Errorf("%q is not allowed in the template for projects in tenant mode", EnvironmentToken)}}}@@ -254,8 +254,8 @@ func ValidateRepositorySchemaPathTemplate(schemaPathTemplate string, tenantModetokenMap[token] = true}if tenantMode == TenantModeTenant {- if _, ok := tokenMap[EnvironemntToken]; ok {- return &common.Error{Code: common.Invalid, Err: fmt.Errorf("%q is not allowed in the template for projects in tenant mode", EnvironemntToken)}+ if _, ok := tokenMap[EnvironmentToken]; ok {+ return &common.Error{Code: common.Invalid, Err: fmt.Errorf("%q is not allowed in the template for projects in tenant mode", EnvironmentToken)}}}diff --git a/server/activity_manager.go b/server/activity_manager.goindex 4bbb292e1d..2cfaad1617 100644--- a/server/activity_manager.go+++ b/server/activity_manager.go@@ -57,11 +57,11 @@ func (m *ActivityManager) CreateActivity(ctx context.Context, create *api.ActiviProjectID: &meta.issue.ProjectID,ActivityType: &create.Type,}- hookList, err := m.s.ProjectWebhookService.FindProjectWebhookList(ctx, hookFind)+ webhookList, err := m.s.ProjectWebhookService.FindProjectWebhookList(ctx, hookFind)if err != nil {return nil, fmt.Errorf("failed to find project webhook after changing the issue status: %v, error: %w", meta.issue.Name, err)}- if len(hookList) == 0 {+ if len(webhookList) == 0 {return activity, nil}@@ -100,7 +100,7 @@ func (m *ActivityManager) CreateActivity(ctx context.Context, create *api.Activireturn}- for _, hook := range hookList {+ for _, hook := range webhookList {webhookCtx.URL = hook.URLwebhookCtx.CreatedTs = time.Now().Unix()if err := webhook.Post(hook.Type, webhookCtx); err != nil {diff --git a/server/actuator.go b/server/actuator.goindex 988381cf53..afb1a474a6 100644--- a/server/actuator.go+++ b/server/actuator.go@@ -25,11 +25,11 @@ func (s *Server) registerActuatorRoutes(g *echo.Group) {find := &api.MemberFind{Role: &findRole,}- list, err := s.MemberService.FindMemberList(ctx, find)+ memberList, err := s.MemberService.FindMemberList(ctx, find)if err != nil {return echo.NewHTTPError(http.StatusInternalServerError, "Failed to fetch admin setup status").SetInternal(err)}- serverInfo.NeedAdminSetup = len(list) == 0+ serverInfo.NeedAdminSetup = len(memberList) == 0return c.JSON(http.StatusOK, serverInfo)})diff --git a/server/auth.go b/server/auth.goindex f8d55cc113..ec3f5cc19a 100644--- a/server/auth.go+++ b/server/auth.go@@ -113,13 +113,13 @@ func (s *Server) registerAuthRoutes(g *echo.Group) {// if user login via gitlab at the first time, we will generate a random password.// The random password is supposed to be not guessable. If user wants to login// via password, she needs to set the new password from the profile page.- signup := &api.Signup{+ signUp := &api.SignUp{Email: gitlabUserInfo.Email,Password: common.RandomString(20),Name: gitlabUserInfo.Name,}var httpError *echo.HTTPError- user, httpError = trySignup(ctx, s, signup, api.SystemBotID)+ user, httpError = trySignUp(ctx, s, signUp, api.SystemBotID)if httpError != nil {return httpError}@@ -166,12 +166,12 @@ func (s *Server) registerAuthRoutes(g *echo.Group) {g.POST("/auth/signup", func(c echo.Context) error {ctx := context.Background()- signup := &api.Signup{}- if err := jsonapi.UnmarshalPayload(c.Request().Body, signup); err != nil {- return echo.NewHTTPError(http.StatusBadRequest, "Malformatted signup request").SetInternal(err)+ signUp := &api.SignUp{}+ if err := jsonapi.UnmarshalPayload(c.Request().Body, signUp); err != nil {+ return echo.NewHTTPError(http.StatusBadRequest, "Malformatted sign up request").SetInternal(err)}- user, err := trySignup(ctx, s, signup, api.SystemBotID)+ user, err := trySignUp(ctx, s, signUp, api.SystemBotID)if err != nil {return err}@@ -182,14 +182,14 @@ func (s *Server) registerAuthRoutes(g *echo.Group) {c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSONCharsetUTF8)if err := jsonapi.MarshalPayload(c.Response().Writer, user); err != nil {- return echo.NewHTTPError(http.StatusInternalServerError, "Failed to marshal signup response").SetInternal(err)+ return echo.NewHTTPError(http.StatusInternalServerError, "Failed to marshal sign up response").SetInternal(err)}return nil})}-func trySignup(ctx context.Context, s *Server, signup *api.Signup, CreatorID int) (*api.Principal, *echo.HTTPError) {- passwordHash, err := bcrypt.GenerateFromPassword([]byte(signup.Password), bcrypt.DefaultCost)+func trySignUp(ctx context.Context, s *Server, signUp *api.SignUp, CreatorID int) (*api.Principal, *echo.HTTPError) {+ passwordHash, err := bcrypt.GenerateFromPassword([]byte(signUp.Password), bcrypt.DefaultCost)if err != nil {return nil, echo.NewHTTPError(http.StatusInternalServerError, "Failed to generate password hash").SetInternal(err)}@@ -197,30 +197,30 @@ func trySignup(ctx context.Context, s *Server, signup *api.Signup, CreatorID intprincipalCreate := &api.PrincipalCreate{CreatorID: CreatorID,Type: api.EndUser,- Name: signup.Name,- Email: signup.Email,+ Name: signUp.Name,+ Email: signUp.Email,PasswordHash: string(passwordHash),}user, err := s.PrincipalService.CreatePrincipal(ctx, principalCreate)if err != nil {if common.ErrorCode(err) == common.Conflict {- return nil, echo.NewHTTPError(http.StatusConflict, fmt.Sprintf("Email already exists: %s", signup.Email))+ return nil, echo.NewHTTPError(http.StatusConflict, fmt.Sprintf("Email already exists: %s", signUp.Email))}- return nil, echo.NewHTTPError(http.StatusInternalServerError, "Failed to signup").SetInternal(err)+ return nil, echo.NewHTTPError(http.StatusInternalServerError, "Failed to sign up").SetInternal(err)}findRole := api.Ownerfind := &api.MemberFind{Role: &findRole,}- list, err := s.MemberService.FindMemberList(ctx, find)+ memberList, err := s.MemberService.FindMemberList(ctx, find)if err != nil {- return nil, echo.NewHTTPError(http.StatusInternalServerError, "Failed to signup").SetInternal(err)+ return nil, echo.NewHTTPError(http.StatusInternalServerError, "Failed to sign up").SetInternal(err)}// Grant the member Owner role if there is no existing Owner member.role := api.Developer- if len(list) == 0 {+ if len(memberList) == 0 {role = api.Owner}memberCreate := &api.MemberCreate{@@ -233,9 +233,9 @@ func trySignup(ctx context.Context, s *Server, signup *api.Signup, CreatorID intmember, err := s.MemberService.CreateMember(ctx, memberCreate)if err != nil {if common.ErrorCode(err) == common.Conflict {- return nil, echo.NewHTTPError(http.StatusConflict, fmt.Sprintf("Member already exists: %s", signup.Email))+ return nil, echo.NewHTTPError(http.StatusConflict, fmt.Sprintf("Member already exists: %s", signUp.Email))}- return nil, echo.NewHTTPError(http.StatusInternalServerError, "Failed to signup").SetInternal(err)+ return nil, echo.NewHTTPError(http.StatusInternalServerError, "Failed to sign up").SetInternal(err)}{diff --git a/server/bookmark.go b/server/bookmark.goindex 56a1428d4d..99abe547e6 100644--- a/server/bookmark.go+++ b/server/bookmark.go@@ -51,19 +51,19 @@ func (s *Server) registerBookmarkRoutes(g *echo.Group) {bookmarkFind := &api.BookmarkFind{CreatorID: &userID,}- list, err := s.BookmarkService.FindBookmarkList(ctx, bookmarkFind)+ bookmarkList, err := s.BookmarkService.FindBookmarkList(ctx, bookmarkFind)if err != nil {return echo.NewHTTPError(http.StatusInternalServerError, "Failed to fetch bookmark list").SetInternal(err)}- for _, bookmark := range list {+ for _, bookmark := range bookmarkList {if err := s.composeBookmarkRelationship(ctx, bookmark); err != nil {return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to fetch bookmark relationship: %v", bookmark.Name)).SetInternal(err)}}c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSONCharsetUTF8)- if err := jsonapi.MarshalPayload(c.Response().Writer, list); err != nil {+ if err := jsonapi.MarshalPayload(c.Response().Writer, bookmarkList); err != nil {return echo.NewHTTPError(http.StatusInternalServerError, "Failed to marshal bookmark list response").SetInternal(err)}return nildiff --git a/server/database.go b/server/database.goindex f854190722..8146f5af55 100644--- a/server/database.go+++ b/server/database.go@@ -375,19 +375,21 @@ func (s *Server) registerDatabaseRoutes(g *echo.Group) {DatabaseID: &id,TableID: &table.ID,}- table.ColumnList, err = s.ColumnService.FindColumnList(ctx, columnFind)+ columnList, err := s.ColumnService.FindColumnList(ctx, columnFind)if err != nil {return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to fetch colmun list for database id: %d, table name: %s", id, table.Name)).SetInternal(err)}+ table.ColumnList = columnListindexFind := &api.IndexFind{DatabaseID: &id,TableID: &table.ID,}- table.IndexList, err = s.IndexService.FindIndexList(ctx, indexFind)+ indexList, err := s.IndexService.FindIndexList(ctx, indexFind)if err != nil {return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to fetch index list for database id: %d, table name: %s", id, table.Name)).SetInternal(err)}+ table.IndexList = indexListif err := s.composeTableRelationship(ctx, table); err != nil {return echo.NewHTTPError(http.StatusInternalServerError, "Failed to compose table relationship").SetInternal(err)@@ -438,19 +440,21 @@ func (s *Server) registerDatabaseRoutes(g *echo.Group) {DatabaseID: &id,TableID: &table.ID,}- table.ColumnList, err = s.ColumnService.FindColumnList(ctx, columnFind)+ columnList, err := s.ColumnService.FindColumnList(ctx, columnFind)if err != nil {return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to fetch colmun list for database id: %d, table name: %s", id, tableName)).SetInternal(err)}+ table.ColumnList = columnListindexFind := &api.IndexFind{DatabaseID: &id,TableID: &table.ID,}- table.IndexList, err = s.IndexService.FindIndexList(ctx, indexFind)+ indexList, err := s.IndexService.FindIndexList(ctx, indexFind)if err != nil {return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to fetch index list for database id: %d, table name: %s", id, table.Name)).SetInternal(err)}+ table.IndexList = indexListif err := s.composeTableRelationship(ctx, table); err != nil {return echo.NewHTTPError(http.StatusInternalServerError, "Failed to compose table relationship").SetInternal(err)@@ -921,18 +925,18 @@ func (s *Server) composeDatabaseByFind(ctx context.Context, find *api.DatabaseFi}func (s *Server) composeDatabaseListByFind(ctx context.Context, find *api.DatabaseFind) ([]*api.Database, error) {- list, err := s.DatabaseService.FindDatabaseList(ctx, find)+ dbList, err := s.DatabaseService.FindDatabaseList(ctx, find)if err != nil {return nil, err}- for _, database := range list {+ for _, database := range dbList {if err := s.composeDatabaseRelationship(ctx, database); err != nil {return nil, err}}- return list, nil+ return dbList, nil}func (s *Server) composeDatabaseRelationship(ctx context.Context, database *api.Database) error {@@ -968,13 +972,14 @@ func (s *Server) composeDatabaseRelationship(ctx context.Context, database *api.database.DataSourceList = []*api.DataSource{}rowStatus := api.Normal- database.AnomalyList, err = s.AnomalyService.FindAnomalyList(ctx, &api.AnomalyFind{+ anomalyList, err := s.AnomalyService.FindAnomalyList(ctx, &api.AnomalyFind{RowStatus: &rowStatus,DatabaseID: &database.ID,})if err != nil {return err}+ database.AnomalyList = anomalyListfor _, anomaly := range database.AnomalyList {anomaly.Creator, err = s.composePrincipalByID(ctx, anomaly.CreatorID)if err != nil {diff --git a/server/environment.go b/server/environment.goindex adf92162ac..45c34d9cab 100644--- a/server/environment.go+++ b/server/environment.go@@ -49,19 +49,19 @@ func (s *Server) registerEnvironmentRoutes(g *echo.Group) {rowStatus := api.RowStatus(rowStatusStr)environmentFind.RowStatus = &rowStatus}- list, err := s.EnvironmentService.FindEnvironmentList(ctx, environmentFind)+ envList, err := s.EnvironmentService.FindEnvironmentList(ctx, environmentFind)if err != nil {return echo.NewHTTPError(http.StatusInternalServerError, "Failed to fetch environment list").SetInternal(err)}- for _, environment := range list {+ for _, environment := range envList {if err := s.composeEnvironmentRelationship(ctx, environment); err != nil {return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to fetch environment relationship: %v", environment.Name)).SetInternal(err)}}c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSONCharsetUTF8)- if err := jsonapi.MarshalPayload(c.Response().Writer, list); err != nil {+ if err := jsonapi.MarshalPayload(c.Response().Writer, envList); err != nil {return echo.NewHTTPError(http.StatusInternalServerError, "Failed to marshal environment list response").SetInternal(err)}return nil@@ -121,19 +121,19 @@ func (s *Server) registerEnvironmentRoutes(g *echo.Group) {}environmentFind := &api.EnvironmentFind{}- list, err := s.EnvironmentService.FindEnvironmentList(ctx, environmentFind)+ envList, err := s.EnvironmentService.FindEnvironmentList(ctx, environmentFind)if err != nil {return echo.NewHTTPError(http.StatusInternalServerError, "Failed to fetch environment list for reorder").SetInternal(err)}- for _, environment := range list {+ for _, environment := range envList {if err := s.composeEnvironmentRelationship(ctx, environment); err != nil {return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to fetch reordered environment relationship: %v", environment.Name)).SetInternal(err)}}c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSONCharsetUTF8)- if err := jsonapi.MarshalPayload(c.Response().Writer, list); err != nil {+ if err := jsonapi.MarshalPayload(c.Response().Writer, envList); err != nil {return echo.NewHTTPError(http.StatusInternalServerError, "Failed to marshal environment reorder response").SetInternal(err)}return nildiff --git a/server/inbox.go b/server/inbox.goindex dd575d5775..2987ccbcf2 100644--- a/server/inbox.go+++ b/server/inbox.go@@ -32,19 +32,19 @@ func (s *Server) registerInboxRoutes(g *echo.Group) {}inboxFind.ReadCreatedAfterTs = &createdTs}- list, err := s.InboxService.FindInboxList(ctx, inboxFind)+ inboxList, err := s.InboxService.FindInboxList(ctx, inboxFind)if err != nil {return echo.NewHTTPError(http.StatusInternalServerError, "Failed to fetch inbox list").SetInternal(err)}- for _, inbox := range list {+ for _, inbox := range inboxList {if err := s.composeActivityRelationship(ctx, inbox.Activity); err != nil {return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to fetch inbox activity relationship: %v", inbox.Activity.ID)).SetInternal(err)}}c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSONCharsetUTF8)- if err := jsonapi.MarshalPayload(c.Response().Writer, list); err != nil {+ if err := jsonapi.MarshalPayload(c.Response().Writer, inboxList); err != nil {return echo.NewHTTPError(http.StatusInternalServerError, "Failed to marshal inbox list response").SetInternal(err)}return nildiff --git a/server/instance.go b/server/instance.goindex 51b0219813..c84620c47d 100644--- a/server/instance.go+++ b/server/instance.go@@ -71,19 +71,19 @@ func (s *Server) registerInstanceRoutes(g *echo.Group) {rowStatus := api.RowStatus(rowStatusStr)instanceFind.RowStatus = &rowStatus}- list, err := s.InstanceService.FindInstanceList(ctx, instanceFind)+ instanceList, err := s.InstanceService.FindInstanceList(ctx, instanceFind)if err != nil {return echo.NewHTTPError(http.StatusInternalServerError, "Failed to fetch instance list").SetInternal(err)}- for _, instance := range list {+ for _, instance := range instanceList {if err := s.composeInstanceRelationship(ctx, instance); err != nil {return err}}c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSONCharsetUTF8)- if err := jsonapi.MarshalPayload(c.Response().Writer, list); err != nil {+ if err := jsonapi.MarshalPayload(c.Response().Writer, instanceList); err != nil {return echo.NewHTTPError(http.StatusInternalServerError, "Failed to marshal instance list response").SetInternal(err)}return nil@@ -224,13 +224,13 @@ func (s *Server) registerInstanceRoutes(g *echo.Group) {instanceUserFind := &api.InstanceUserFind{InstanceID: id,}- list, err := s.InstanceUserService.FindInstanceUserList(ctx, instanceUserFind)+ instanceUserList, err := s.InstanceUserService.FindInstanceUserList(ctx, instanceUserFind)if err != nil {return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to fetch user list for instance: %v", id)).SetInternal(err)}c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSONCharsetUTF8)- if err := jsonapi.MarshalPayload(c.Response().Writer, list); err != nil {+ if err := jsonapi.MarshalPayload(c.Response().Writer, instanceUserList); err != nil {return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to marshal instance user list response: %v", id)).SetInternal(err)}return nil@@ -482,7 +482,7 @@ func (s *Server) composeInstanceRelationship(ctx context.Context, instance *api.}rowStatus := api.Normal- instance.AnomalyList, err = s.AnomalyService.FindAnomalyList(ctx, &api.AnomalyFind{+ anomalyList, err := s.AnomalyService.FindAnomalyList(ctx, &api.AnomalyFind{RowStatus: &rowStatus,InstanceID: &instance.ID,InstanceOnly: true,@@ -490,6 +490,7 @@ func (s *Server) composeInstanceRelationship(ctx context.Context, instance *api.if err != nil {return err}+ instance.AnomalyList = anomalyListfor _, anomaly := range instance.AnomalyList {if anomaly.Creator, err = s.composePrincipalByID(ctx, anomaly.CreatorID); err != nil {return err@@ -499,12 +500,13 @@ func (s *Server) composeInstanceRelationship(ctx context.Context, instance *api.}}- instance.DataSourceList, err = s.DataSourceService.FindDataSourceList(ctx, &api.DataSourceFind{+ dataSourceList, err := s.DataSourceService.FindDataSourceList(ctx, &api.DataSourceFind{InstanceID: &instance.ID,})if err != nil {return err}+ instance.DataSourceList = dataSourceListfor _, dataSource := range instance.DataSourceList {if dataSource.Creator, err = s.composePrincipalByID(ctx, dataSource.CreatorID); err != nil {return errdiff --git a/server/issue.go b/server/issue.goindex 50432e0d87..43605d0fa5 100644--- a/server/issue.go+++ b/server/issue.go@@ -71,19 +71,19 @@ func (s *Server) registerIssueRoutes(g *echo.Group) {}issueFind.PrincipalID = &userID}- list, err := s.IssueService.FindIssueList(ctx, issueFind)+ issueList, err := s.IssueService.FindIssueList(ctx, issueFind)if err != nil {return echo.NewHTTPError(http.StatusInternalServerError, "Failed to fetch issue list").SetInternal(err)}- for _, issue := range list {+ for _, issue := range issueList {if err := s.composeIssueRelationship(ctx, issue); err != nil {return err}}c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSONCharsetUTF8)- if err := jsonapi.MarshalPayload(c.Response().Writer, list); err != nil {+ if err := jsonapi.MarshalPayload(c.Response().Writer, issueList); err != nil {return echo.NewHTTPError(http.StatusInternalServerError, "Failed to marshal issue list response").SetInternal(err)}return nil@@ -294,11 +294,11 @@ func (s *Server) composeIssueRelationship(ctx context.Context, issue *api.Issue)issueSubscriberFind := &api.IssueSubscriberFind{IssueID: &issue.ID,}- list, err := s.IssueSubscriberService.FindIssueSubscriberList(ctx, issueSubscriberFind)+ issueSubscriberList, err := s.IssueSubscriberService.FindIssueSubscriberList(ctx, issueSubscriberFind)if err != nil {return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to fetch subscriber list for issue %d", issue.ID)).SetInternal(err)}- for _, issueSubscriber := range list {+ for _, issueSubscriber := range issueSubscriberList {if err := s.composeIssueSubscriberRelationship(ctx, issueSubscriber); err != nil {return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to fetch subscriber %d relationship for issue %d", issueSubscriber.SubscriberID, issueSubscriber.IssueID)).SetInternal(err)}diff --git a/server/issue_subscriber.go b/server/issue_subscriber.goindex 6f29d74d56..ca548784d1 100644--- a/server/issue_subscriber.go+++ b/server/issue_subscriber.go@@ -56,19 +56,19 @@ func (s *Server) registerIssueSubscriberRoutes(g *echo.Group) {issueSubscriberFind := &api.IssueSubscriberFind{IssueID: &issueID,}- list, err := s.IssueSubscriberService.FindIssueSubscriberList(ctx, issueSubscriberFind)+ issueSubscriberList, err := s.IssueSubscriberService.FindIssueSubscriberList(ctx, issueSubscriberFind)if err != nil {return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to fetch subscriber list for issue %d", issueID)).SetInternal(err)}- for _, issueSubscriber := range list {+ for _, issueSubscriber := range issueSubscriberList {if err := s.composeIssueSubscriberRelationship(ctx, issueSubscriber); err != nil {return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to fetch subscriber %d relationship for issue %d", issueSubscriber.SubscriberID, issueSubscriber.IssueID)).SetInternal(err)}}c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSONCharsetUTF8)- if err := jsonapi.MarshalPayload(c.Response().Writer, list); err != nil {+ if err := jsonapi.MarshalPayload(c.Response().Writer, issueSubscriberList); err != nil {return echo.NewHTTPError(http.StatusInternalServerError, "Failed to marshal issue subscriber list response").SetInternal(err)}return nildiff --git a/server/label.go b/server/label.goindex a46a3efe49..33c38e4c87 100644--- a/server/label.go+++ b/server/label.go@@ -27,12 +27,12 @@ func (s *Server) registerLabelRoutes(g *echo.Group) {}// Add reserved environment key.- envs, err := s.EnvironmentService.FindEnvironmentList(ctx, &api.EnvironmentFind{RowStatus: &rowStatus})+ envList, err := s.EnvironmentService.FindEnvironmentList(ctx, &api.EnvironmentFind{RowStatus: &rowStatus})if err != nil {return echo.NewHTTPError(http.StatusInternalServerError, "Failed to fetch environments").SetInternal(err)}envKey := &api.LabelKey{Key: api.EnvironmentKeyName}- for _, env := range envs {+ for _, env := range envList {envKey.ValueList = append(envKey.ValueList, env.Name)}list = append(list, envKey)diff --git a/server/member.go b/server/member.goindex dd96f5bcfc..9c6cdfc627 100644--- a/server/member.go+++ b/server/member.go@@ -81,19 +81,19 @@ func (s *Server) registerMemberRoutes(g *echo.Group) {g.GET("/member", func(c echo.Context) error {ctx := context.Background()memberFind := &api.MemberFind{}- list, err := s.MemberService.FindMemberList(ctx, memberFind)+ memberList, err := s.MemberService.FindMemberList(ctx, memberFind)if err != nil {return echo.NewHTTPError(http.StatusInternalServerError, "Failed to fetch member list").SetInternal(err)}- for _, member := range list {+ for _, member := range memberList {if err := s.composeMemberRelationship(ctx, member); err != nil {return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to fetch member relationship: %v", member.ID)).SetInternal(err)}}c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSONCharsetUTF8)- if err := jsonapi.MarshalPayload(c.Response().Writer, list); err != nil {+ if err := jsonapi.MarshalPayload(c.Response().Writer, memberList); err != nil {return echo.NewHTTPError(http.StatusInternalServerError, "Failed to marshal member list response").SetInternal(err)}return nildiff --git a/server/principal.go b/server/principal.goindex bd991d952b..70eab4a65a 100644--- a/server/principal.go+++ b/server/principal.go@@ -49,13 +49,13 @@ func (s *Server) registerPrincipalRoutes(g *echo.Group) {g.GET("/principal", func(c echo.Context) error {ctx := context.Background()- list, err := s.PrincipalService.FindPrincipalList(ctx)+ principalList, err := s.PrincipalService.FindPrincipalList(ctx)if err != nil {return echo.NewHTTPError(http.StatusInternalServerError, "Failed to fetch principal list").SetInternal(err)}filteredList := []*api.Principal{}- for _, principal := range list {+ for _, principal := range principalList {if err := s.composePrincipalRole(ctx, principal); err != nil {// Normally this should not happen since we create the member together with the principal// and we don't allow deleting the member. Just in case.diff --git a/server/project.go b/server/project.goindex e991aaf3ce..4d595d391c 100644--- a/server/project.go+++ b/server/project.go@@ -448,19 +448,19 @@ func (s *Server) registerProjectRoutes(g *echo.Group) {repositoryFind := &api.RepositoryFind{ProjectID: &projectID,}- list, err := s.RepositoryService.FindRepositoryList(ctx, repositoryFind)+ repoRawList, err := s.RepositoryService.FindRepositoryList(ctx, repositoryFind)if err != nil {return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to fetch repository list for project ID: %d", projectID)).SetInternal(err)}// Just be defensive, this shouldn't happen because we set UNIQUE constraint on project_id- if len(list) > 1 {- return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Retrieved %d repository list for project ID: %d, expect at most 1", len(list), projectID)).SetInternal(err)- } else if len(list) == 0 {+ if len(repoRawList) > 1 {+ return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Retrieved %d repository list for project ID: %d, expect at most 1", len(repoRawList), projectID)).SetInternal(err)+ } else if len(repoRawList) == 0 {return echo.NewHTTPError(http.StatusNotFound, fmt.Sprintf("Repository not found for project ID: %d", projectID))}- repository := list[0]+ repository := repoRawList[0]vcsFind := &api.VCSFind{ID: &repository.VCSID,}diff --git a/server/project_member.go b/server/project_member.goindex 827659c3da..51650dfab7 100644--- a/server/project_member.go+++ b/server/project_member.go@@ -84,7 +84,7 @@ func (s *Server) registerProjectMemberRoutes(g *echo.Group) {return echo.NewHTTPError(http.StatusInternalServerError, "Failed to fetch principal info").SetInternal(err)}if principal == nil { // try to create principal- signupInfo := &api.Signup{+ signUpInfo := &api.SignUp{Name: projectMember.Name,Email: projectMember.Email,// Principal created via this method would have no chance to set their password.@@ -93,7 +93,7 @@ func (s *Server) registerProjectMemberRoutes(g *echo.Group) {// if the principal uses external auth providerPassword: common.RandomString(20),}- createdPrincipal, httpErr := trySignup(ctx, s, signupInfo, c.Get(getPrincipalIDContextKey()).(int))+ createdPrincipal, httpErr := trySignUp(ctx, s, signUpInfo, c.Get(getPrincipalIDContextKey()).(int))if httpErr != nil {return httpErr}diff --git a/server/project_webhook.go b/server/project_webhook.goindex ded3312a27..667702407b 100644--- a/server/project_webhook.go+++ b/server/project_webhook.go@@ -25,19 +25,19 @@ func (s *Server) registerProjectWebhookRoutes(g *echo.Group) {find := &api.ProjectWebhookFind{ProjectID: &projectID,}- list, err := s.ProjectWebhookService.FindProjectWebhookList(ctx, find)+ webhookList, err := s.ProjectWebhookService.FindProjectWebhookList(ctx, find)if err != nil {return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to fetch webhook list for project ID: %d", projectID)).SetInternal(err)}- for _, hook := range list {+ for _, hook := range webhookList {if err := s.composeProjectWebhookRelationship(ctx, hook); err != nil {return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to fetch webhook relationship: %v", hook.Name)).SetInternal(err)}}c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSONCharsetUTF8)- if err := jsonapi.MarshalPayload(c.Response().Writer, list); err != nil {+ if err := jsonapi.MarshalPayload(c.Response().Writer, webhookList); err != nil {return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to marshal project webhook response: %v", projectID)).SetInternal(err)}return nildiff --git a/server/schema_syncer.go b/server/schema_syncer.goindex c9ac84026a..3937de13c6 100644--- a/server/schema_syncer.go+++ b/server/schema_syncer.go@@ -57,13 +57,13 @@ func (s *SchemaSyncer) Run(ctx context.Context, wg *sync.WaitGroup) {instanceFind := &api.InstanceFind{RowStatus: &rowStatus,}- list, err := s.server.InstanceService.FindInstanceList(ctx, instanceFind)+ instanceList, err := s.server.InstanceService.FindInstanceList(ctx, instanceFind)if err != nil {s.l.Error("Failed to retrieve instances", zap.Error(err))return}- for _, instance := range list {+ for _, instance := range instanceList {mu.Lock()if _, ok := runningTasks[instance.ID]; ok {mu.Unlock()diff --git a/server/setting.go b/server/setting.goindex 15d3fdc957..03eb60b448 100644--- a/server/setting.go+++ b/server/setting.go@@ -20,13 +20,13 @@ func (s *Server) registerSettingRoutes(g *echo.Group) {g.GET("/setting", func(c echo.Context) error {ctx := context.Background()find := &api.SettingFind{}- list, err := s.SettingService.FindSettingList(ctx, find)+ settingList, err := s.SettingService.FindSettingList(ctx, find)if err != nil {return echo.NewHTTPError(http.StatusInternalServerError, "Failed to fetch setting list").SetInternal(err)}filteredList := []*api.Setting{}- for _, setting := range list {+ for _, setting := range settingList {for _, whitelist := range whitelistSettings {if setting.Name == whitelist {filteredList = append(filteredList, setting)diff --git a/server/sheet.go b/server/sheet.goindex 6ddca4033b..18251e5406 100644--- a/server/sheet.go+++ b/server/sheet.go@@ -98,19 +98,19 @@ func (s *Server) registerSheetRoutes(g *echo.Group) {sheetFind.Visibility = &visibility}- list, err := s.SheetService.FindSheetList(ctx, sheetFind)+ sheetList, err := s.SheetService.FindSheetList(ctx, sheetFind)if err != nil {return echo.NewHTTPError(http.StatusInternalServerError, "Failed to fetch sheet list").SetInternal(err)}- for _, sheet := range list {+ for _, sheet := range sheetList {if err := s.composeSheetRelationship(ctx, sheet); err != nil {return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to fetch sheet relationship: %v", sheet.Name)).SetInternal(err)}}c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSONCharsetUTF8)- if err := jsonapi.MarshalPayload(c.Response().Writer, list); err != nil {+ if err := jsonapi.MarshalPayload(c.Response().Writer, sheetList); err != nil {return echo.NewHTTPError(http.StatusInternalServerError, "Failed to marshal sheet list response").SetInternal(err)}return nildiff --git a/server/task.go b/server/task.goindex 900603ae9c..6f4c39a29e 100644--- a/server/task.go+++ b/server/task.go@@ -195,7 +195,7 @@ func (s *Server) registerTaskRoutes(g *echo.Group) {)}- if s.feature(api.FeatureBackwardCompatibilty) {+ if s.feature(api.FeatureBackwardCompatibility) {_, err = s.TaskCheckRunService.CreateTaskCheckRunIfNeeded(ctx, &api.TaskCheckRunCreate{CreatorID: api.SystemBotID,TaskID: task.ID,diff --git a/server/task_check_executor_statement_advisor.go b/server/task_check_executor_statement_advisor.goindex d8bc4335a1..73e96d84b7 100644--- a/server/task_check_executor_statement_advisor.go+++ b/server/task_check_executor_statement_advisor.go@@ -37,8 +37,8 @@ func (exec *TaskCheckStatementAdvisorExecutor) Run(ctx context.Context, server *case api.TaskCheckDatabaseStatementSyntax:advisorType = advisor.MySQLSyntaxcase api.TaskCheckDatabaseStatementCompatibility:- if !server.feature(api.FeatureBackwardCompatibilty) {- return []api.TaskCheckResult{}, common.Errorf(common.NotAuthorized, fmt.Errorf(api.FeatureBackwardCompatibilty.AccessErrorMessage()))+ if !server.feature(api.FeatureBackwardCompatibility) {+ return []api.TaskCheckResult{}, common.Errorf(common.NotAuthorized, fmt.Errorf(api.FeatureBackwardCompatibility.AccessErrorMessage()))}advisorType = advisor.MySQLMigrationCompatibility}diff --git a/server/task_check_scheduler.go b/server/task_check_scheduler.goindex 4e55179c59..6dde048473 100644--- a/server/task_check_scheduler.go+++ b/server/task_check_scheduler.go@@ -320,7 +320,7 @@ func (s *TaskCheckScheduler) ScheduleCheckIfNeeded(ctx context.Context, task *apreturn nil, err}- if s.server.feature(api.FeatureBackwardCompatibilty) {+ if s.server.feature(api.FeatureBackwardCompatibility) {_, err = s.server.TaskCheckRunService.CreateTaskCheckRunIfNeeded(ctx, &api.TaskCheckRunCreate{CreatorID: creatorID,TaskID: task.ID,@@ -337,10 +337,11 @@ func (s *TaskCheckScheduler) ScheduleCheckIfNeeded(ctx context.Context, task *aptaskCheckRunFind := &api.TaskCheckRunFind{TaskID: &task.ID,}- task.TaskCheckRunList, err = s.server.TaskCheckRunService.FindTaskCheckRunList(ctx, taskCheckRunFind)+ taskCheckRunList, err := s.server.TaskCheckRunService.FindTaskCheckRunList(ctx, taskCheckRunFind)if err != nil {return nil, err}+ task.TaskCheckRunList = taskCheckRunListreturn task, err}diff --git a/server/task_scheduler.go b/server/task_scheduler.goindex 7aeb7d0d0f..e12a32e948 100644--- a/server/task_scheduler.go+++ b/server/task_scheduler.go@@ -284,7 +284,7 @@ func (s *TaskScheduler) ScheduleIfNeeded(ctx context.Context, task *api.Task) (*return task, nil}- if s.server.feature(api.FeatureBackwardCompatibilty) {+ if s.server.feature(api.FeatureBackwardCompatibility) {pass, err = s.server.passCheck(ctx, s.server, task, api.TaskCheckDatabaseStatementCompatibility)if err != nil {return nil, errdiff --git a/store/activity.go b/store/activity.goindex ba7e2a324d..76f7956000 100644--- a/store/activity.go+++ b/store/activity.go@@ -46,7 +46,7 @@ func (s *ActivityService) CreateActivity(ctx context.Context, create *api.Activireturn activity, nil}-// FindActivityList retrieves a list of activitys based on find.+// FindActivityList retrieves a list of activities based on the find condition.func (s *ActivityService) FindActivityList(ctx context.Context, find *api.ActivityFind) ([]*api.Activity, error) {tx, err := s.db.BeginTx(ctx, nil)if err != nil {@@ -56,7 +56,7 @@ func (s *ActivityService) FindActivityList(ctx context.Context, find *api.Activilist, err := findActivityList(ctx, tx.PTx, find)if err != nil {- return []*api.Activity{}, err+ return nil, err}return list, nildiff --git a/store/anomaly.go b/store/anomaly.goindex fcf6b28a14..e32cfdf4db 100644--- a/store/anomaly.go+++ b/store/anomaly.go@@ -76,7 +76,7 @@ func (s *AnomalyService) UpsertActiveAnomaly(ctx context.Context, upsert *api.Anreturn anomaly, nil}-// FindAnomalyList retrieves a list of anomalys based on find.+// FindAnomalyList retrieves a list of anomalies based on the find condition.func (s *AnomalyService) FindAnomalyList(ctx context.Context, find *api.AnomalyFind) ([]*api.Anomaly, error) {tx, err := s.db.BeginTx(ctx, nil)if err != nil {@@ -86,7 +86,7 @@ func (s *AnomalyService) FindAnomalyList(ctx context.Context, find *api.AnomalyFlist, err := findAnomalyList(ctx, tx.PTx, find)if err != nil {- return []*api.Anomaly{}, err+ return nil, err}return list, nildiff --git a/store/backup.go b/store/backup.goindex fbe4ec29ec..3979e70ee2 100644--- a/store/backup.go+++ b/store/backup.go@@ -79,7 +79,7 @@ func (s *BackupService) FindBackupList(ctx context.Context, find *api.BackupFindlist, err := s.findBackupList(ctx, tx.PTx, find)if err != nil {- return []*api.Backup{}, err+ return nil, err}return list, nildiff --git a/store/bookmark.go b/store/bookmark.goindex 89bf178f28..e2fe3cf7e4 100644--- a/store/bookmark.go+++ b/store/bookmark.go@@ -56,7 +56,7 @@ func (s *BookmarkService) FindBookmarkList(ctx context.Context, find *api.Bookmalist, err := findBookmarkList(ctx, tx.PTx, find)if err != nil {- return []*api.Bookmark{}, err+ return nil, err}return list, nildiff --git a/store/column.go b/store/column.goindex fef680bcf7..f774fd5684 100644--- a/store/column.go+++ b/store/column.go@@ -56,7 +56,7 @@ func (s *ColumnService) FindColumnList(ctx context.Context, find *api.ColumnFindlist, err := s.findColumnList(ctx, tx.PTx, find)if err != nil {- return []*api.Column{}, err+ return nil, err}return list, nildiff --git a/store/data_source.go b/store/data_source.goindex 36842c44ab..82a0ba9dd0 100644--- a/store/data_source.go+++ b/store/data_source.go@@ -63,7 +63,7 @@ func (s *DataSourceService) FindDataSourceList(ctx context.Context, find *api.Dalist, err := s.findDataSourceList(ctx, tx.PTx, find)if err != nil {- return []*api.DataSource{}, err+ return nil, err}return list, nildiff --git a/store/database.go b/store/database.goindex d97cac8bc2..c3bcc32af5 100644--- a/store/database.go+++ b/store/database.go@@ -106,7 +106,7 @@ func (s *DatabaseService) FindDatabaseList(ctx context.Context, find *api.Databalist, err := s.findDatabaseList(ctx, tx.PTx, find)if err != nil {- return []*api.Database{}, err+ return nil, err}if err == nil {diff --git a/store/environment.go b/store/environment.goindex dbe4f132f0..63ea7750fa 100644--- a/store/environment.go+++ b/store/environment.go@@ -62,7 +62,7 @@ func (s *EnvironmentService) FindEnvironmentList(ctx context.Context, find *api.list, err := s.findEnvironmentList(ctx, tx.PTx, find)if err != nil {- return []*api.Environment{}, err+ return nil, err}if err == nil {diff --git a/store/inbox.go b/store/inbox.goindex 583c468d2d..5abc22fde9 100644--- a/store/inbox.go+++ b/store/inbox.go@@ -48,7 +48,7 @@ func (s *InboxService) CreateInbox(ctx context.Context, create *api.InboxCreate)return inbox, nil}-// FindInboxList retrieves a list of inboxs based on find.+// FindInboxList retrieves a list of inboxes based on find.func (s *InboxService) FindInboxList(ctx context.Context, find *api.InboxFind) ([]*api.Inbox, error) {tx, err := s.db.BeginTx(ctx, nil)if err != nil {@@ -58,7 +58,7 @@ func (s *InboxService) FindInboxList(ctx context.Context, find *api.InboxFind) (list, err := findInboxList(ctx, tx.PTx, find)if err != nil {- return []*api.Inbox{}, err+ return nil, err}return list, nildiff --git a/store/instance.go b/store/instance.goindex 42996ee972..b6f63ab47f 100644--- a/store/instance.go+++ b/store/instance.go@@ -94,7 +94,7 @@ func (s *InstanceService) FindInstanceList(ctx context.Context, find *api.Instanlist, err := findInstanceList(ctx, tx.PTx, find)if err != nil {- return []*api.Instance{}, err+ return nil, err}return list, nildiff --git a/store/instance_user.go b/store/instance_user.goindex e176fa6eaf..8a2dc9124d 100644--- a/store/instance_user.go+++ b/store/instance_user.go@@ -54,7 +54,7 @@ func (s *InstanceUserService) FindInstanceUserList(ctx context.Context, find *aplist, err := findInstanceUserList(ctx, tx.PTx, find)if err != nil {- return []*api.InstanceUser{}, err+ return nil, err}return list, nildiff --git a/store/issue.go b/store/issue.goindex 423f59f400..b03474ee59 100644--- a/store/issue.go+++ b/store/issue.go@@ -63,7 +63,7 @@ func (s *IssueService) FindIssueList(ctx context.Context, find *api.IssueFind) (list, err := s.findIssueList(ctx, tx.PTx, find)if err != nil {- return []*api.Issue{}, err+ return nil, err}if err == nil {diff --git a/store/issue_subscriber.go b/store/issue_subscriber.goindex 4fa5bad4ff..2e1b90ee5c 100644--- a/store/issue_subscriber.go+++ b/store/issue_subscriber.go@@ -55,7 +55,7 @@ func (s *IssueSubscriberService) FindIssueSubscriberList(ctx context.Context, filist, err := findIssueSubscriberList(ctx, tx.PTx, find)if err != nil {- return []*api.IssueSubscriber{}, err+ return nil, err}return list, nildiff --git a/store/member.go b/store/member.goindex 97f86c7ff3..f8db10269d 100644--- a/store/member.go+++ b/store/member.go@@ -62,7 +62,7 @@ func (s *MemberService) FindMemberList(ctx context.Context, find *api.MemberFindlist, err := findMemberList(ctx, tx.PTx, find)if err != nil {- return []*api.Member{}, err+ return nil, err}if err == nil {diff --git a/store/pipeline.go b/store/pipeline.goindex 579ecac274..af4cf054f2 100644--- a/store/pipeline.go+++ b/store/pipeline.go@@ -62,7 +62,7 @@ func (s *PipelineService) FindPipelineList(ctx context.Context, find *api.Pipelilist, err := s.findPipelineList(ctx, tx.PTx, find)if err != nil {- return []*api.Pipeline{}, err+ return nil, err}if err == nil {diff --git a/store/principal.go b/store/principal.goindex e74bb5c166..01d91b580e 100644--- a/store/principal.go+++ b/store/principal.go@@ -62,7 +62,7 @@ func (s *PrincipalService) FindPrincipalList(ctx context.Context) ([]*api.Princilist, err := findPrincipalList(ctx, tx.PTx, &api.PrincipalFind{})if err != nil {- return []*api.Principal{}, err+ return nil, err}if err == nil {diff --git a/store/project.go b/store/project.goindex 61d270cae9..ae395d8dee 100644--- a/store/project.go+++ b/store/project.go@@ -62,7 +62,7 @@ func (s *ProjectService) FindProjectList(ctx context.Context, find *api.ProjectFlist, err := findProjectList(ctx, tx.PTx, find)if err != nil {- return []*api.ProjectRaw{}, err+ return nil, err}if err == nil {diff --git a/store/project_member.go b/store/project_member.goindex adf0992574..6da37c6117 100644--- a/store/project_member.go+++ b/store/project_member.go@@ -56,7 +56,7 @@ func (s *ProjectMemberService) FindProjectMemberList(ctx context.Context, find *list, err := findProjectMemberList(ctx, tx.PTx, find)if err != nil {- return []*api.ProjectMember{}, err+ return nil, err}return list, nildiff --git a/store/project_webhook.go b/store/project_webhook.goindex 110397f784..3ca477852a 100644--- a/store/project_webhook.go+++ b/store/project_webhook.go@@ -57,7 +57,7 @@ func (s *ProjectWebhookService) FindProjectWebhookList(ctx context.Context, findlist, err := findProjectWebhookList(ctx, tx.PTx, find)if err != nil {- return []*api.ProjectWebhook{}, err+ return nil, err}return list, nildiff --git a/store/repository.go b/store/repository.goindex f1d7688534..2dc090d6bb 100644--- a/store/repository.go+++ b/store/repository.go@@ -48,7 +48,7 @@ func (s *RepositoryService) CreateRepository(ctx context.Context, create *api.Rereturn repository, nil}-// FindRepositoryList retrieves a list of repositorys based on find.+// FindRepositoryList retrieves a list of repositories based on find.func (s *RepositoryService) FindRepositoryList(ctx context.Context, find *api.RepositoryFind) ([]*api.Repository, error) {tx, err := s.db.BeginTx(ctx, nil)if err != nil {@@ -58,7 +58,7 @@ func (s *RepositoryService) FindRepositoryList(ctx context.Context, find *api.Relist, err := findRepositoryList(ctx, tx.PTx, find)if err != nil {- return []*api.Repository{}, err+ return nil, err}return list, nildiff --git a/store/setting.go b/store/setting.goindex 656336655d..7566ec08de 100644--- a/store/setting.go+++ b/store/setting.go@@ -69,7 +69,7 @@ func (s *SettingService) FindSettingList(ctx context.Context, find *api.SettingFlist, err := findSettingList(ctx, tx.PTx, find)if err != nil {- return []*api.Setting{}, err+ return nil, err}return list, nil}diff --git a/store/sheet.go b/store/sheet.goindex a19b993214..8a9932563f 100644--- a/store/sheet.go+++ b/store/sheet.go@@ -76,7 +76,7 @@ func (s *SheetService) FindSheetList(ctx context.Context, find *api.SheetFind) (list, err := findSheetList(ctx, tx.PTx, find)if err != nil {- return []*api.Sheet{}, err+ return nil, err}return list, nildiff --git a/store/stage.go b/store/stage.goindex 34f0cf77a6..a7e0020f3e 100644--- a/store/stage.go+++ b/store/stage.go@@ -56,7 +56,7 @@ func (s *StageService) FindStageList(ctx context.Context, find *api.StageFind) (list, err := s.findStageList(ctx, tx.PTx, find)if err != nil {- return []*api.Stage{}, err+ return nil, err}return list, nildiff --git a/store/table.go b/store/table.goindex 589b64144c..8f9072d04f 100644--- a/store/table.go+++ b/store/table.go@@ -56,7 +56,7 @@ func (s *TableService) FindTableList(ctx context.Context, find *api.TableFind) (list, err := s.findTableList(ctx, tx.PTx, find)if err != nil {- return []*api.Table{}, err+ return nil, err}return list, nildiff --git a/store/table_index.go b/store/table_index.goindex e7418d7093..e24ae2297e 100644--- a/store/table_index.go+++ b/store/table_index.go@@ -46,7 +46,7 @@ func (s *IndexService) CreateIndex(ctx context.Context, create *api.IndexCreate)return index, nil}-// FindIndexList retrieves a list of indexs based on find.+// FindIndexList retrieves a list of indexes based on find.func (s *IndexService) FindIndexList(ctx context.Context, find *api.IndexFind) ([]*api.Index, error) {tx, err := s.db.BeginTx(ctx, nil)if err != nil {@@ -56,7 +56,7 @@ func (s *IndexService) FindIndexList(ctx context.Context, find *api.IndexFind) (list, err := s.findIndexList(ctx, tx.PTx, find)if err != nil {- return []*api.Index{}, err+ return nil, err}return list, nildiff --git a/store/task.go b/store/task.goindex 5a204e1fe9..591d003183 100644--- a/store/task.go+++ b/store/task.go@@ -60,7 +60,7 @@ func (s *TaskService) FindTaskList(ctx context.Context, find *api.TaskFind) ([]*list, err := s.findTaskList(ctx, tx.PTx, find)if err != nil {- return []*api.Task{}, err+ return nil, err}return list, nil@@ -317,18 +317,20 @@ func (s *TaskService) findTaskList(ctx context.Context, tx *sql.Tx, find *api.TataskRunFind := &api.TaskRunFind{TaskID: &task.ID,}- task.TaskRunList, err = s.TaskRunService.FindTaskRunListTx(ctx, tx, taskRunFind)+ taskRunList, err := s.TaskRunService.FindTaskRunListTx(ctx, tx, taskRunFind)if err != nil {return nil, err}+ task.TaskRunList = taskRunListtaskCheckRunFind := &api.TaskCheckRunFind{TaskID: &task.ID,}- task.TaskCheckRunList, err = s.TaskCheckRunService.FindTaskCheckRunListTx(ctx, tx, taskCheckRunFind)+ taskCheckRunList, err := s.TaskCheckRunService.FindTaskCheckRunListTx(ctx, tx, taskCheckRunFind)if err != nil {return nil, err}+ task.TaskCheckRunList = taskCheckRunList}if err := rows.Err(); err != nil {return nil, FormatError(err)@@ -518,18 +520,20 @@ func (s *TaskService) patchTaskStatus(ctx context.Context, tx *sql.Tx, patch *aptaskRunFind := &api.TaskRunFind{TaskID: &task.ID,}- task.TaskRunList, err = s.TaskRunService.FindTaskRunListTx(ctx, tx, taskRunFind)+ taskRunList, err := s.TaskRunService.FindTaskRunListTx(ctx, tx, taskRunFind)if err != nil {return nil, err}+ task.TaskRunList = taskRunListtaskCheckRunFind := &api.TaskCheckRunFind{TaskID: &task.ID,}- task.TaskCheckRunList, err = s.TaskCheckRunService.FindTaskCheckRunListTx(ctx, tx, taskCheckRunFind)+ taskCheckRunList, err := s.TaskCheckRunService.FindTaskCheckRunListTx(ctx, tx, taskCheckRunFind)if err != nil {return nil, err}+ task.TaskCheckRunList = taskCheckRunListreturn t, nil}diff --git a/store/task_check_run.go b/store/task_check_run.goindex 59b28c8219..8266ce4aa2 100644--- a/store/task_check_run.go+++ b/store/task_check_run.go@@ -156,7 +156,7 @@ func (s *TaskCheckRunService) FindTaskCheckRunList(ctx context.Context, find *aplist, err := s.findTaskCheckRunList(ctx, tx.PTx, find)if err != nil {- return []*api.TaskCheckRun{}, err+ return nil, err}return list, nil@@ -166,7 +166,7 @@ func (s *TaskCheckRunService) FindTaskCheckRunList(ctx context.Context, find *apfunc (s *TaskCheckRunService) FindTaskCheckRunListTx(ctx context.Context, tx *sql.Tx, find *api.TaskCheckRunFind) ([]*api.TaskCheckRun, error) {list, err := s.findTaskCheckRunList(ctx, tx, find)if err != nil {- return []*api.TaskCheckRun{}, err+ return nil, err}return list, nildiff --git a/store/task_run.go b/store/task_run.goindex e17df46184..32087561f6 100644--- a/store/task_run.go+++ b/store/task_run.go@@ -84,7 +84,7 @@ func (s *TaskRunService) CreateTaskRunTx(ctx context.Context, tx *sql.Tx, createfunc (s *TaskRunService) FindTaskRunListTx(ctx context.Context, tx *sql.Tx, find *api.TaskRunFind) ([]*api.TaskRun, error) {list, err := s.findTaskRunList(ctx, tx, find)if err != nil {- return []*api.TaskRun{}, err+ return nil, err}return list, nildiff --git a/store/view.go b/store/view.goindex ef315fab30..3482c97e9e 100644--- a/store/view.go+++ b/store/view.go@@ -56,7 +56,7 @@ func (s *ViewService) FindViewList(ctx context.Context, find *api.ViewFind) ([]*list, err := s.findViewList(ctx, tx.PTx, find)if err != nil {- return []*api.View{}, err+ return nil, err}return list, nil