Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

rename Id to ID

p0ny31c7697b406b
diff --git a/api/activity.go b/api/activity.go
index 1310e2894a..20ca9192f7 100644
--- a/api/activity.go
+++ b/api/activity.go
@@ -97,7 +97,7 @@ type ActivityIssueCreatePayload struct {
// Used by inbox to display info without paying the join cost
IssueName string `json:"issueName"`
// If we create a rollback issue, this field records the issue id to be rolled back.
- RollbackIssueId int `json:"rollbackIssueId,omitempty"`
+ RollbackIssueID int `json:"rollbackIssueID,omitempty"`
}
type ActivityIssueCommentCreatePayload struct {
@@ -106,7 +106,7 @@ type ActivityIssueCommentCreatePayload struct {
}
type ActivityIssueFieldUpdatePayload struct {
- FieldId IssueFieldId `json:"fieldId"`
+ FieldID IssueFieldID `json:"fieldID"`
OldValue string `json:"oldValue,omitempty"`
NewValue string `json:"newValue,omitempty"`
// Used by inbox to display info without paying the join cost
@@ -121,7 +121,7 @@ type ActivityIssueStatusUpdatePayload struct {
}
type ActivityPipelineTaskStatusUpdatePayload struct {
- TaskId int `json:"taskId"`
+ TaskID int `json:"taskID"`
OldStatus TaskStatus `json:"oldStatus,omitempty"`
NewStatus TaskStatus `json:"newStatus,omitempty"`
// Used by inbox to display info without paying the join cost
@@ -130,16 +130,16 @@ type ActivityPipelineTaskStatusUpdatePayload struct {
}
type ActivityPipelineTaskFileCommitPayload struct {
- TaskId int `json:"taskId"`
+ TaskID int `json:"taskID"`
VCSInstanceURL string `json:"vcsInstanceUrl,omitempty"`
RepositoryFullPath string `json:"repositoryFullPath,omitempty"`
Branch string `json:"branch,omitempty"`
FilePath string `json:"filePath,omitempty"`
- CommitId string `json:"commitId,omitempty"`
+ CommitID string `json:"commitID,omitempty"`
}
type ActivityMemberCreatePayload struct {
- PrincipalId int `json:"principalId"`
+ PrincipalID int `json:"principalID"`
PrincipalName string `json:"principalName"`
PrincipalEmail string `json:"principalEmail"`
MemberStatus MemberStatus `json:"memberStatus"`
@@ -147,7 +147,7 @@ type ActivityMemberCreatePayload struct {
}
type ActivityMemberRoleUpdatePayload struct {
- PrincipalId int `json:"principalId"`
+ PrincipalID int `json:"principalID"`
PrincipalName string `json:"principalName"`
PrincipalEmail string `json:"principalEmail"`
OldRole Role `json:"oldRole"`
@@ -155,7 +155,7 @@ type ActivityMemberRoleUpdatePayload struct {
}
type ActivityMemberActivateDeactivatePayload struct {
- PrincipalId int `json:"principalId"`
+ PrincipalID int `json:"principalID"`
PrincipalName string `json:"principalName"`
PrincipalEmail string `json:"principalEmail"`
Role Role `json:"role"`
@@ -164,13 +164,13 @@ type ActivityMemberActivateDeactivatePayload struct {
type ActivityProjectRepositoryPushPayload struct {
VCSPushEvent common.VCSPushEvent `json:"pushEvent"`
// Used by activity table to display info without paying the join cost
- // IssueId/IssueName only exist if the push event leads to the issue creation.
- IssueId int `json:"issueId,omitempty"`
+ // IssueID/IssueName only exist if the push event leads to the issue creation.
+ IssueID int `json:"issueID,omitempty"`
IssueName string `json:"issueName,omitempty"`
}
type ActivityProjectDatabaseTransferPayload struct {
- DatabaseId int `json:"databaseId,omitempty"`
+ DatabaseID int `json:"databaseID,omitempty"`
// Used by activity table to display info without paying the join cost
DatabaseName string `json:"databaseName,omitempty"`
}
@@ -179,16 +179,16 @@ type Activity struct {
ID int `jsonapi:"primary,activity"`
// Standard fields
- CreatorId int
+ CreatorID int
Creator *Principal `jsonapi:"attr,creator"`
CreatedTs int64 `jsonapi:"attr,createdTs"`
- UpdaterId int
+ UpdaterID int
Updater *Principal `jsonapi:"attr,updater"`
UpdatedTs int64 `jsonapi:"attr,updatedTs"`
// Related fields
// The object where this activity belongs
// e.g if Type is "bb.issue.xxx", then this field refers to the corresponding issue's id.
- ContainerId int `jsonapi:"attr,containerId"`
+ ContainerID int `jsonapi:"attr,containerID"`
// Domain specific fields
Type ActivityType `jsonapi:"attr,type"`
@@ -200,10 +200,10 @@ type Activity struct {
type ActivityCreate struct {
// Standard fields
// Value is assigned from the jwt subject field passed by the client.
- CreatorId int
+ CreatorID int
// Domain specific fields
- ContainerId int `jsonapi:"attr,containerId"`
+ ContainerID int `jsonapi:"attr,containerID"`
Type ActivityType `jsonapi:"attr,type"`
Level ActivityLevel
Comment string `jsonapi:"attr,comment"`
@@ -214,7 +214,7 @@ type ActivityFind struct {
ID *int
// Domain specific fields
- ContainerId *int
+ ContainerID *int
Limit *int
}
@@ -231,7 +231,7 @@ type ActivityPatch struct {
// Standard fields
// Value is assigned from the jwt subject field passed by the client.
- UpdaterId int
+ UpdaterID int
// Domain specific fields
Comment *string `jsonapi:"attr,comment"`
@@ -242,7 +242,7 @@ type ActivityDelete struct {
// Standard fields
// Value is assigned from the jwt subject field passed by the client.
- DeleterId int
+ DeleterID int
}
type ActivityService interface {
diff --git a/api/anomaly.go b/api/anomaly.go
index 95d7232fce..e1012e8968 100644
--- a/api/anomaly.go
+++ b/api/anomaly.go
@@ -46,7 +46,7 @@ type AnomalyInstanceConnectionPayload struct {
}
type AnomalyDatabaseBackupPolicyViolationPayload struct {
- EnvironmentId int `json:"environmentId,omitempty"`
+ EnvironmentID int `json:"environmentID,omitempty"`
ExpectedBackupSchedule BackupPlanPolicySchedule `json:"expectedSchedule,omitempty"`
ActualBackupSchedule BackupPlanPolicySchedule `json:"actualSchedule,omitempty"`
}
@@ -75,17 +75,17 @@ type Anomaly struct {
ID int `jsonapi:"primary,anomaly"`
// Standard fields
- CreatorId int
+ CreatorID int
Creator *Principal `jsonapi:"attr,creator"`
CreatedTs int64 `jsonapi:"attr,createdTs"`
- UpdaterId int
+ UpdaterID int
Updater *Principal `jsonapi:"attr,updater"`
UpdatedTs int64 `jsonapi:"attr,updatedTs"`
// Related fields
- InstanceId int `jsonapi:"attr,instanceId"`
- // Instance anomaly doesn't have databaseId
- DatabaseId *int `jsonapi:"attr,databaseId"`
+ InstanceID int `jsonapi:"attr,instanceID"`
+ // Instance anomaly doesn't have databaseID
+ DatabaseID *int `jsonapi:"attr,databaseID"`
// Domain specific fields
Type AnomalyType `jsonapi:"attr,type"`
@@ -96,11 +96,11 @@ type Anomaly struct {
type AnomalyUpsert struct {
// Standard fields
- CreatorId int
+ CreatorID int
// Related fields
- InstanceId int
- DatabaseId *int
+ InstanceID int
+ DatabaseID *int
// Domain specific fields
Type AnomalyType `jsonapi:"attr,type"`
@@ -112,10 +112,10 @@ type AnomalyFind struct {
RowStatus *RowStatus
// Related fields
- InstanceId *int
- DatabaseId *int
+ InstanceID *int
+ DatabaseID *int
Type *AnomalyType
- // Only applicable if InstanceId is specified, if true, then we only return instance anomaly (database_id is NULL)
+ // Only applicable if InstanceID is specified, if true, then we only return instance anomaly (database_id is NULL)
InstanceOnly bool
}
@@ -128,8 +128,8 @@ func (find *AnomalyFind) String() string {
}
type AnomalyArchive struct {
- InstanceId *int
- DatabaseId *int
+ InstanceID *int
+ DatabaseID *int
Type AnomalyType
}
diff --git a/api/backup.go b/api/backup.go
index a43e9691a9..03df439c67 100644
--- a/api/backup.go
+++ b/api/backup.go
@@ -70,15 +70,15 @@ type Backup struct {
ID int `jsonapi:"primary,backup"`
// Standard fields
- CreatorId int
+ CreatorID int
Creator *Principal `jsonapi:"attr,creator"`
CreatedTs int64 `jsonapi:"attr,createdTs"`
- UpdaterId int
+ UpdaterID int
Updater *Principal `jsonapi:"attr,updater"`
UpdatedTs int64 `jsonapi:"attr,updatedTs"`
// Related fields
- DatabaseId int `jsonapi:"attr,databaseId"`
+ DatabaseID int `jsonapi:"attr,databaseID"`
// Domain specific fields
Name string `jsonapi:"attr,name"`
@@ -95,10 +95,10 @@ type Backup struct {
type BackupCreate struct {
// Standard fields
// Value is assigned from the jwt subject field passed by the client.
- CreatorId int
+ CreatorID int
// Related fields
- DatabaseId int `jsonapi:"attr,databaseId"`
+ DatabaseID int `jsonapi:"attr,databaseID"`
// Domain specific fields
Name string `jsonapi:"attr,name"`
@@ -113,7 +113,7 @@ type BackupFind struct {
ID *int
// Related fields
- DatabaseId *int
+ DatabaseID *int
// Domain specific fields
Name *string
@@ -133,7 +133,7 @@ type BackupPatch struct {
// Standard fields
// Value is assigned from the jwt subject field passed by the client.
- UpdaterId int
+ UpdaterID int
// Domain specific fields
Status string
@@ -145,15 +145,15 @@ type BackupSetting struct {
ID int `jsonapi:"primary,backupSetting"`
// Standard fields
- CreatorId int
+ CreatorID int
Creator *Principal `jsonapi:"attr,creator"`
CreatedTs int64 `jsonapi:"attr,createdTs"`
- UpdaterId int
+ UpdaterID int
Updater *Principal `jsonapi:"attr,updater"`
UpdatedTs int64 `jsonapi:"attr,updatedTs"`
// Related fields
- DatabaseId int `jsonapi:"attr,databaseId"`
+ DatabaseID int `jsonapi:"attr,databaseID"`
// Do not return this to the client since the client always has the database context and fetching the
// database object and all its own related objects is a bit expensive.
Database *Database
@@ -171,7 +171,7 @@ type BackupSettingFind struct {
ID *int
// Related fields
- DatabaseId *int
+ DatabaseID *int
// Domain specific fields
}
@@ -181,12 +181,12 @@ type BackupSettingFind struct {
type BackupSettingUpsert struct {
// Standard fields
// Value is assigned from the jwt subject field passed by the client.
- // CreatorId is the ID of the creator.
- UpdaterId int
+ // CreatorID is the ID of the creator.
+ UpdaterID int
// Related fields
- DatabaseId int `jsonapi:"attr,databaseId"`
- EnvironmentId int
+ DatabaseID int `jsonapi:"attr,databaseID"`
+ EnvironmentID int
// Domain specific fields
Enabled bool `jsonapi:"attr,enabled"`
diff --git a/api/bookmark.go b/api/bookmark.go
index 0e0972101c..b93dccd4f0 100644
--- a/api/bookmark.go
+++ b/api/bookmark.go
@@ -9,10 +9,10 @@ type Bookmark struct {
ID int `jsonapi:"primary,bookmark"`
// Standard fields
- CreatorId int
+ CreatorID int
Creator *Principal `jsonapi:"attr,creator"`
CreatedTs int64 `jsonapi:"attr,createdTs"`
- UpdaterId int
+ UpdaterID int
Updater *Principal `jsonapi:"attr,updater"`
UpdatedTs int64 `jsonapi:"attr,updatedTs"`
@@ -24,7 +24,7 @@ type Bookmark struct {
type BookmarkCreate struct {
// Standard fields
// Value is assigned from the jwt subject field passed by the client.
- CreatorId int
+ CreatorID int
// Domain specific fields
Name string `jsonapi:"attr,name"`
@@ -35,7 +35,7 @@ type BookmarkFind struct {
ID *int
// Standard fields
- CreatorId *int
+ CreatorID *int
}
func (find *BookmarkFind) String() string {
@@ -51,7 +51,7 @@ type BookmarkDelete struct {
// Standard fields
// Value is assigned from the jwt subject field passed by the client.
- DeleterId int
+ DeleterID int
}
type BookmarkService interface {
diff --git a/api/column.go b/api/column.go
index 1eb90059e4..115a4570aa 100644
--- a/api/column.go
+++ b/api/column.go
@@ -9,14 +9,14 @@ type Column struct {
ID int `jsonapi:"primary,column"`
// Standard fields
- CreatorId int
+ CreatorID int
CreatedTs int64 `json:"createdTs"`
- UpdaterId int
+ UpdaterID int
UpdatedTs int64 `json:"updatedTs"`
// Related fields
- DatabaseId int
- TableId int
+ DatabaseID int
+ TableID int
// Domain specific fields
Name string `json:"name"`
@@ -32,11 +32,11 @@ type Column struct {
type ColumnCreate struct {
// Standard fields
// Value is assigned from the jwt subject field passed by the client.
- CreatorId int
+ CreatorID int
// Related fields
- DatabaseId int
- TableId int
+ DatabaseID int
+ TableID int
// Domain specific fields
Name string
@@ -53,8 +53,8 @@ type ColumnFind struct {
ID *int
// Related fields
- DatabaseId *int
- TableId *int
+ DatabaseID *int
+ TableID *int
// Domain specific fields
Name *string
@@ -73,7 +73,7 @@ type ColumnPatch struct {
// Standard fields
// Value is assigned from the jwt subject field passed by the client.
- UpdaterId int
+ UpdaterID int
}
type ColumnService interface {
diff --git a/api/data_source.go b/api/data_source.go
index 2072c36d3b..c7b772a655 100644
--- a/api/data_source.go
+++ b/api/data_source.go
@@ -34,17 +34,17 @@ type DataSource struct {
ID int `jsonapi:"primary,dataSource"`
// Standard fields
- CreatorId int
+ CreatorID int
Creator *Principal `jsonapi:"attr,creator"`
CreatedTs int64 `jsonapi:"attr,createdTs"`
- UpdaterId int
+ UpdaterID int
Updater *Principal `jsonapi:"attr,updater"`
UpdatedTs int64 `jsonapi:"attr,updatedTs"`
// Related fields
- // Just returns InstanceId and DatabaseId otherwise would cause circular dependency.
- InstanceId int `jsonapi:"attr,instanceId"`
- DatabaseId int `jsonapi:"attr,databaseId"`
+ // Just returns InstanceID and DatabaseID otherwise would cause circular dependency.
+ InstanceID int `jsonapi:"attr,instanceID"`
+ DatabaseID int `jsonapi:"attr,databaseID"`
// Domain specific fields
Name string `jsonapi:"attr,name"`
@@ -56,11 +56,11 @@ type DataSource struct {
type DataSourceCreate struct {
// Standard fields
// Value is assigned from the jwt subject field passed by the client.
- CreatorId int
+ CreatorID int
// Related fields
- InstanceId int
- DatabaseId int
+ InstanceID int
+ DatabaseID int
// Domain specific fields
Name string `jsonapi:"attr,name"`
@@ -71,8 +71,8 @@ type DataSourceCreate struct {
type DataSourceFind struct {
// Related fields
- InstanceId *int
- DatabaseId *int
+ InstanceID *int
+ DatabaseID *int
// Domain specific fields
Type *DataSourceType
@@ -91,7 +91,7 @@ type DataSourcePatch struct {
// Standard fields
// Value is assigned from the jwt subject field passed by the client.
- UpdaterId int
+ UpdaterID int
// Domain specific fields
Username *string `jsonapi:"attr,username"`
diff --git a/api/database.go b/api/database.go
index 19d362ea0f..077ba75bb2 100644
--- a/api/database.go
+++ b/api/database.go
@@ -35,20 +35,20 @@ type Database struct {
ID int `jsonapi:"primary,database"`
// Standard fields
- CreatorId int
+ CreatorID int
Creator *Principal `jsonapi:"attr,creator"`
CreatedTs int64 `jsonapi:"attr,createdTs"`
- UpdaterId int
+ UpdaterID int
Updater *Principal `jsonapi:"attr,updater"`
UpdatedTs int64 `jsonapi:"attr,updatedTs"`
// Related fields
- ProjectId int
+ ProjectID int
Project *Project `jsonapi:"relation,project"`
- InstanceId int
+ InstanceID int
Instance *Instance `jsonapi:"relation,instance"`
DataSourceList []*DataSource `jsonapi:"relation,dataSource"`
- SourceBackupId int
+ SourceBackupID int
SourceBackup *Backup `jsonapi:"relation,sourceBackup"`
// Anomalies are stored in a separate table, but just return here for convenience
AnomalyList []*Anomaly `jsonapi:"relation,anomaly"`
@@ -64,26 +64,26 @@ type Database struct {
type DatabaseCreate struct {
// Standard fields
// Value is assigned from the jwt subject field passed by the client.
- CreatorId int
+ CreatorID int
// Related fields
- ProjectId int `jsonapi:"attr,projectId"`
- InstanceId int `jsonapi:"attr,instanceId"`
- EnvironmentId int
+ ProjectID int `jsonapi:"attr,projectID"`
+ InstanceID int `jsonapi:"attr,instanceID"`
+ EnvironmentID int
// Domain specific fields
Name string `jsonapi:"attr,name"`
CharacterSet string `jsonapi:"attr,characterSet"`
Collation string `jsonapi:"attr,collation"`
- IssueId int `jsonapi:"attr,issueId"`
+ IssueID int `jsonapi:"attr,issueID"`
}
type DatabaseFind struct {
ID *int
// Related fields
- InstanceId *int
- ProjectId *int
+ InstanceID *int
+ ProjectID *int
// Domain specific fields
Name *string
@@ -103,11 +103,11 @@ type DatabasePatch struct {
// Standard fields
// Value is assigned from the jwt subject field passed by the client.
- UpdaterId int
+ UpdaterID int
// Related fields
- ProjectId *int `jsonapi:"attr,projectId"`
- SourceBackupId *int
+ ProjectID *int `jsonapi:"attr,projectID"`
+ SourceBackupID *int
// Domain specific fields
SyncStatus *SyncStatus
diff --git a/api/environment.go b/api/environment.go
index 84b835b77a..4468358964 100644
--- a/api/environment.go
+++ b/api/environment.go
@@ -10,10 +10,10 @@ type Environment struct {
// Standard fields
RowStatus RowStatus `jsonapi:"attr,rowStatus"`
- CreatorId int
+ CreatorID int
Creator *Principal `jsonapi:"attr,creator"`
CreatedTs int64 `jsonapi:"attr,createdTs"`
- UpdaterId int
+ UpdaterID int
Updater *Principal `jsonapi:"attr,updater"`
UpdatedTs int64 `jsonapi:"attr,updatedTs"`
@@ -25,7 +25,7 @@ type Environment struct {
type EnvironmentCreate struct {
// Standard fields
// Value is assigned from the jwt subject field passed by the client.
- CreatorId int
+ CreatorID int
// Domain specific fields
Name string `jsonapi:"attr,name"`
@@ -52,7 +52,7 @@ type EnvironmentPatch struct {
// Standard fields
RowStatus *string `jsonapi:"attr,rowStatus"`
// Value is assigned from the jwt subject field passed by the client.
- UpdaterId int
+ UpdaterID int
// Domain specific fields
Name *string `jsonapi:"attr,name"`
@@ -64,7 +64,7 @@ type EnvironmentDelete struct {
// Standard fields
// Value is assigned from the jwt subject field passed by the client.
- DeleterId int
+ DeleterID int
}
type EnvironmentService interface {
diff --git a/api/inbox.go b/api/inbox.go
index ecc78290cd..39bcd22a3a 100644
--- a/api/inbox.go
+++ b/api/inbox.go
@@ -26,22 +26,22 @@ type Inbox struct {
ID int `jsonapi:"primary,inbox"`
// Domain specific fields
- ReceiverId int `jsonapi:"attr,receiverId"`
+ ReceiverID int `jsonapi:"attr,receiverID"`
Activity *Activity `jsonapi:"relation,activity"`
Status InboxStatus `jsonapi:"attr,status"`
}
type InboxCreate struct {
// Domain specific fields
- ReceiverId int
- ActivityId int
+ ReceiverID int
+ ActivityID int
}
type InboxFind struct {
ID *int
// Domain specific fields
- ReceiverId *int
+ ReceiverID *int
// If specified, then it will only fetch "UNREAD" item or "READ" item whose activity created after "CreatedAfterTs"
ReadCreatedAfterTs *int64
}
@@ -75,5 +75,5 @@ type InboxService interface {
FindInboxList(ctx context.Context, find *InboxFind) ([]*Inbox, error)
FindInbox(ctx context.Context, find *InboxFind) (*Inbox, error)
PatchInbox(ctx context.Context, patch *InboxPatch) (*Inbox, error)
- FindInboxSummary(ctx context.Context, principalId int) (*InboxSummary, error)
+ FindInboxSummary(ctx context.Context, principalID int) (*InboxSummary, error)
}
diff --git a/api/instance.go b/api/instance.go
index e77b8a37cd..eb546d9e76 100644
--- a/api/instance.go
+++ b/api/instance.go
@@ -12,15 +12,15 @@ type Instance struct {
// Standard fields
RowStatus RowStatus `jsonapi:"attr,rowStatus"`
- CreatorId int
+ CreatorID int
Creator *Principal `jsonapi:"attr,creator"`
CreatedTs int64 `jsonapi:"attr,createdTs"`
- UpdaterId int
+ UpdaterID int
Updater *Principal `jsonapi:"attr,updater"`
UpdatedTs int64 `jsonapi:"attr,updatedTs"`
// Related fields
- EnvironmentId int
+ EnvironmentID int
Environment *Environment `jsonapi:"relation,environment"`
// Anomalies are stored in a separate table, but just return here for convenience
AnomalyList []*Anomaly `jsonapi:"relation,anomaly"`
@@ -40,10 +40,10 @@ type Instance struct {
type InstanceCreate struct {
// Standard fields
// Value is assigned from the jwt subject field passed by the client.
- CreatorId int
+ CreatorID int
// Related fields
- EnvironmentId int `jsonapi:"attr,environmentId"`
+ EnvironmentID int `jsonapi:"attr,environmentID"`
// Domain specific fields
Name string `jsonapi:"attr,name"`
@@ -76,7 +76,7 @@ type InstancePatch struct {
// Standard fields
RowStatus *string `jsonapi:"attr,rowStatus"`
// Value is assigned from the jwt subject field passed by the client.
- UpdaterId int
+ UpdaterID int
// Domain specific fields
Name *string `jsonapi:"attr,name"`
@@ -139,7 +139,7 @@ type MigrationHistory struct {
SchemaPrev string `jsonapi:"attr,schemaPrev"`
ExecutionDuration int `jsonapi:"attr,executionDuration"`
// This is a string instead of int as the issue id may come from other issue tracking system in the future
- IssueId string `jsonapi:"attr,issueId"`
+ IssueID string `jsonapi:"attr,issueID"`
Payload string `jsonapi:"attr,payload"`
}
diff --git a/api/instance_user.go b/api/instance_user.go
index c8ad54ccb1..b4cfe04f47 100644
--- a/api/instance_user.go
+++ b/api/instance_user.go
@@ -9,7 +9,7 @@ type InstanceUser struct {
ID int `jsonapi:"primary,instanceUser"`
// Related fields
- InstanceId int `jsonapi:"attr,instanceId"`
+ InstanceID int `jsonapi:"attr,instanceID"`
// Domain specific fields
Name string `jsonapi:"attr,name"`
@@ -18,10 +18,10 @@ type InstanceUser struct {
type InstanceUserUpsert struct {
// Standard fields
- CreatorId int
+ CreatorID int
// Related fields
- InstanceId int
+ InstanceID int
// Domain specific fields
Name string `jsonapi:"attr,name"`
@@ -29,7 +29,7 @@ type InstanceUserUpsert struct {
}
type InstanceUserFind struct {
- InstanceId int
+ InstanceID int
}
func (find *InstanceUserFind) String() string {
diff --git a/api/issue.go b/api/issue.go
index a2855d486d..6e619ad066 100644
--- a/api/issue.go
+++ b/api/issue.go
@@ -54,34 +54,34 @@ func (e IssueType) String() string {
}
// It has to be string type because the id for stage field contain multiple parts.
-type IssueFieldId string
+type IssueFieldID string
const (
- IssueFieldName IssueFieldId = "1"
- IssueFieldStatus IssueFieldId = "2"
- IssueFieldAssignee IssueFieldId = "3"
- IssueFieldDescription IssueFieldId = "4"
- IssueFieldProject IssueFieldId = "5"
- IssueFieldSubscriberList IssueFieldId = "6"
- IssueFieldSql IssueFieldId = "7"
- IssueFieldRollbackSql IssueFieldId = "8"
+ IssueFieldName IssueFieldID = "1"
+ IssueFieldStatus IssueFieldID = "2"
+ IssueFieldAssignee IssueFieldID = "3"
+ IssueFieldDescription IssueFieldID = "4"
+ IssueFieldProject IssueFieldID = "5"
+ IssueFieldSubscriberList IssueFieldID = "6"
+ IssueFieldSql IssueFieldID = "7"
+ IssueFieldRollbackSql IssueFieldID = "8"
)
type Issue struct {
ID int `jsonapi:"primary,issue"`
// Standard fields
- CreatorId int
+ CreatorID int
Creator *Principal `jsonapi:"attr,creator"`
CreatedTs int64 `jsonapi:"attr,createdTs"`
- UpdaterId int
+ UpdaterID int
Updater *Principal `jsonapi:"attr,updater"`
UpdatedTs int64 `jsonapi:"attr,updatedTs"`
// Related fields
- ProjectId int
+ ProjectID int
Project *Project `jsonapi:"relation,project"`
- PipelineId int
+ PipelineID int
Pipeline *Pipeline `jsonapi:"relation,pipeline"`
// Domain specific fields
@@ -89,29 +89,29 @@ type Issue struct {
Status IssueStatus `jsonapi:"attr,status"`
Type IssueType `jsonapi:"attr,type"`
Description string `jsonapi:"attr,description"`
- AssigneeId int `jsonapi:"attr,assigneeId"`
+ AssigneeID int `jsonapi:"attr,assigneeID"`
Assignee *Principal `jsonapi:"attr,assignee"`
- SubscriberIdList []int `jsonapi:"attr,subscriberIdList"`
+ SubscriberIDList []int `jsonapi:"attr,subscriberIDList"`
Payload string `jsonapi:"attr,payload"`
}
type IssueCreate struct {
// Standard fields
// Value is assigned from the jwt subject field passed by the client.
- CreatorId int
+ CreatorID int
// Related fields
- ProjectId int `jsonapi:"attr,projectId"`
- PipelineId int
+ ProjectID int `jsonapi:"attr,projectID"`
+ PipelineID int
Pipeline PipelineCreate `jsonapi:"attr,pipeline"`
// Domain specific fields
Name string `jsonapi:"attr,name"`
Type IssueType `jsonapi:"attr,type"`
Description string `jsonapi:"attr,description"`
- AssigneeId int `jsonapi:"attr,assigneeId"`
- SubscriberIdList []int `jsonapi:"attr,subscriberIdList"`
- RollbackIssueId *int `jsonapi:"attr,rollbackIssueId"`
+ AssigneeID int `jsonapi:"attr,assigneeID"`
+ SubscriberIDList []int `jsonapi:"attr,subscriberIDList"`
+ RollbackIssueID *int `jsonapi:"attr,rollbackIssueID"`
Payload string `jsonapi:"attr,payload"`
}
@@ -119,12 +119,12 @@ type IssueFind struct {
ID *int
// Related fields
- ProjectId *int
+ ProjectID *int
// Domain specific fields
- PipelineId *int
- // Find issue where principalId is either creator, assignee or subscriber
- PrincipalId *int
+ PipelineID *int
+ // Find issue where principalID is either creator, assignee or subscriber
+ PrincipalID *int
StatusList *[]IssueStatus
// If specified, then it will only fetch "Limit" most recently updated issues
Limit *int
@@ -143,14 +143,14 @@ type IssuePatch struct {
// Standard fields
// Value is assigned from the jwt subject field passed by the client.
- UpdaterId int
+ UpdaterID int
// Domain specific fields
Name *string `jsonapi:"attr,name"`
// Status is only set manualy via IssueStatusPatch
Status *IssueStatus
Description *string `jsonapi:"attr,description"`
- AssigneeId *int `jsonapi:"attr,assigneeId"`
+ AssigneeID *int `jsonapi:"attr,assigneeID"`
Payload *string `jsonapi:"attr,payload"`
}
@@ -159,7 +159,7 @@ type IssueStatusPatch struct {
// Standard fields
// Value is assigned from the jwt subject field passed by the client.
- UpdaterId int
+ UpdaterID int
// Domain specific fields
Status IssueStatus `jsonapi:"attr,status"`
diff --git a/api/issue_subscriber.go b/api/issue_subscriber.go
index ac4ab4817f..b51bb16b54 100644
--- a/api/issue_subscriber.go
+++ b/api/issue_subscriber.go
@@ -4,27 +4,27 @@ import "context"
type IssueSubscriber struct {
// Domain specific fields
- IssueId int `jsonapi:"attr,issueId"`
- SubscriberId int
+ IssueID int `jsonapi:"attr,issueID"`
+ SubscriberID int
Subscriber *Principal `jsonapi:"attr,subscriber"`
}
type IssueSubscriberCreate struct {
// Domain specific fields
- IssueId int
- SubscriberId int `jsonapi:"attr,subscriberId"`
+ IssueID int
+ SubscriberID int `jsonapi:"attr,subscriberID"`
}
type IssueSubscriberFind struct {
// Domain specific fields
- IssueId *int
- SubscriberId *int
+ IssueID *int
+ SubscriberID *int
}
type IssueSubscriberDelete struct {
// Domain specific fields
- IssueId int
- SubscriberId int
+ IssueID int
+ SubscriberID int
}
type IssueSubscriberService interface {
diff --git a/api/member.go b/api/member.go
index 993a2af79d..83c2694e2d 100644
--- a/api/member.go
+++ b/api/member.go
@@ -50,36 +50,36 @@ type Member struct {
// Standard fields
RowStatus RowStatus `jsonapi:"attr,rowStatus"`
- CreatorId int
+ CreatorID int
Creator *Principal `jsonapi:"attr,creator"`
CreatedTs int64 `jsonapi:"attr,createdTs"`
- UpdaterId int
+ UpdaterID int
Updater *Principal `jsonapi:"attr,updater"`
UpdatedTs int64 `jsonapi:"attr,updatedTs"`
// Domain specific fields
Status MemberStatus `jsonapi:"attr,status"`
Role Role `jsonapi:"attr,role"`
- PrincipalId int
+ PrincipalID int
Principal *Principal `jsonapi:"attr,principal"`
}
type MemberCreate struct {
// Standard fields
// Value is assigned from the jwt subject field passed by the client.
- CreatorId int
+ CreatorID int
// Domain specific fields
Status MemberStatus `jsonapi:"attr,status"`
Role Role `jsonapi:"attr,role"`
- PrincipalId int `jsonapi:"attr,principalId"`
+ PrincipalID int `jsonapi:"attr,principalID"`
}
type MemberFind struct {
ID *int
// Domain specific fields
- PrincipalId *int
+ PrincipalID *int
Role *Role
}
@@ -97,7 +97,7 @@ type MemberPatch struct {
// Standard fields
RowStatus *string `jsonapi:"attr,rowStatus"`
// Value is assigned from the jwt subject field passed by the client.
- UpdaterId int
+ UpdaterID int
// Domain specific fields
Role *string `jsonapi:"attr,role"`
diff --git a/api/pipeline.go b/api/pipeline.go
index e8fbfc0173..a4f9947833 100644
--- a/api/pipeline.go
+++ b/api/pipeline.go
@@ -32,10 +32,10 @@ type Pipeline struct {
ID int `jsonapi:"primary,pipeline"`
// Standard fields
- CreatorId int
+ CreatorID int
Creator *Principal `jsonapi:"attr,creator"`
CreatedTs int64 `jsonapi:"attr,createdTs"`
- UpdaterId int
+ UpdaterID int
Updater *Principal `jsonapi:"attr,updater"`
UpdatedTs int64 `jsonapi:"attr,updatedTs"`
@@ -50,7 +50,7 @@ type Pipeline struct {
type PipelineCreate struct {
// Standard fields
// Value is assigned from the jwt subject field passed by the client.
- CreatorId int
+ CreatorID int
// Related fields
StageList []StageCreate `jsonapi:"attr,stageList"`
@@ -79,7 +79,7 @@ type PipelinePatch struct {
// Standard fields
// Value is assigned from the jwt subject field passed by the client.
- UpdaterId int
+ UpdaterID int
// Domain specific fields
Status *PipelineStatus `jsonapi:"attr,status"`
diff --git a/api/policy.go b/api/policy.go
index 7ada4b8606..06b7cbb50c 100644
--- a/api/policy.go
+++ b/api/policy.go
@@ -47,15 +47,15 @@ type Policy struct {
// Standard fields
RowStatus RowStatus `jsonapi:"attr,rowStatus"`
- CreatorId int
+ CreatorID int
Creator *Principal `jsonapi:"attr,creator"`
CreatedTs int64 `jsonapi:"attr,createdTs"`
- UpdaterId int
+ UpdaterID int
Updater *Principal `jsonapi:"attr,updater"`
UpdatedTs int64 `jsonapi:"attr,updatedTs"`
// Related fields
- EnvironmentId int
+ EnvironmentID int
Environment *Environment `jsonapi:"relation,environment"`
// Domain specific fields
@@ -68,7 +68,7 @@ type PolicyFind struct {
ID *int
// Related fields
- EnvironmentId *int
+ EnvironmentID *int
// Domain specific fields
Type *PolicyType `jsonapi:"attr,type"`
@@ -79,11 +79,11 @@ type PolicyFind struct {
type PolicyUpsert struct {
// Standard fields
// Value is assigned from the jwt subject field passed by the client.
- // CreatorId is the ID of the creator.
- UpdaterId int
+ // CreatorID is the ID of the creator.
+ UpdaterID int
// Related fields
- EnvironmentId int
+ EnvironmentID int
// Domain specific fields
Type PolicyType
diff --git a/api/principal.go b/api/principal.go
index 4df5fdab3b..6ccbc4be5c 100644
--- a/api/principal.go
+++ b/api/principal.go
@@ -28,9 +28,9 @@ type Principal struct {
ID int `jsonapi:"primary,principal"`
// Standard fields
- CreatorId int `jsonapi:"attr,creatorId"`
+ CreatorID int `jsonapi:"attr,creatorID"`
CreatedTs int64 `jsonapi:"attr,createdTs"`
- UpdaterId int `jsonapi:"attr,updaterId"`
+ UpdaterID int `jsonapi:"attr,updaterID"`
UpdatedTs int64 `jsonapi:"attr,updatedTs"`
// Domain specific fields
@@ -49,9 +49,9 @@ type Principal struct {
func (p *Principal) MarshalJSON() ([]byte, error) {
return json.Marshal(&struct {
ID int `json:"id"`
- CreatorId int `json:"creatorId"`
+ CreatorID int `json:"creatorID"`
CreatedTs int64 `json:"createdTs"`
- UpdaterId int `json:"updaterId"`
+ UpdaterID int `json:"updaterID"`
UpdatedTs int64 `json:"updatedTs"`
Type PrincipalType `json:"type"`
Name string `json:"name"`
@@ -59,9 +59,9 @@ func (p *Principal) MarshalJSON() ([]byte, error) {
Role Role `json:"role"`
}{
ID: p.ID,
- CreatorId: p.CreatorId,
+ CreatorID: p.CreatorID,
CreatedTs: p.CreatedTs,
- UpdaterId: p.UpdaterId,
+ UpdaterID: p.UpdaterID,
UpdatedTs: p.UpdatedTs,
Type: p.Type,
Name: p.Name,
@@ -74,7 +74,7 @@ type PrincipalCreate struct {
// Standard fields
// For signup, value is SYSTEM_BOT_ID
// For invite, value is assigned from the jwt subject field passed by the client.
- CreatorId int
+ CreatorID int
// Domain specific fields
Type PrincipalType
@@ -104,7 +104,7 @@ type PrincipalPatch struct {
// Standard fields
// Value is assigned from the jwt subject field passed by the client.
- UpdaterId int
+ UpdaterID int
// Domain specific fields
Name *string `jsonapi:"attr,name"`
diff --git a/api/project.go b/api/project.go
index b5d309c2f1..1c9ad93f8c 100644
--- a/api/project.go
+++ b/api/project.go
@@ -47,10 +47,10 @@ type Project struct {
// Standard fields
RowStatus RowStatus `jsonapi:"attr,rowStatus"`
- CreatorId int
+ CreatorID int
Creator *Principal `jsonapi:"attr,creator"`
CreatedTs int64 `jsonapi:"attr,createdTs"`
- UpdaterId int
+ UpdaterID int
Updater *Principal `jsonapi:"attr,updater"`
UpdatedTs int64 `jsonapi:"attr,updatedTs"`
@@ -67,7 +67,7 @@ type Project struct {
type ProjectCreate struct {
// Standard fields
// Value is assigned from the jwt subject field passed by the client.
- CreatorId int
+ CreatorID int
// Domain specific fields
Name string `jsonapi:"attr,name"`
@@ -81,8 +81,8 @@ type ProjectFind struct {
RowStatus *RowStatus
// Domain specific fields
- // If present, will only find project containing PrincipalId as a member
- PrincipalId *int
+ // If present, will only find project containing PrincipalID as a member
+ PrincipalID *int
}
func (find *ProjectFind) String() string {
@@ -99,7 +99,7 @@ type ProjectPatch struct {
// Standard fields
RowStatus *string `jsonapi:"attr,rowStatus"`
// Value is assigned from the jwt subject field passed by the client.
- UpdaterId int
+ UpdaterID int
// Domain specific fields
Name *string `jsonapi:"attr,name"`
diff --git a/api/project_member.go b/api/project_member.go
index 1a9cd2e557..728391defe 100644
--- a/api/project_member.go
+++ b/api/project_member.go
@@ -26,41 +26,41 @@ type ProjectMember struct {
ID int `jsonapi:"primary,projectMember"`
// Standard fields
- CreatorId int
+ CreatorID int
Creator *Principal `jsonapi:"attr,creator"`
CreatedTs int64 `jsonapi:"attr,createdTs"`
- UpdaterId int
+ UpdaterID int
Updater *Principal `jsonapi:"attr,updater"`
UpdatedTs int64 `jsonapi:"attr,updatedTs"`
// Related fields
- // Just returns ProjectId otherwise would cause circular dependency.
- ProjectId int `jsonapi:"attr,projectId"`
+ // Just returns ProjectID otherwise would cause circular dependency.
+ ProjectID int `jsonapi:"attr,projectID"`
// Domain specific fields
Role string `jsonapi:"attr,role"`
- PrincipalId int
+ PrincipalID int
Principal *Principal `jsonapi:"attr,principal"`
}
type ProjectMemberCreate struct {
// Standard fields
// Value is assigned from the jwt subject field passed by the client.
- CreatorId int
+ CreatorID int
// Related fields
- ProjectId int
+ ProjectID int
// Domain specific fields
Role ProjectRole `jsonapi:"attr,role"`
- PrincipalId int `jsonapi:"attr,principalId"`
+ PrincipalID int `jsonapi:"attr,principalID"`
}
type ProjectMemberFind struct {
ID *int
// Related fields
- ProjectId *int
+ ProjectID *int
}
func (find *ProjectMemberFind) String() string {
@@ -76,7 +76,7 @@ type ProjectMemberPatch struct {
// Standard fields
// Value is assigned from the jwt subject field passed by the client.
- UpdaterId int
+ UpdaterID int
// Domain specific fields
Role *string `jsonapi:"attr,role"`
@@ -87,7 +87,7 @@ type ProjectMemberDelete struct {
// Standard fields
// Value is assigned from the jwt subject field passed by the client.
- DeleterId int
+ DeleterID int
}
type ProjectMemberService interface {
diff --git a/api/project_webhook.go b/api/project_webhook.go
index 3a1c66b523..86bd75d911 100644
--- a/api/project_webhook.go
+++ b/api/project_webhook.go
@@ -9,16 +9,16 @@ type ProjectWebhook struct {
ID int `jsonapi:"primary,projectWebhookMember"`
// Standard fields
- CreatorId int
+ CreatorID int
Creator *Principal `jsonapi:"attr,creator"`
CreatedTs int64 `jsonapi:"attr,createdTs"`
- UpdaterId int
+ UpdaterID int
Updater *Principal `jsonapi:"attr,updater"`
UpdatedTs int64 `jsonapi:"attr,updatedTs"`
// Related fields
- // Just returns ProjectId since it always operates within the project context
- ProjectId int `jsonapi:"attr,projecId"`
+ // Just returns ProjectID since it always operates within the project context
+ ProjectID int `jsonapi:"attr,projecID"`
// Domain specific fields
Type string `jsonapi:"attr,type"`
@@ -30,10 +30,10 @@ type ProjectWebhook struct {
type ProjectWebhookCreate struct {
// Standard fields
// Value is assigned from the jwt subject field passed by the client.
- CreatorId int
+ CreatorID int
// Related fields
- ProjectId int
+ ProjectID int
// Domain specific fields
Type string `jsonapi:"attr,type"`
@@ -46,7 +46,7 @@ type ProjectWebhookFind struct {
ID *int
// Related fields
- ProjectId *int
+ ProjectID *int
ActivityType *ActivityType
}
@@ -63,7 +63,7 @@ type ProjectWebhookPatch struct {
// Standard fields
// Value is assigned from the jwt subject field passed by the client.
- UpdaterId int
+ UpdaterID int
// Domain specific fields
Name *string `jsonapi:"attr,name"`
@@ -76,7 +76,7 @@ type ProjectWebhookDelete struct {
// Standard fields
// Value is assigned from the jwt subject field passed by the client.
- DeleterId int
+ DeleterID int
}
type ProjectWebhookTestResult struct {
diff --git a/api/repository.go b/api/repository.go
index fda3cae1f6..0c1970c02e 100644
--- a/api/repository.go
+++ b/api/repository.go
@@ -9,17 +9,17 @@ type Repository struct {
ID int `jsonapi:"primary,repository"`
// Standard fields
- CreatorId int
+ CreatorID int
Creator *Principal `jsonapi:"attr,creator"`
CreatedTs int64 `jsonapi:"attr,createdTs"`
- UpdaterId int
+ UpdaterID int
Updater *Principal `jsonapi:"attr,updater"`
UpdatedTs int64 `jsonapi:"attr,updatedTs"`
// Related fields
- VCSId int
+ VCSID int
VCS *VCS `jsonapi:"relation,vcs"`
- ProjectId int
+ ProjectID int
Project *Project `jsonapi:"relation,project"`
// Domain specific fields
@@ -33,10 +33,10 @@ type Repository struct {
// The file path template for storing the latest schema auto-generated by Bytebase after migration.
// If empty, then Bytebase won't auto generate it.
SchemaPathTemplate string `jsonapi:"attr,schemaPathTemplate"`
- ExternalId string `jsonapi:"attr,externalId"`
- ExternalWebhookId string
+ ExternalID string `jsonapi:"attr,externalID"`
+ ExternalWebhookID string
WebhookURLHost string
- WebhookEndpointId string
+ WebhookEndpointID string
WebhookSecretToken string
// These will be exclusively used on the server side and we don't return it to the client.
AccessToken string
@@ -47,11 +47,11 @@ type Repository struct {
type RepositoryCreate struct {
// Standard fields
// Value is assigned from the jwt subject field passed by the client.
- CreatorId int
+ CreatorID int
// Related fields
- VCSId int `jsonapi:"attr,vcsId"`
- ProjectId int `jsonapi:"attr,projectId"`
+ VCSID int `jsonapi:"attr,vcsID"`
+ ProjectID int `jsonapi:"attr,projectID"`
// Domain specific fields
Name string `jsonapi:"attr,name"`
@@ -61,16 +61,16 @@ type RepositoryCreate struct {
BaseDirectory string `jsonapi:"attr,baseDirectory"`
FilePathTemplate string `jsonapi:"attr,filePathTemplate"`
SchemaPathTemplate string `jsonapi:"attr,schemaPathTemplate"`
- ExternalId string `jsonapi:"attr,externalId"`
+ ExternalID string `jsonapi:"attr,externalID"`
// Token belonged by the user linking the project to the VCS repository. We store this token together
// with the refresh token in the new repository record so we can use it to call VCS API on
// behalf of that user to perform tasks like webhook CRUD later.
AccessToken string `jsonapi:"attr,accessToken"`
ExpiresTs int64 `jsonapi:"attr,expiresTs"`
RefreshToken string `jsonapi:"attr,refreshToken"`
- ExternalWebhookId string
+ ExternalWebhookID string
WebhookURLHost string
- WebhookEndpointId string
+ WebhookEndpointID string
WebhookSecretToken string
}
@@ -78,11 +78,11 @@ type RepositoryFind struct {
ID *int
// Related fields
- VCSId *int
- ProjectId *int
+ VCSID *int
+ ProjectID *int
// Domain specific fields
- WebhookEndpointId *string
+ WebhookEndpointID *string
}
func (find *RepositoryFind) String() string {
@@ -98,7 +98,7 @@ type RepositoryPatch struct {
// Standard fields
// Value is assigned from the jwt subject field passed by the client.
- UpdaterId int
+ UpdaterID int
// Domain specific fields
BranchFilter *string `jsonapi:"attr,branchFilter"`
@@ -110,12 +110,12 @@ type RepositoryPatch struct {
type RepositoryDelete struct {
// Related fields
// When deleting the repository, we need to update the correponding project workflow type to "UI",
- // thus we use ProjectId here.
- ProjectId int
+ // thus we use ProjectID here.
+ ProjectID int
// Standard fields
// Value is assigned from the jwt subject field passed by the client.
- DeleterId int
+ DeleterID int
}
type RepositoryService interface {
diff --git a/api/setting.go b/api/setting.go
index 4cc7776139..3193e5761d 100644
--- a/api/setting.go
+++ b/api/setting.go
@@ -20,10 +20,10 @@ type Setting struct {
ID int `jsonapi:"primary,setting"`
// Standard fields
- CreatorId int
+ CreatorID int
Creator *Principal `jsonapi:"attr,creator"`
CreatedTs int64 `jsonapi:"attr,createdTs"`
- UpdaterId int
+ UpdaterID int
Updater *Principal `jsonapi:"attr,updater"`
UpdatedTs int64 `jsonapi:"attr,updatedTs"`
@@ -34,7 +34,7 @@ type Setting struct {
}
type SettingCreate struct {
- CreatorId int
+ CreatorID int
Name SettingName
Value string
Description string
@@ -47,7 +47,7 @@ type SettingFind struct {
type SettingPatch struct {
// Standard fields
// Value is assigned from the jwt subject field passed by the client.
- UpdaterId int
+ UpdaterID int
Name SettingName
Value string `jsonapi:"attr,value"`
diff --git a/api/sql.go b/api/sql.go
index 4718925ce0..20aea67f95 100644
--- a/api/sql.go
+++ b/api/sql.go
@@ -13,11 +13,11 @@ type ConnectionInfo struct {
Username string `jsonapi:"attr,username"`
Password string `jsonapi:"attr,password"`
UseEmptyPassword bool `jsonapi:"attr,useEmptyPassword"`
- InstanceId *int `jsonapi:"attr,instanceId"`
+ InstanceID *int `jsonapi:"attr,instanceID"`
}
type SqlSyncSchema struct {
- InstanceId int `jsonapi:"attr,instanceId"`
+ InstanceID int `jsonapi:"attr,instanceID"`
}
type SqlResultSet struct {
diff --git a/api/stage.go b/api/stage.go
index 3907dad459..312bea0a37 100644
--- a/api/stage.go
+++ b/api/stage.go
@@ -9,17 +9,17 @@ type Stage struct {
ID int `jsonapi:"primary,stage"`
// Standard fields
- CreatorId int
+ CreatorID int
Creator *Principal `jsonapi:"attr,creator"`
CreatedTs int64 `jsonapi:"attr,createdTs"`
- UpdaterId int
+ UpdaterID int
Updater *Principal `jsonapi:"attr,updater"`
UpdatedTs int64 `jsonapi:"attr,updatedTs"`
// Related fields
- // Just returns PipelineId otherwise would cause circular dependency.
- PipelineId int `jsonapi:"attr,pipelineId"`
- EnvironmentId int
+ // Just returns PipelineID otherwise would cause circular dependency.
+ PipelineID int `jsonapi:"attr,pipelineID"`
+ EnvironmentID int
Environment *Environment `jsonapi:"relation,environment"`
TaskList []*Task `jsonapi:"relation,task"`
@@ -30,11 +30,11 @@ type Stage struct {
type StageCreate struct {
// Standard fields
// Value is assigned from the jwt subject field passed by the client.
- CreatorId int
+ CreatorID int
// Related fields
- EnvironmentId int `jsonapi:"attr,environmentId"`
- PipelineId int
+ EnvironmentID int `jsonapi:"attr,environmentID"`
+ PipelineID int
TaskList []TaskCreate `jsonapi:"attr,taskList"`
// Domain specific fields
@@ -45,7 +45,7 @@ type StageFind struct {
ID *int
// Related fields
- PipelineId *int
+ PipelineID *int
}
func (find *StageFind) String() string {
diff --git a/api/table.go b/api/table.go
index 82bb880874..84748cea2a 100644
--- a/api/table.go
+++ b/api/table.go
@@ -9,15 +9,15 @@ type Table struct {
ID int `jsonapi:"primary,table"`
// Standard fields
- CreatorId int
+ CreatorID int
Creator *Principal `jsonapi:"attr,creator"`
CreatedTs int64 `jsonapi:"attr,createdTs"`
- UpdaterId int
+ UpdaterID int
Updater *Principal `jsonapi:"attr,updater"`
UpdatedTs int64 `jsonapi:"attr,updatedTs"`
// Related fields
- DatabaseId int
+ DatabaseID int
Database *Database `jsonapi:"relation,database"`
// Domain specific fields
@@ -38,12 +38,12 @@ type Table struct {
type TableCreate struct {
// Standard fields
// Value is assigned from the jwt subject field passed by the client.
- CreatorId int
+ CreatorID int
CreatedTs int64
UpdatedTs int64
// Related fields
- DatabaseId int
+ DatabaseID int
// Domain specific fields
Name string
@@ -62,7 +62,7 @@ type TableFind struct {
ID *int
// Related fields
- DatabaseId *int
+ DatabaseID *int
// Domain specific fields
Name *string
@@ -78,7 +78,7 @@ func (find *TableFind) String() string {
type TableDelete struct {
// Related fields
- DatabaseId int
+ DatabaseID int
}
type TableService interface {
diff --git a/api/table_index.go b/api/table_index.go
index 9a7f8c9052..05fc412f43 100644
--- a/api/table_index.go
+++ b/api/table_index.go
@@ -9,14 +9,14 @@ type Index struct {
ID int `jsonapi:"primary,index"`
// Standard fields
- CreatorId int
+ CreatorID int
CreatedTs int64 `json:"createdTs"`
- UpdaterId int
+ UpdaterID int
UpdatedTs int64 `json:"updatedTs"`
// Related fields
- DatabaseId int
- TableId int
+ DatabaseID int
+ TableID int
// Domain specific fields
Name string `json:"name"`
@@ -31,11 +31,11 @@ type Index struct {
type IndexCreate struct {
// Standard fields
// Value is assigned from the jwt subject field passed by the client.
- CreatorId int
+ CreatorID int
// Related fields
- DatabaseId int
- TableId int
+ DatabaseID int
+ TableID int
// Domain specific fields
Name string
@@ -51,8 +51,8 @@ type IndexFind struct {
ID *int
// Related fields
- DatabaseId *int
- TableId *int
+ DatabaseID *int
+ TableID *int
// Domain specific fields
Name *string
diff --git a/api/task.go b/api/task.go
index 0473d848ce..276459485f 100644
--- a/api/task.go
+++ b/api/task.go
@@ -57,7 +57,7 @@ const (
// json naming convention
type TaskDatabaseCreatePayload struct {
// The project owning the database.
- ProjectId int `json:"projectId,omitempty"`
+ ProjectID int `json:"projectID,omitempty"`
DatabaseName string `json:"databaseName,omitempty"`
Statement string `json:"statement,omitempty"`
CharacterSet string `json:"character,omitempty"`
@@ -74,7 +74,7 @@ type TaskDatabaseSchemaUpdatePayload struct {
// TaskDatabaseBackupPayload is the task payload for database backup.
type TaskDatabaseBackupPayload struct {
- BackupId int `json:"backupId,omitempty"`
+ BackupID int `json:"backupID,omitempty"`
}
// TaskDatabaseRestorePayload is the task payload for database restore.
@@ -82,28 +82,28 @@ type TaskDatabaseRestorePayload struct {
// The database name we restore to. When we restore a backup to a new database, we only have the database name
// and don't have the database id upon constructing the task yet.
DatabaseName string `json:"databaseName,omitempty"`
- BackupId int `json:"backupId,omitempty"`
+ BackupID int `json:"backupID,omitempty"`
}
type Task struct {
ID int `jsonapi:"primary,task"`
// Standard fields
- CreatorId int
+ CreatorID int
Creator *Principal `jsonapi:"attr,creator"`
CreatedTs int64 `jsonapi:"attr,createdTs"`
- UpdaterId int
+ UpdaterID int
Updater *Principal `jsonapi:"attr,updater"`
UpdatedTs int64 `jsonapi:"attr,updatedTs"`
// Related fields
- // Just returns PipelineId and StageId otherwise would cause circular dependency.
- PipelineId int `jsonapi:"attr,pipelineId"`
- StageId int `jsonapi:"attr,stageId"`
- InstanceId int
+ // Just returns PipelineID and StageID otherwise would cause circular dependency.
+ PipelineID int `jsonapi:"attr,pipelineID"`
+ StageID int `jsonapi:"attr,stageID"`
+ InstanceID int
Instance *Instance `jsonapi:"relation,instance"`
// Tasks like creating database may not have database.
- DatabaseId *int
+ DatabaseID *int
Database *Database `jsonapi:"relation,database"`
TaskRunList []*TaskRun `jsonapi:"relation,taskRun"`
TaskCheckRunList []*TaskCheckRun `jsonapi:"relation,taskCheckRun"`
@@ -118,14 +118,14 @@ type Task struct {
type TaskCreate struct {
// Standard fields
// Value is assigned from the jwt subject field passed by the client.
- CreatorId int
+ CreatorID int
// Related fields
- PipelineId int
- StageId int
- InstanceId int `jsonapi:"attr,instanceId"`
+ PipelineID int
+ StageID int
+ InstanceID int `jsonapi:"attr,instanceID"`
// Tasks like creating database may not have database.
- DatabaseId *int `jsonapi:"attr,databaseId"`
+ DatabaseID *int `jsonapi:"attr,databaseID"`
// Domain specific fields
Name string `jsonapi:"attr,name"`
@@ -138,7 +138,7 @@ type TaskCreate struct {
DatabaseName string `jsonapi:"attr,databaseName"`
CharacterSet string `jsonapi:"attr,characterSet"`
Collation string `jsonapi:"attr,collation"`
- BackupId *int `jsonapi:"attr,backupId"`
+ BackupID *int `jsonapi:"attr,backupID"`
VCSPushEvent *common.VCSPushEvent
MigrationType db.MigrationType `jsonapi:"attr,migrationType"`
}
@@ -147,8 +147,8 @@ type TaskFind struct {
ID *int
// Related fields
- PipelineId *int
- StageId *int
+ PipelineID *int
+ StageID *int
// Domain specific fields
StatusList *[]TaskStatus
@@ -167,7 +167,7 @@ type TaskPatch struct {
// Standard fields
// Value is assigned from the jwt subject field passed by the client.
- UpdaterId int
+ UpdaterID int
// Domain specific fields
Statement *string `jsonapi:"attr,statement"`
@@ -179,7 +179,7 @@ type TaskStatusPatch struct {
// Standard fields
// Value is assigned from the jwt subject field passed by the client.
- UpdaterId int
+ UpdaterID int
// Domain specific fields
Status TaskStatus `jsonapi:"attr,status"`
diff --git a/api/task_check_run.go b/api/task_check_run.go
index 801061b265..3815a2d8c5 100644
--- a/api/task_check_run.go
+++ b/api/task_check_run.go
@@ -87,15 +87,15 @@ type TaskCheckRun struct {
ID int `jsonapi:"primary,taskCheckRun"`
// Standard fields
- CreatorId int
+ CreatorID int
Creator *Principal `jsonapi:"attr,creator"`
CreatedTs int64 `jsonapi:"attr,createdTs"`
- UpdaterId int
+ UpdaterID int
Updater *Principal `jsonapi:"attr,updater"`
UpdatedTs int64 `jsonapi:"attr,updatedTs"`
// Related fields
- TaskId int `jsonapi:"attr,taskId"`
+ TaskID int `jsonapi:"attr,taskID"`
// Domain specific fields
Status TaskCheckRunStatus `jsonapi:"attr,status"`
@@ -109,10 +109,10 @@ type TaskCheckRun struct {
type TaskCheckRunCreate struct {
// Standard fields
// Value is assigned from the jwt subject field passed by the client.
- CreatorId int
+ CreatorID int
// Related fields
- TaskId int
+ TaskID int
// Domain specific fields
Type TaskCheckType `jsonapi:"attr,type"`
@@ -120,7 +120,7 @@ type TaskCheckRunCreate struct {
Payload string `jsonapi:"attr,payload"`
// If true, then we will skip creating the task check run if there has already been a DONE check run
- // for this (TaskId, Type) pair. The check is done at the store layer so that we can wrap it in the
+ // for this (TaskID, Type) pair. The check is done at the store layer so that we can wrap it in the
// same transaction.
// This is NOT persisted into the db
SkipIfAlreadyTerminated bool
@@ -130,7 +130,7 @@ type TaskCheckRunFind struct {
ID *int
// Related fields
- TaskId *int
+ TaskID *int
Type *TaskCheckType
// Domain specific fields
@@ -151,7 +151,7 @@ type TaskCheckRunStatusPatch struct {
ID *int
// Standard fields
- UpdaterId int
+ UpdaterID int
// Domain specific fields
Status TaskCheckRunStatus
diff --git a/api/task_run.go b/api/task_run.go
index 1830176cd0..5d2f353a71 100644
--- a/api/task_run.go
+++ b/api/task_run.go
@@ -34,7 +34,7 @@ func (e TaskRunStatus) String() string {
type TaskRunResultPayload struct {
Detail string `json:"detail,omitempty"`
- MigrationId int64 `json:"migrationId,omitempty"`
+ MigrationID int64 `json:"migrationID,omitempty"`
Version string `json:"version,omitempty"`
}
@@ -42,15 +42,15 @@ type TaskRun struct {
ID int `jsonapi:"primary,taskRun"`
// Standard fields
- CreatorId int
+ CreatorID int
Creator *Principal `jsonapi:"attr,creator"`
CreatedTs int64 `jsonapi:"attr,createdTs"`
- UpdaterId int
+ UpdaterID int
Updater *Principal `jsonapi:"attr,updater"`
UpdatedTs int64 `jsonapi:"attr,updatedTs"`
// Related fields
- TaskId int `jsonapi:"attr,taskId"`
+ TaskID int `jsonapi:"attr,taskID"`
// Domain specific fields
Name string `jsonapi:"attr,name"`
@@ -65,10 +65,10 @@ type TaskRun struct {
type TaskRunCreate struct {
// Standard fields
// Value is assigned from the jwt subject field passed by the client.
- CreatorId int
+ CreatorID int
// Related fields
- TaskId int
+ TaskID int
// Domain specific fields
Name string `jsonapi:"attr,name"`
@@ -80,7 +80,7 @@ type TaskRunFind struct {
ID *int
// Related fields
- TaskId *int
+ TaskID *int
// Domain specific fields
StatusList *[]TaskRunStatus
@@ -98,10 +98,10 @@ type TaskRunStatusPatch struct {
ID *int
// Standard fields
- UpdaterId int
+ UpdaterID int
// Related fields
- TaskId *int
+ TaskID *int
// Domain specific fields
Status TaskRunStatus
diff --git a/api/vcs.go b/api/vcs.go
index ca63a6edfb..a45e586a97 100644
--- a/api/vcs.go
+++ b/api/vcs.go
@@ -11,10 +11,10 @@ type VCS struct {
ID int `jsonapi:"primary,vcs"`
// Standard fields
- CreatorId int
+ CreatorID int
Creator *Principal `jsonapi:"attr,creator"`
CreatedTs int64 `jsonapi:"attr,createdTs"`
- UpdaterId int
+ UpdaterID int
Updater *Principal `jsonapi:"attr,updater"`
UpdatedTs int64 `jsonapi:"attr,updatedTs"`
@@ -23,14 +23,14 @@ type VCS struct {
Type common.VCSType `jsonapi:"attr,type"`
InstanceURL string `jsonapi:"attr,instanceURL"`
ApiURL string `jsonapi:"attr,apiURL"`
- ApplicationId string `jsonapi:"attr,applicationId"`
+ ApplicationID string `jsonapi:"attr,applicationID"`
Secret string `jsonapi:"attr,secret"`
}
type VCSCreate struct {
// Standard fields
// Value is assigned from the jwt subject field passed by the client.
- CreatorId int
+ CreatorID int
// Domain specific fields
Name string `jsonapi:"attr,name"`
@@ -38,7 +38,7 @@ type VCSCreate struct {
InstanceURL string `jsonapi:"attr,instanceURL"`
// ApiURL derives from InstanceURL
ApiURL string
- ApplicationId string `jsonapi:"attr,applicationId"`
+ ApplicationID string `jsonapi:"attr,applicationID"`
Secret string `jsonapi:"attr,secret"`
}
@@ -59,11 +59,11 @@ type VCSPatch struct {
// Standard fields
// Value is assigned from the jwt subject field passed by the client.
- UpdaterId int
+ UpdaterID int
// Domain specific fields
Name *string `jsonapi:"attr,name"`
- ApplicationId *string `jsonapi:"attr,applicationId"`
+ ApplicationID *string `jsonapi:"attr,applicationID"`
Secret *string `jsonapi:"attr,secret"`
}
@@ -72,7 +72,7 @@ type VCSDelete struct {
// Standard fields
// Value is assigned from the jwt subject field passed by the client.
- DeleterId int
+ DeleterID int
}
type VCSService interface {
diff --git a/api/view.go b/api/view.go
index f2403c3987..4d489946df 100644
--- a/api/view.go
+++ b/api/view.go
@@ -9,15 +9,15 @@ type View struct {
ID int `jsonapi:"primary,view"`
// Standard fields
- CreatorId int
+ CreatorID int
Creator *Principal `jsonapi:"attr,creator"`
CreatedTs int64 `jsonapi:"attr,createdTs"`
- UpdaterId int
+ UpdaterID int
Updater *Principal `jsonapi:"attr,updater"`
UpdatedTs int64 `jsonapi:"attr,updatedTs"`
// Related fields
- DatabaseId int
+ DatabaseID int
Database *Database `jsonapi:"relation,database"`
// Domain specific fields
@@ -29,12 +29,12 @@ type View struct {
type ViewCreate struct {
// Standard fields
// Value is assigned from the jwt subject field passed by the client.
- CreatorId int
+ CreatorID int
CreatedTs int64
UpdatedTs int64
// Related fields
- DatabaseId int
+ DatabaseID int
// Domain specific fields
Name string
@@ -46,7 +46,7 @@ type ViewFind struct {
ID *int
// Related fields
- DatabaseId *int
+ DatabaseID *int
// Domain specific fields
Name *string
@@ -62,7 +62,7 @@ func (find *ViewFind) String() string {
type ViewDelete struct {
// Related fields
- DatabaseId int
+ DatabaseID int
}
type ViewService interface {
diff --git a/bin/server/cmd/root.go b/bin/server/cmd/root.go
index cece0bc4c8..e5324dc054 100644
--- a/bin/server/cmd/root.go
+++ b/bin/server/cmd/root.go
@@ -235,7 +235,7 @@ func initSetting(ctx context.Context, settingService api.SettingService) (*confi
result := &config{}
{
configCreate := &api.SettingCreate{
- CreatorId: api.SYSTEM_BOT_ID,
+ CreatorID: api.SYSTEM_BOT_ID,
Name: api.SettingAuthSecret,
Value: common.RandomString(SECRET_LENGTH),
Description: "Random string used to sign the JWT auth token.",
@@ -249,7 +249,7 @@ func initSetting(ctx context.Context, settingService api.SettingService) (*confi
{
configCreate := &api.SettingCreate{
- CreatorId: api.SYSTEM_BOT_ID,
+ CreatorID: api.SYSTEM_BOT_ID,
Name: api.SettingConsoleURL,
Value: "",
Description: "URL for the external console (e.g. phpMyAdmin).",
diff --git a/common/vcs.go b/common/vcs.go
index 4c78d252a2..fd58f4ad11 100644
--- a/common/vcs.go
+++ b/common/vcs.go
@@ -31,7 +31,7 @@ type VCSPushEvent struct {
VCSType VCSType `json:"vcsType"`
BaseDirectory string `json:"baseDir"`
Ref string `json:"ref"`
- RepositoryID string `json:"repositoryId"`
+ RepositoryID string `json:"repositoryID"`
RepositoryURL string `json:"repositoryUrl"`
RepositoryFullPath string `json:"repositoryFullPath"`
AuthorName string `json:"authorName"`
diff --git a/external/gitlab/gitlab.go b/external/gitlab/gitlab.go
index 11db887170..c877d08d79 100644
--- a/external/gitlab/gitlab.go
+++ b/external/gitlab/gitlab.go
@@ -82,11 +82,11 @@ type FileCommit struct {
Branch string `json:"branch"`
Content string `json:"content"`
CommitMessage string `json:"commit_message"`
- LastCommitId string `json:"last_commit_id,omitempty"`
+ LastCommitID string `json:"last_commit_id,omitempty"`
}
type File struct {
- LastCommitId string `json:"last_commit_id"`
+ LastCommitID string `json:"last_commit_id"`
}
func POST(instanceURL string, resourcePath string, token string, body io.Reader) (*http.Response, error) {
diff --git a/frontend/src/components/ActivityTable.vue b/frontend/src/components/ActivityTable.vue
index 97376305be..657e9b85e2 100644
--- a/frontend/src/components/ActivityTable.vue
+++ b/frontend/src/components/ActivityTable.vue
@@ -196,7 +196,7 @@ export default {
activity.payload as ActivityProjectDatabaseTransferPayload;
return {
title: payload.databaseName,
- path: `/db/${payload.databaseId}`,
+ path: `/db/${payload.databaseID}`,
external: false,
};
}
@@ -209,10 +209,10 @@ export default {
case "bb.project.repository.push": {
const payload =
activity.payload as ActivityProjectRepositoryPushPayload;
- if (payload.issueId && payload.issueName) {
+ if (payload.issueID && payload.issueName) {
return {
- title: `issue/${payload.issueId}`,
- path: `/issue/${issueSlug(payload.issueName!, payload.issueId!)}`,
+ title: `issue/${payload.issueID}`,
+ path: `/issue/${issueSlug(payload.issueName!, payload.issueID!)}`,
external: false,
};
}
diff --git a/frontend/src/components/AlterSchemaPrepForm.vue b/frontend/src/components/AlterSchemaPrepForm.vue
index 65a4634fe0..727e610b5c 100644
--- a/frontend/src/components/AlterSchemaPrepForm.vue
+++ b/frontend/src/components/AlterSchemaPrepForm.vue
@@ -1,6 +1,6 @@
<template>
<div class="mx-4 space-y-4 w-160">
- <template v-if="projectId">
+ <template v-if="projectID">
<div v-if="state.project.workflowType == 'VCS'" class="textlabel">
This project has version control enabled and selecting database below
will navigate you to the corresponding Git repository to create schema
@@ -32,7 +32,7 @@
</template>
<div
- v-if="projectId && state.project.workflowType == 'UI'"
+ v-if="projectID && state.project.workflowType == 'UI'"
class="mt-2 textlabel"
>
<div class="radio-set-row">
@@ -59,7 +59,7 @@
</div>
</div>
- <template v-if="projectId && state.alterType == 'MULTI_DB'">
+ <template v-if="projectID && state.alterType == 'MULTI_DB'">
<div class="textinfolabel">
For each environment, your can select a database to alter its schema or
just skip that environment. This allows you to compose a single pipeline
@@ -96,12 +96,12 @@
type="radio"
class="btn"
:checked="
- state.selectedDatabaseIdForEnvironment.get(
+ state.selectedDatabaseIDForEnvironment.get(
environment.id
) == database.id
"
@change="
- selectDatabaseIdForEnvironment(
+ selectDatabaseIDForEnvironment(
database.id,
environment.id
)
@@ -154,11 +154,11 @@
type="radio"
class="btn"
:checked="
- state.selectedDatabaseIdForEnvironment.get(environment.id)
+ state.selectedDatabaseIDForEnvironment.get(environment.id)
? 0
: 1
"
- @input="clearDatabaseIdForEnvironment(environment.id)"
+ @input="clearDatabaseIDForEnvironment(environment.id)"
/>
<span class="ml-3 font-medium text-main">SKIP</span>
</div>
@@ -169,7 +169,7 @@
</template>
<template v-else>
<DatabaseTable
- :mode="projectId ? 'PROJECT_SHORT' : 'ALL_SHORT'"
+ :mode="projectID ? 'PROJECT_SHORT' : 'ALL_SHORT'"
:bordered="true"
:customClick="true"
:databaseList="databaseList"
@@ -205,10 +205,10 @@ import DatabaseTable from "../components/DatabaseTable.vue";
import {
baseDirectoryWebURL,
Database,
- DatabaseId,
- EnvironmentId,
+ DatabaseID,
+ EnvironmentID,
Project,
- ProjectId,
+ ProjectID,
Repository,
} from "../types";
import { sortDatabaseList } from "../utils";
@@ -219,15 +219,15 @@ type AlterType = "SINGLE_DB" | "MULTI_DB";
interface LocalState {
project?: Project;
alterType: AlterType;
- selectedDatabaseIdForEnvironment: Map<EnvironmentId, DatabaseId>;
+ selectedDatabaseIDForEnvironment: Map<EnvironmentID, DatabaseID>;
}
export default {
name: "AlterSchemaPrepForm",
emits: ["dismiss"],
props: {
- projectId: {
- type: Number as PropType<ProjectId>,
+ projectID: {
+ type: Number as PropType<ProjectID>,
},
},
components: {
@@ -254,11 +254,11 @@ export default {
});
const state = reactive<LocalState>({
- project: props.projectId
- ? store.getters["project/projectById"](props.projectId)
+ project: props.projectID
+ ? store.getters["project/projectByID"](props.projectID)
: undefined,
alterType: "SINGLE_DB",
- selectedDatabaseIdForEnvironment: new Map(),
+ selectedDatabaseIDForEnvironment: new Map(),
});
const environmentList = computed(() => {
@@ -267,12 +267,12 @@ export default {
const databaseList = computed(() => {
var list;
- if (props.projectId) {
- list = store.getters["database/databaseListByProjectId"](
- props.projectId
+ if (props.projectID) {
+ list = store.getters["database/databaseListByProjectID"](
+ props.projectID
);
} else {
- list = store.getters["database/databaseListByPrincipalId"](
+ list = store.getters["database/databaseListByPrincipalID"](
currentUser.value.id
);
}
@@ -281,19 +281,19 @@ export default {
});
const allowGenerateMultiDb = computed(() => {
- return state.selectedDatabaseIdForEnvironment.size > 0;
+ return state.selectedDatabaseIDForEnvironment.size > 0;
});
const generateMultDb = () => {
- const databaseIdList: DatabaseId[] = [];
+ const databaseIDList: DatabaseID[] = [];
for (var i = 0; i < environmentList.value.length; i++) {
if (
- state.selectedDatabaseIdForEnvironment.get(
+ state.selectedDatabaseIDForEnvironment.get(
environmentList.value[i].id
)
) {
- databaseIdList.push(
- state.selectedDatabaseIdForEnvironment.get(
+ databaseIDList.push(
+ state.selectedDatabaseIDForEnvironment.get(
environmentList.value[i].id
)!
);
@@ -307,8 +307,8 @@ export default {
query: {
template: "bb.issue.database.schema.update",
name: `Alter schema`,
- project: props.projectId,
- databaseList: databaseIdList.join(","),
+ project: props.projectID,
+ databaseList: databaseIDList.join(","),
},
});
};
@@ -332,7 +332,7 @@ export default {
} else if (database.project.workflowType == "VCS") {
store
.dispatch(
- "repository/fetchRepositoryByProjectId",
+ "repository/fetchRepositoryByProjectID",
database.project.id
)
.then((repository: Repository) => {
@@ -341,15 +341,15 @@ export default {
}
};
- const selectDatabaseIdForEnvironment = (
- databaseId: DatabaseId,
- environmentId: EnvironmentId
+ const selectDatabaseIDForEnvironment = (
+ databaseID: DatabaseID,
+ environmentID: EnvironmentID
) => {
- state.selectedDatabaseIdForEnvironment.set(environmentId, databaseId);
+ state.selectedDatabaseIDForEnvironment.set(environmentID, databaseID);
};
- const clearDatabaseIdForEnvironment = (environmentId: EnvironmentId) => {
- state.selectedDatabaseIdForEnvironment.delete(environmentId);
+ const clearDatabaseIDForEnvironment = (environmentID: EnvironmentID) => {
+ state.selectedDatabaseIDForEnvironment.delete(environmentID);
};
const cancel = () => {
@@ -363,8 +363,8 @@ export default {
allowGenerateMultiDb,
generateMultDb,
selectDatabase,
- selectDatabaseIdForEnvironment,
- clearDatabaseIdForEnvironment,
+ selectDatabaseIDForEnvironment,
+ clearDatabaseIDForEnvironment,
cancel,
};
},
diff --git a/frontend/src/components/AnomalyTable.vue b/frontend/src/components/AnomalyTable.vue
index e5f21bf530..0c26bdfc85 100644
--- a/frontend/src/components/AnomalyTable.vue
+++ b/frontend/src/components/AnomalyTable.vue
@@ -197,7 +197,7 @@ export default {
case "bb.anomaly.instance.migration-schema":
return "Please create migration schema on the instance first.";
case "bb.anomaly.database.backup.policy-violation": {
- const environment = store.getters["environment/environmentById"](
+ const environment = store.getters["environment/environmentByID"](
anomaly.instance.environment.id
);
const payload =
diff --git a/frontend/src/components/BackupTable.vue b/frontend/src/components/BackupTable.vue
index 063bd9356e..720249ef52 100644
--- a/frontend/src/components/BackupTable.vue
+++ b/frontend/src/components/BackupTable.vue
@@ -127,9 +127,9 @@
"
>
<CreateDatabasePrepForm
- :projectId="database.project.id"
- :environmentId="database.instance.environment.id"
- :instanceId="database.instance.id"
+ :projectID="database.project.id"
+ :environmentID="database.instance.environment.id"
+ :instanceID="database.instance.id"
:backup="state.restoredBackup"
@dismiss="
() => {
@@ -274,7 +274,7 @@ export default {
state.loadingMigrationHistory = true;
store
.dispatch("instance/fetchMigrationHistoryByVersion", {
- instanceId: props.database.instance.id,
+ instanceID: props.database.instance.id,
databaseName: props.database.name,
version: backup.migrationHistoryVersion,
})
diff --git a/frontend/src/components/Breadcrumb.vue b/frontend/src/components/Breadcrumb.vue
index e9d290a0b7..c0a8125302 100644
--- a/frontend/src/components/Breadcrumb.vue
+++ b/frontend/src/components/Breadcrumb.vue
@@ -153,7 +153,7 @@ export default {
});
if (projectWebhookSlug) {
- const project = store.getters["project/projectById"](
+ const project = store.getters["project/projectByID"](
idFromSlug(projectSlug)
);
list.push({
@@ -173,7 +173,7 @@ export default {
});
if (tableName || dataSourceSlug || migrationHistory) {
- const database = store.getters["database/databaseById"](
+ const database = store.getters["database/databaseByID"](
idFromSlug(databaseSlug)
);
list.push({
diff --git a/frontend/src/components/CreateDatabasePrepForm.vue b/frontend/src/components/CreateDatabasePrepForm.vue
index 1dc27a9e51..6d571403c6 100644
--- a/frontend/src/components/CreateDatabasePrepForm.vue
+++ b/frontend/src/components/CreateDatabasePrepForm.vue
@@ -27,7 +27,7 @@
id="project"
name="project"
:disabled="!allowEditProject"
- :selectedId="state.projectId"
+ :selectedID="state.projectID"
@select-project-id="selectProject"
/>
</div>
@@ -41,7 +41,7 @@
id="environment"
name="environment"
:disabled="!allowEditEnvironment"
- :selectedId="state.environmentId"
+ :selectedID="state.environmentID"
@select-environment-id="selectEnvironment"
/>
</div>
@@ -49,7 +49,7 @@
<div class="col-span-2 col-start-2 w-64">
<div class="flex flex-row items-center space-x-1">
<InstanceEngineIcon
- v-if="state.instanceId"
+ v-if="state.instanceID"
:instance="selectedInstance"
/>
<label for="instance" class="textlabel">
@@ -62,8 +62,8 @@
id="instance"
name="instance"
:disabled="!allowEditInstance"
- :selectedId="state.instanceId"
- :environmentId="state.environmentId"
+ :selectedID="state.instanceID"
+ :environmentID="state.environmentID"
@select-instance-id="selectInstance"
/>
</div>
@@ -118,7 +118,7 @@
id="user"
name="user"
:allowedRoleList="['OWNER', 'DBA']"
- :selectedId="state.assigneeId"
+ :selectedID="state.assigneeID"
:placeholder="'Select assignee'"
@select-principal-id="selectAssignee"
/>
@@ -162,12 +162,12 @@ import ProjectSelect from "../components/ProjectSelect.vue";
import MemberSelect from "../components/MemberSelect.vue";
import InstanceEngineIcon from "../components/InstanceEngineIcon.vue";
import {
- EnvironmentId,
- InstanceId,
- ProjectId,
+ EnvironmentID,
+ InstanceID,
+ ProjectID,
IssueCreate,
SYSTEM_BOT_ID,
- PrincipalId,
+ PrincipalID,
Backup,
StageCreate,
defaultCharset,
@@ -177,27 +177,27 @@ import {
import { isDBAOrOwner, issueSlug } from "../utils";
interface LocalState {
- projectId?: ProjectId;
- environmentId?: EnvironmentId;
- instanceId?: InstanceId;
+ projectID?: ProjectID;
+ environmentID?: EnvironmentID;
+ instanceID?: InstanceID;
databaseName?: string;
characterSet: string;
collation: string;
- assigneeId?: PrincipalId;
+ assigneeID?: PrincipalID;
}
export default {
name: "CreateDatabasePrepForm",
emits: ["dismiss"],
props: {
- projectId: {
- type: Number as PropType<ProjectId>,
+ projectID: {
+ type: Number as PropType<ProjectID>,
},
- environmentId: {
- type: Number as PropType<EnvironmentId>,
+ environmentID: {
+ type: Number as PropType<EnvironmentID>,
},
- instanceId: {
- type: Number as PropType<InstanceId>,
+ instanceID: {
+ type: Number as PropType<InstanceID>,
},
// If specified, then we are creating a database from the backup.
backup: {
@@ -243,12 +243,12 @@ export default {
});
const state = reactive<LocalState>({
- projectId: props.projectId,
- environmentId: props.environmentId,
- instanceId: props.instanceId,
+ projectID: props.projectID,
+ environmentID: props.environmentID,
+ instanceID: props.instanceID,
characterSet: "",
collation: "",
- assigneeId: showAssigneeSelect.value ? undefined : SYSTEM_BOT_ID,
+ assigneeID: showAssigneeSelect.value ? undefined : SYSTEM_BOT_ID,
});
const isReservedName = computed(() => {
@@ -259,48 +259,48 @@ export default {
return (
!isEmpty(state.databaseName) &&
!isReservedName.value &&
- state.projectId &&
- state.environmentId &&
- state.instanceId &&
- state.assigneeId
+ state.projectID &&
+ state.environmentID &&
+ state.instanceID &&
+ state.assigneeID
);
});
// If project has been specified, then we disallow changing it.
const allowEditProject = computed(() => {
- return !props.projectId;
+ return !props.projectID;
});
// If environment has been specified, then we disallow changing it.
const allowEditEnvironment = computed(() => {
- return !props.environmentId;
+ return !props.environmentID;
});
// If instance has been specified, then we disallow changing it.
const allowEditInstance = computed(() => {
- return !props.instanceId;
+ return !props.instanceID;
});
const selectedInstance = computed(() => {
- return state.instanceId
- ? store.getters["instance/instanceById"](state.instanceId)
+ return state.instanceID
+ ? store.getters["instance/instanceByID"](state.instanceID)
: unknown("INSTANCE");
});
- const selectProject = (projectId: ProjectId) => {
- state.projectId = projectId;
+ const selectProject = (projectID: ProjectID) => {
+ state.projectID = projectID;
};
- const selectEnvironment = (environmentId: EnvironmentId) => {
- state.environmentId = environmentId;
+ const selectEnvironment = (environmentID: EnvironmentID) => {
+ state.environmentID = environmentID;
};
- const selectInstance = (instanceId: InstanceId) => {
- state.instanceId = instanceId;
+ const selectInstance = (instanceID: InstanceID) => {
+ state.instanceID = instanceID;
};
- const selectAssignee = (assigneeId: PrincipalId) => {
- state.assigneeId = assigneeId;
+ const selectAssignee = (assigneeID: PrincipalID) => {
+ state.assigneeID = assigneeID;
};
const cancel = () => {
@@ -311,7 +311,7 @@ export default {
const stageList: StageCreate[] = [
{
name: "Create database",
- environmentId: state.environmentId!,
+ environmentID: state.environmentID!,
taskList: [
{
name: `Create database '${state.databaseName}'`,
@@ -321,7 +321,7 @@ export default {
? "PENDING"
: "PENDING_APPROVAL",
type: "bb.task.database.create",
- instanceId: state.instanceId!,
+ instanceID: state.instanceID!,
// statement is derived by backend.
statement: ``,
rollbackStatement: "",
@@ -341,18 +341,18 @@ export default {
if (props.backup) {
stageList.push({
name: "Restore backup",
- environmentId: state.environmentId!,
+ environmentID: state.environmentID!,
taskList: [
{
name: `Restore backup '${props.backup.name}'`,
// Use "PENDING" here since we consider the required approval has already been granted in the first stage.
status: "PENDING",
type: "bb.task.database.restore",
- instanceId: state.instanceId!,
+ instanceID: state.instanceID!,
statement: "",
rollbackStatement: "",
databaseName: state.databaseName,
- backupId: props.backup.id,
+ backupID: props.backup.id,
},
],
});
@@ -362,8 +362,8 @@ export default {
name: `Create database '${state.databaseName}' from backup '${props.backup.name}'`,
type: "bb.issue.database.create",
description: `Creating database from backup '${props.backup.name}'`,
- assigneeId: state.assigneeId!,
- projectId: state.projectId!,
+ assigneeID: state.assigneeID!,
+ projectID: state.projectID!,
pipeline: {
stageList,
name: `Pipeline - Create database '${state.databaseName}' from backup '${props.backup.name}'`,
@@ -374,8 +374,8 @@ export default {
name: `Create database '${state.databaseName}'`,
type: "bb.issue.database.create",
description: "",
- assigneeId: state.assigneeId!,
- projectId: state.projectId!,
+ assigneeID: state.assigneeID!,
+ projectID: state.projectID!,
pipeline: {
stageList,
name: `Pipeline - Create database ${state.databaseName}`,
diff --git a/frontend/src/components/DataSourceConnectionPanel.vue b/frontend/src/components/DataSourceConnectionPanel.vue
index db3816632d..ef20e446ac 100644
--- a/frontend/src/components/DataSourceConnectionPanel.vue
+++ b/frontend/src/components/DataSourceConnectionPanel.vue
@@ -181,7 +181,7 @@ export default {
});
const database = computed(() => {
- return store.getters["database/databaseById"](
+ return store.getters["database/databaseByID"](
props.dataSource.database.id,
props.dataSource.instance.id
);
diff --git a/frontend/src/components/DataSourceCreateForm.vue b/frontend/src/components/DataSourceCreateForm.vue
index e7e09429e1..486904aa84 100644
--- a/frontend/src/components/DataSourceCreateForm.vue
+++ b/frontend/src/components/DataSourceCreateForm.vue
@@ -41,12 +41,12 @@
<div v-else class="flex flex-row justify-between space-x-2">
<DatabaseSelect
class="mt-1 w-full"
- :selectedId="state.dataSource.databaseId"
+ :selectedID="state.dataSource.databaseID"
:mode="'INSTANCE'"
- :instanceId="instanceId"
+ :instanceID="instanceID"
@select-database-id="
- (databaseId) => {
- updateDataSource('databaseId', databaseId);
+ (databaseID) => {
+ updateDataSource('databaseID', databaseID);
}
"
/>
@@ -170,7 +170,7 @@ export default {
name: "DataSourceCreateForm",
emits: ["create", "cancel"],
props: {
- instanceId: {
+ instanceID: {
required: true,
type: Number,
},
@@ -191,8 +191,8 @@ export default {
dataSource: {
name: "New data source",
type: "RO",
- databaseId: props.database ? props.database.id : UNKNOWN_ID,
- instanceId: props.instanceId,
+ databaseID: props.database ? props.database.id : UNKNOWN_ID,
+ instanceID: props.instanceID,
memberList: [],
},
showPassword: false,
diff --git a/frontend/src/components/DataSourceMemberForm.vue b/frontend/src/components/DataSourceMemberForm.vue
index fc2a48c5d7..24937ec024 100644
--- a/frontend/src/components/DataSourceMemberForm.vue
+++ b/frontend/src/components/DataSourceMemberForm.vue
@@ -26,10 +26,10 @@ input[type="number"] {
id="environment"
name="environment"
:disabled="!allowConfigure"
- :selectedId="state.environmentId"
+ :selectedID="state.environmentID"
@select-environment-id="
- (environmentId) => {
- updateState('environmentId', environmentId);
+ (environmentID) => {
+ updateState('environmentID', environmentID);
}
"
/>
@@ -44,10 +44,10 @@ input[type="number"] {
id="instance"
name="instance"
:disabled="!allowConfigure"
- :selectedId="state.instanceId"
+ :selectedID="state.instanceID"
@select-instance-id="
- (instanceId) => {
- updateState('instanceId', instanceId);
+ (instanceID) => {
+ updateState('instanceID', instanceID);
}
"
/>
@@ -63,11 +63,11 @@ input[type="number"] {
name="database"
:disabled="!allowConfigure"
:mode="'INSTANCE'"
- :instanceId="state.instanceId"
- :selectedId="state.databaseId"
+ :instanceID="state.instanceID"
+ :selectedID="state.databaseID"
@select-database-id="
- (databaseId) => {
- updateState('databaseId', databaseId);
+ (databaseID) => {
+ updateState('databaseID', databaseID);
}
"
/>
@@ -83,10 +83,10 @@ input[type="number"] {
name="datasource"
:disabled="!allowConfigure"
:database="database"
- :selectedId="state.dataSourceId"
+ :selectedID="state.dataSourceID"
@select-data-source-id="
- (dataSourceId) => {
- updateState('dataSourceId', dataSourceId);
+ (dataSourceID) => {
+ updateState('dataSourceID', dataSourceID);
}
"
/>
@@ -106,10 +106,10 @@ input[type="number"] {
name="user"
:allowedRoleList="['DEVELOPER']"
:disabled="!allowUpdateDataSourceMember"
- :selectedId="state.granteeId"
+ :selectedID="state.granteeID"
@select-principal-id="
- (principalId) => {
- updateState('granteeId', principalId);
+ (principalID) => {
+ updateState('granteeID', principalID);
}
"
/>
@@ -138,9 +138,9 @@ input[type="number"] {
name="issue"
type="number"
placeholder="Your issue id (e.g. 1234)"
- :disabled="!allowUpdateIssueId"
- :value="state.issueId"
- @input="updateState('issueId', $event.target.value)"
+ :disabled="!allowUpdateIssueID"
+ :value="state.issueID"
+ @input="updateState('issueID', $event.target.value)"
/>
<template v-if="issueLink">
<router-link
@@ -186,28 +186,28 @@ import DataSourceSelect from "../components/DataSourceSelect.vue";
import InstanceSelect from "../components/InstanceSelect.vue";
import MemberSelect from "../components/MemberSelect.vue";
import {
- DatabaseId,
+ DatabaseID,
DataSource,
- DataSourceId,
+ DataSourceID,
DataSourceMember,
DataSourceMemberCreate,
- EnvironmentId,
- InstanceId,
- PrincipalId,
+ EnvironmentID,
+ InstanceID,
+ PrincipalID,
Issue,
- IssueId,
+ IssueID,
UNKNOWN_ID,
} from "../types";
import { issueSlug } from "../utils";
interface LocalState {
- environmentId?: EnvironmentId;
- instanceId?: InstanceId;
- databaseId?: DatabaseId;
- dataSourceId?: DataSourceId;
- granteeId?: PrincipalId;
+ environmentID?: EnvironmentID;
+ instanceID?: InstanceID;
+ databaseID?: DatabaseID;
+ dataSourceID?: DataSourceID;
+ granteeID?: PrincipalID;
granteeError: string;
- issueId?: IssueId;
+ issueID?: IssueID;
}
export default {
@@ -217,10 +217,10 @@ export default {
dataSource: {
type: Object as PropType<DataSource>,
},
- principalId: {
+ principalID: {
type: Number,
},
- issueId: {
+ issueID: {
type: Number,
},
},
@@ -235,20 +235,20 @@ export default {
const store = useStore();
const state = reactive<LocalState>({
- environmentId: props.dataSource
+ environmentID: props.dataSource
? props.dataSource.instance.environment.id
: undefined,
- instanceId: props.dataSource ? props.dataSource.instance.id : undefined,
- databaseId: props.dataSource ? props.dataSource.database.id : undefined,
- dataSourceId: props.dataSource ? props.dataSource.id : undefined,
- granteeId: props.principalId,
+ instanceID: props.dataSource ? props.dataSource.instance.id : undefined,
+ databaseID: props.dataSource ? props.dataSource.database.id : undefined,
+ dataSourceID: props.dataSource ? props.dataSource.id : undefined,
+ granteeID: props.principalID,
granteeError: "",
- issueId: props.issueId,
+ issueID: props.issueID,
});
const database = computed(() => {
- return state.databaseId
- ? store.getters["database/databaseById"](state.databaseId)
+ return state.databaseID
+ ? store.getters["database/databaseByID"](state.databaseID)
: undefined;
});
@@ -257,14 +257,14 @@ export default {
return props.dataSource;
}
- if (state.dataSourceId) {
- if (state.databaseId) {
- const database = store.getters["database/databaseById"](
- state.databaseId
+ if (state.dataSourceID) {
+ if (state.databaseID) {
+ const database = store.getters["database/databaseByID"](
+ state.databaseID
);
if (database) {
return database.dataSourceList.find(
- (item: DataSource) => item.id == state.dataSourceId
+ (item: DataSource) => item.id == state.dataSourceID
);
}
}
@@ -279,30 +279,30 @@ export default {
});
const allowUpdateDataSourceMember = computed(() => {
- return !props.principalId && state.dataSourceId;
+ return !props.principalID && state.dataSourceID;
});
- const allowUpdateIssueId = computed(() => {
- return !props.issueId;
+ const allowUpdateIssueID = computed(() => {
+ return !props.issueID;
});
const allowCreate = computed(() => {
- return state.dataSourceId && state.granteeId && !state.granteeError;
+ return state.dataSourceID && state.granteeID && !state.granteeError;
});
const issueLink = computed((): string => {
- if (state.issueId) {
- // We intentionally not to validate whether the issueId is legit, we will do the validation
+ if (state.issueID) {
+ // We intentionally not to validate whether the issueID is legit, we will do the validation
// when actually trying to create the database.
- return `/issue/${state.issueId}`;
+ return `/issue/${state.issueID}`;
}
return "";
});
const validateGrantee = () => {
- if (state.granteeId) {
+ if (state.granteeID) {
const member = dataSource.value.memberList.find(
- (item: DataSourceMember) => item.principal.id == state.granteeId
+ (item: DataSourceMember) => item.principal.id == state.granteeID
);
if (member) {
state.granteeError = `${member.principal.name} already exists`;
@@ -313,19 +313,19 @@ export default {
};
const updateState = (field: string, value: number) => {
- if (field == "environmentId") {
- state.environmentId = value;
- } else if (field == "instanceId") {
- state.instanceId = value;
- } else if (field == "databaseId") {
- state.databaseId = value;
- } else if (field == "dataSourceId") {
- state.dataSourceId = value;
- } else if (field == "granteeId") {
- state.granteeId = value;
+ if (field == "environmentID") {
+ state.environmentID = value;
+ } else if (field == "instanceID") {
+ state.instanceID = value;
+ } else if (field == "databaseID") {
+ state.databaseID = value;
+ } else if (field == "dataSourceID") {
+ state.dataSourceID = value;
+ } else if (field == "granteeID") {
+ state.granteeID = value;
validateGrantee();
- } else if (field == "issueId") {
- state.issueId = value;
+ } else if (field == "issueID") {
+ state.issueID = value;
}
};
@@ -334,28 +334,28 @@ export default {
};
const doGrant = async () => {
- // If issueId id provided, we check its existence first.
- // We only set the issueId if it's valid.
+ // If issueID id provided, we check its existence first.
+ // We only set the issueID if it's valid.
let linkedIssue: Issue | undefined = undefined;
- if (state.issueId) {
+ if (state.issueID) {
try {
linkedIssue = await store.dispatch(
- "issue/fetchIssueById",
- state.issueId
+ "issue/fetchIssueByID",
+ state.issueID
);
} catch (err) {
- console.warn(`Unable to fetch linked issue id ${state.issueId}`, err);
+ console.warn(`Unable to fetch linked issue id ${state.issueID}`, err);
}
}
const newDataSouceMember: DataSourceMemberCreate = {
- principalId: state.granteeId!,
- issueId: linkedIssue?.id,
+ principalID: state.granteeID!,
+ issueID: linkedIssue?.id,
};
store
.dispatch("dataSource/createDataSourceMember", {
- dataSourceId: state.dataSourceId,
- databaseId: state.databaseId,
+ dataSourceID: state.dataSourceID,
+ databaseID: state.databaseID,
newDataSouceMember,
})
.then((dataSource: DataSource) => {
@@ -363,7 +363,7 @@ export default {
const addedMember = dataSource.memberList.find(
(item: DataSourceMember) => {
- return item.principal.id == state.granteeId;
+ return item.principal.id == state.granteeID;
}
);
store.dispatch("notification/pushNotification", {
@@ -390,7 +390,7 @@ export default {
database,
allowConfigure,
allowUpdateDataSourceMember,
- allowUpdateIssueId,
+ allowUpdateIssueID,
allowCreate,
issueLink,
updateState,
diff --git a/frontend/src/components/DataSourceMemberTable.vue b/frontend/src/components/DataSourceMemberTable.vue
index 608cf63397..55d676a96f 100644
--- a/frontend/src/components/DataSourceMemberTable.vue
+++ b/frontend/src/components/DataSourceMemberTable.vue
@@ -74,10 +74,10 @@
</BBTableCell>
<BBTableCell>
<router-link
- v-if="member.issueId"
- :to="`/issue/${member.issueId}`"
+ v-if="member.issueID"
+ :to="`/issue/${member.issueID}`"
class="normal-link"
- >issue/{{ member.issueId }}
+ >issue/{{ member.issueID }}
</router-link>
</BBTableCell>
<BBTableCell>
@@ -158,10 +158,10 @@ export default {
const deleteMember = (member: DataSourceMember) => {
store
- .dispatch("dataSource/deleteDataSourceMemberByMemberId", {
- databaseId: props.dataSource.database.id,
- dataSourceId: props.dataSource.id,
- memberId: member.principal.id,
+ .dispatch("dataSource/deleteDataSourceMemberByMemberID", {
+ databaseID: props.dataSource.database.id,
+ dataSourceID: props.dataSource.id,
+ memberID: member.principal.id,
})
.then(() => {
store.dispatch("notification/pushNotification", {
diff --git a/frontend/src/components/DataSourceSelect.vue b/frontend/src/components/DataSourceSelect.vue
index 60c09baa1e..84c19a933f 100644
--- a/frontend/src/components/DataSourceSelect.vue
+++ b/frontend/src/components/DataSourceSelect.vue
@@ -8,7 +8,7 @@
}
"
>
- <option disabled :selected="undefined === state.selectedId">
+ <option disabled :selected="undefined === state.selectedID">
<template v-if="!database"> Select database first </template>
<template v-else> Select data source </template>
</option>
@@ -17,7 +17,7 @@
v-for="(dataSource, index) in database.dataSourceList"
:key="index"
:value="dataSource.id"
- :selected="dataSource.id == state.selectedId"
+ :selected="dataSource.id == state.selectedID"
>
<template v-if="dataSource.type == 'RO'">
{{ dataSource.name }} (readonly)
@@ -36,7 +36,7 @@ import { useStore } from "vuex";
import { Database } from "../types";
interface LocalState {
- selectedId?: number;
+ selectedID?: number;
}
export default {
@@ -44,7 +44,7 @@ export default {
emits: ["select-data-source-id"],
components: {},
props: {
- selectedId: {
+ selectedID: {
type: Number,
},
database: {
@@ -57,7 +57,7 @@ export default {
},
setup(props, { emit }) {
const state = reactive<LocalState>({
- selectedId: props.selectedId,
+ selectedID: props.selectedID,
});
return {
diff --git a/frontend/src/components/DataSourceTable.vue b/frontend/src/components/DataSourceTable.vue
index ec5899bce1..bb18f865bc 100644
--- a/frontend/src/components/DataSourceTable.vue
+++ b/frontend/src/components/DataSourceTable.vue
@@ -105,7 +105,7 @@
@close="state.showCreateModal = false"
>
<DataSourceCreateForm
- :instanceId="instance.id"
+ :instanceID="instance.id"
:database="database"
@create="doCreate"
@cancel="state.showCreateModal = false"
@@ -176,7 +176,7 @@ export default {
const dataSourceSectionList = computed(() => {
const databaseList = props.database
? [props.database]
- : store.getters["database/databaseListByInstanceId"](props.instance.id);
+ : store.getters["database/databaseListByInstanceID"](props.instance.id);
const dataSourceListByDatabase: Map<string, DataSource[]> = new Map();
databaseList.forEach((database: Database) => {
for (const dataSource of database.dataSourceList) {
diff --git a/frontend/src/components/DatabaseBackupPanel.vue b/frontend/src/components/DatabaseBackupPanel.vue
index 9035dc0d0a..17e320be2d 100644
--- a/frontend/src/components/DatabaseBackupPanel.vue
+++ b/frontend/src/components/DatabaseBackupPanel.vue
@@ -148,14 +148,14 @@ export default {
});
const prepareBackupList = () => {
- store.dispatch("backup/fetchBackupListByDatabaseId", props.database.id);
+ store.dispatch("backup/fetchBackupListByDatabaseID", props.database.id);
};
watchEffect(prepareBackupList);
const prepareBackupPolicy = () => {
store.dispatch("policy/fetchPolicyByEnvironmentAndType", {
- environmentId: props.database.instance.environment.id,
+ environmentID: props.database.instance.environment.id,
type: "bb.policy.backup-plan",
});
};
@@ -171,7 +171,7 @@ export default {
// List PENDING_CREATE backups first, followed by backups in createdTs descending order.
const backupList = computed(() => {
const list = cloneDeep(
- store.getters["backup/backupListByDatabaseId"](props.database.id)
+ store.getters["backup/backupListByDatabaseID"](props.database.id)
);
return list.sort((a: Backup, b: Backup) => {
if (a.status == "PENDING_CREATE" && b.status != "PENDING_CREATE") {
@@ -231,7 +231,7 @@ export default {
});
const backupPolicy = computed(() => {
- const policy = store.getters["policy/policyByEnvironmentIdAndType"](
+ const policy = store.getters["policy/policyByEnvironmentIDAndType"](
props.database.instance.environment.id,
"bb.policy.backup-plan"
);
@@ -245,14 +245,14 @@ export default {
const createBackup = (backupName: string) => {
// Create backup
const newBackup: BackupCreate = {
- databaseId: props.database.id!,
+ databaseID: props.database.id!,
name: backupName,
status: "PENDING_CREATE",
type: "MANUAL",
storageBackend: "LOCAL",
};
store.dispatch("backup/createBackup", {
- databaseId: props.database.id,
+ databaseID: props.database.id,
newBackup: newBackup,
});
pollBackups(POST_CHANGE_POLL_INTERVAL);
@@ -265,7 +265,7 @@ export default {
}
state.pollBackupsTimer = setTimeout(() => {
store
- .dispatch("backup/fetchBackupListByDatabaseId", props.database.id)
+ .dispatch("backup/fetchBackupListByDatabaseID", props.database.id)
.then((backups: Backup[]) => {
var pending = false;
for (let idx in backups) {
@@ -283,7 +283,7 @@ export default {
const prepareBackupSetting = () => {
store
- .dispatch("backup/fetchBackupSettingByDatabaseId", props.database.id)
+ .dispatch("backup/fetchBackupSettingByDatabaseID", props.database.id)
.then((backupSetting: BackupSetting) => {
// UNKNOWN_ID means database does not have backup setting and we should NOT overwrite the default setting.
if (backupSetting.id != UNKNOWN_ID) {
@@ -305,7 +305,7 @@ export default {
DEFAULT_BACKUP_DAYOFWEEK
);
const newBackupSetting: BackupSettingUpsert = {
- databaseId: props.database.id,
+ databaseID: props.database.id,
enabled: on,
hour: on ? hour : state.autoBackupHour,
dayOfWeek: on
diff --git a/frontend/src/components/DatabaseListSidePanel.vue b/frontend/src/components/DatabaseListSidePanel.vue
index 9b5b23a033..d31fd344c3 100644
--- a/frontend/src/components/DatabaseListSidePanel.vue
+++ b/frontend/src/components/DatabaseListSidePanel.vue
@@ -12,7 +12,7 @@ import { computed, watchEffect } from "vue";
import { useStore } from "vuex";
import cloneDeep from "lodash-es/cloneDeep";
-import { Database, Environment, EnvironmentId, UNKNOWN_ID } from "../types";
+import { Database, Environment, EnvironmentID, UNKNOWN_ID } from "../types";
import { databaseSlug, environmentName } from "../utils";
import { BBOutlineItem } from "../bbkit/types";
@@ -41,13 +41,13 @@ export default {
// Use this to make the list reactive when project is transferred.
const databaseList = computed((): Database[] => {
- return store.getters["database/databaseListByPrincipalId"](
+ return store.getters["database/databaseListByPrincipalID"](
currentUser.value.id
);
});
const databaseListByEnvironment = computed(() => {
- const envToDbMap: Map<EnvironmentId, BBOutlineItem[]> = new Map();
+ const envToDbMap: Map<EnvironmentID, BBOutlineItem[]> = new Map();
for (const environment of environmentList.value) {
envToDbMap.set(environment.id, []);
}
diff --git a/frontend/src/components/DatabaseMigrationHistoryPanel.vue b/frontend/src/components/DatabaseMigrationHistoryPanel.vue
index 501f72bbd6..114e117071 100644
--- a/frontend/src/components/DatabaseMigrationHistoryPanel.vue
+++ b/frontend/src/components/DatabaseMigrationHistoryPanel.vue
@@ -111,7 +111,7 @@ export default {
if (state.migrationSetupStatus == "OK") {
store
.dispatch("instance/fetchMigrationHistory", {
- instanceId: props.database.instance.id,
+ instanceID: props.database.instance.id,
databaseName: props.database.name,
})
.then(() => {
@@ -162,7 +162,7 @@ export default {
{
title: "",
list: store.getters[
- "instance/migrationHistoryListByInstanceIdAndDatabaseName"
+ "instance/migrationHistoryListByInstanceIDAndDatabaseName"
](props.database.instance.id, props.database.name),
},
];
diff --git a/frontend/src/components/DatabaseOverviewPanel.vue b/frontend/src/components/DatabaseOverviewPanel.vue
index d17c5bc644..94ffe85487 100644
--- a/frontend/src/components/DatabaseOverviewPanel.vue
+++ b/frontend/src/components/DatabaseOverviewPanel.vue
@@ -246,13 +246,13 @@ export default {
const currentUser = computed(() => store.getters["auth/currentUser"]());
const prepareTableList = () => {
- store.dispatch("table/fetchTableListByDatabaseId", props.database.id);
+ store.dispatch("table/fetchTableListByDatabaseID", props.database.id);
};
watchEffect(prepareTableList);
const prepareViewList = () => {
- store.dispatch("view/fetchViewListByDatabaseId", props.database.id);
+ store.dispatch("view/fetchViewListByDatabaseID", props.database.id);
};
watchEffect(prepareViewList);
@@ -275,11 +275,11 @@ export default {
);
const tableList = computed(() => {
- return store.getters["table/tableListByDatabaseId"](props.database.id);
+ return store.getters["table/tableListByDatabaseID"](props.database.id);
});
const viewList = computed(() => {
- return store.getters["view/viewListByDatabaseId"](props.database.id);
+ return store.getters["view/viewListByDatabaseID"](props.database.id);
});
const isCurrentUserDBAOrOwner = computed((): boolean => {
@@ -354,8 +354,8 @@ export default {
};
store
.dispatch("dataSource/patchDataSource", {
- databaseId: state.editingDataSource!.database.id,
- dataSourceId: state.editingDataSource!.id,
+ databaseID: state.editingDataSource!.database.id,
+ dataSourceID: state.editingDataSource!.id,
dataSource: dataSourcePatch,
})
.then(() => {
diff --git a/frontend/src/components/DatabaseSelect.vue b/frontend/src/components/DatabaseSelect.vue
index 5f6ce9e594..2bc60c9c6a 100644
--- a/frontend/src/components/DatabaseSelect.vue
+++ b/frontend/src/components/DatabaseSelect.vue
@@ -4,17 +4,17 @@
:disabled="disabled"
@change="
(e) => {
- state.selectedId = e.target.value;
+ state.selectedID = e.target.value;
$emit('select-database-id', parseInt(e.target.value));
}
"
>
- <option disabled :selected="UNKNOWN_ID === state.selectedId">
- <template v-if="mode == 'INSTANCE' && instanceId == UNKNOWN_ID">
+ <option disabled :selected="UNKNOWN_ID === state.selectedID">
+ <template v-if="mode == 'INSTANCE' && instanceID == UNKNOWN_ID">
Select instance first
</template>
<template
- v-else-if="mode == 'ENVIRONMENT' && environmentId == UNKNOWN_ID"
+ v-else-if="mode == 'ENVIRONMENT' && environmentID == UNKNOWN_ID"
>
Select environment first
</template>
@@ -24,7 +24,7 @@
v-for="(database, index) in databaseList"
:key="index"
:value="database.id"
- :selected="database.id == state.selectedId"
+ :selected="database.id == state.selectedID"
>
{{ database.name }}
</option>
@@ -38,13 +38,13 @@ import {
UNKNOWN_ID,
Database,
Principal,
- ProjectId,
- InstanceId,
- EnvironmentId,
+ ProjectID,
+ InstanceID,
+ EnvironmentID,
} from "../types";
interface LocalState {
- selectedId?: number;
+ selectedID?: number;
}
export default {
@@ -52,7 +52,7 @@ export default {
emits: ["select-database-id"],
components: {},
props: {
- selectedId: {
+ selectedID: {
required: true,
type: Number,
},
@@ -60,17 +60,17 @@ export default {
required: true,
type: String as PropType<"INSTANCE" | "ENVIRONMENT" | "USER">,
},
- environmentId: {
+ environmentID: {
default: UNKNOWN_ID,
- type: Number as PropType<EnvironmentId>,
+ type: Number as PropType<EnvironmentID>,
},
- instanceId: {
+ instanceID: {
default: UNKNOWN_ID,
- type: Number as PropType<InstanceId>,
+ type: Number as PropType<InstanceID>,
},
- projectId: {
+ projectID: {
default: UNKNOWN_ID,
- type: Number as PropType<ProjectId>,
+ type: Number as PropType<ProjectID>,
},
disabled: {
default: false,
@@ -80,7 +80,7 @@ export default {
setup(props, { emit }) {
const store = useStore();
const state = reactive<LocalState>({
- selectedId: props.selectedId,
+ selectedID: props.selectedID,
});
const currentUser = computed(
@@ -90,15 +90,15 @@ export default {
const prepareDatabaseList = () => {
// TODO(tianzhou): Instead of fetching each time, we maybe able to let the outside context
// to provide the database list and we just do a get here.
- if (props.mode == "ENVIRONMENT" && props.environmentId != UNKNOWN_ID) {
+ if (props.mode == "ENVIRONMENT" && props.environmentID != UNKNOWN_ID) {
store.dispatch(
- "database/fetchDatabaseListByEnvironmentId",
- props.environmentId
+ "database/fetchDatabaseListByEnvironmentID",
+ props.environmentID
);
- } else if (props.mode == "INSTANCE" && props.instanceId != UNKNOWN_ID) {
+ } else if (props.mode == "INSTANCE" && props.instanceID != UNKNOWN_ID) {
store.dispatch(
- "database/fetchDatabaseListByInstanceId",
- props.instanceId
+ "database/fetchDatabaseListByInstanceID",
+ props.instanceID
);
} else if (props.mode == "USER") {
// We assume the database list for the current user should have already been fetched, so we won't do a fetch here.
@@ -109,28 +109,28 @@ export default {
const databaseList = computed(() => {
let list: Database[] = [];
- if (props.mode == "ENVIRONMENT" && props.environmentId != UNKNOWN_ID) {
- list = store.getters["database/databaseListByEnvironmentId"](
- props.environmentId
+ if (props.mode == "ENVIRONMENT" && props.environmentID != UNKNOWN_ID) {
+ list = store.getters["database/databaseListByEnvironmentID"](
+ props.environmentID
);
- } else if (props.mode == "INSTANCE" && props.instanceId != UNKNOWN_ID) {
- list = store.getters["database/databaseListByInstanceId"](
- props.instanceId
+ } else if (props.mode == "INSTANCE" && props.instanceID != UNKNOWN_ID) {
+ list = store.getters["database/databaseListByInstanceID"](
+ props.instanceID
);
} else if (props.mode == "USER") {
- list = store.getters["database/databaseListByPrincipalId"](
+ list = store.getters["database/databaseListByPrincipalID"](
currentUser.value.id
);
if (
- props.environmentId != UNKNOWN_ID ||
- props.projectId != UNKNOWN_ID
+ props.environmentID != UNKNOWN_ID ||
+ props.projectID != UNKNOWN_ID
) {
list = list.filter((database: Database) => {
return (
- (props.environmentId == UNKNOWN_ID ||
- database.instance.environment.id == props.environmentId) &&
- (props.projectId == UNKNOWN_ID ||
- database.project.id == props.projectId)
+ (props.environmentID == UNKNOWN_ID ||
+ database.instance.environment.id == props.environmentID) &&
+ (props.projectID == UNKNOWN_ID ||
+ database.project.id == props.projectID)
);
});
}
@@ -140,17 +140,17 @@ export default {
const invalidateSelectionIfNeeded = () => {
if (
- state.selectedId != UNKNOWN_ID &&
+ state.selectedID != UNKNOWN_ID &&
!databaseList.value.find(
- (database: Database) => database.id == state.selectedId
+ (database: Database) => database.id == state.selectedID
)
) {
- state.selectedId = UNKNOWN_ID;
- emit("select-database-id", state.selectedId);
+ state.selectedID = UNKNOWN_ID;
+ emit("select-database-id", state.selectedID);
}
};
- // The database list might change if environmentId changes, and the previous selected id
+ // The database list might change if environmentID changes, and the previous selected id
// might not exist in the new list. In such case, we need to invalidate the selection
// and emit the event.
watch(
@@ -161,9 +161,9 @@ export default {
);
watch(
- () => props.selectedId,
+ () => props.selectedID,
(cur, _) => {
- state.selectedId = cur;
+ state.selectedID = cur;
}
);
diff --git a/frontend/src/components/EnvironmentSelect.vue b/frontend/src/components/EnvironmentSelect.vue
index 47224a2a49..3a8a8ae922 100644
--- a/frontend/src/components/EnvironmentSelect.vue
+++ b/frontend/src/components/EnvironmentSelect.vue
@@ -8,19 +8,19 @@
}
"
>
- <option disabled :selected="undefined === state.selectedId">
+ <option disabled :selected="undefined === state.selectedID">
Select environment
</option>
<template v-for="(environment, index) in environmentList" :key="index">
<option
v-if="environment.rowStatus == 'NORMAL'"
:value="environment.id"
- :selected="environment.id == state.selectedId"
+ :selected="environment.id == state.selectedID"
>
{{ environmentName(environment) }}
</option>
<option
- v-else-if="environment.id == state.selectedId"
+ v-else-if="environment.id == state.selectedID"
:value="environment.id"
:selected="true"
>
@@ -34,10 +34,10 @@
import { computed, reactive, watch } from "vue";
import { useStore } from "vuex";
import cloneDeep from "lodash-es/cloneDeep";
-import { Environment, EnvironmentId } from "../types";
+import { Environment, EnvironmentID } from "../types";
interface LocalState {
- selectedId?: Number;
+ selectedID?: Number;
}
export default {
@@ -45,7 +45,7 @@ export default {
emits: ["select-environment-id"],
components: {},
props: {
- selectedId: {
+ selectedID: {
type: Number,
},
selectDefault: {
@@ -60,7 +60,7 @@ export default {
setup(props, { emit }) {
const store = useStore();
const state = reactive<LocalState>({
- selectedId: props.selectedId,
+ selectedID: props.selectedID,
});
const environmentList = computed(() => {
@@ -71,16 +71,16 @@ export default {
if (environmentList.value && environmentList.value.length > 0) {
if (
- !props.selectedId ||
+ !props.selectedID ||
!environmentList.value.find(
- (item: Environment) => item.id == props.selectedId
+ (item: Environment) => item.id == props.selectedID
)
) {
if (props.selectDefault) {
for (const environment of environmentList.value) {
if (environment.rowStatus == "NORMAL") {
- state.selectedId = environment.id;
- emit("select-environment-id", state.selectedId);
+ state.selectedID = environment.id;
+ emit("select-environment-id", state.selectedID);
break;
}
}
@@ -90,13 +90,13 @@ export default {
const invalidateSelectionIfNeeded = () => {
if (
- state.selectedId &&
+ state.selectedID &&
!environmentList.value.find(
- (item: Environment) => item.id == state.selectedId
+ (item: Environment) => item.id == state.selectedID
)
) {
- state.selectedId = undefined;
- emit("select-environment-id", state.selectedId);
+ state.selectedID = undefined;
+ emit("select-environment-id", state.selectedID);
}
};
@@ -108,9 +108,9 @@ export default {
);
watch(
- () => props.selectedId,
+ () => props.selectedID,
(cur, _) => {
- state.selectedId = cur;
+ state.selectedID = cur;
}
);
diff --git a/frontend/src/components/EnvironmentTabFilter.vue b/frontend/src/components/EnvironmentTabFilter.vue
index da4a678b41..342c2f909d 100644
--- a/frontend/src/components/EnvironmentTabFilter.vue
+++ b/frontend/src/components/EnvironmentTabFilter.vue
@@ -30,7 +30,7 @@ export default {
emits: ["select-environment"],
components: {},
props: {
- selectedId: {
+ selectedID: {
type: Number,
},
},
@@ -46,19 +46,19 @@ export default {
});
const state = reactive<LocalState>({
- selectedIndex: props.selectedId
+ selectedIndex: props.selectedID
? environmentList.value.findIndex(
- (environment: Environment) => environment.id == props.selectedId
+ (environment: Environment) => environment.id == props.selectedID
) + 1
: 0,
});
watch(
- () => props.selectedId,
+ () => props.selectedID,
() => {
- state.selectedIndex = props.selectedId
+ state.selectedIndex = props.selectedID
? environmentList.value.findIndex(
- (environment: Environment) => environment.id == props.selectedId
+ (environment: Environment) => environment.id == props.selectedID
) + 1
: 0;
}
diff --git a/frontend/src/components/InboxList.vue b/frontend/src/components/InboxList.vue
index 75a7cd475b..632c9bf247 100644
--- a/frontend/src/components/InboxList.vue
+++ b/frontend/src/components/InboxList.vue
@@ -115,10 +115,10 @@ export default {
const actionLink = (activity: Activity): string => {
if (activity.type.startsWith("bb.issue.")) {
- return `/issue/${activity.containerId}`;
+ return `/issue/${activity.containerID}`;
} else if (activity.type == "bb.pipeline.task.status.update") {
const payload = activity.payload as ActivityTaskStatusUpdatePayload;
- return `/issue/${activity.containerId}?task=${payload.taskId}`;
+ return `/issue/${activity.containerID}?task=${payload.taskID}`;
}
return "";
@@ -189,7 +189,7 @@ export default {
if (inbox.status == "UNREAD") {
store
.dispatch("inbox/patchInbox", {
- inboxId: inbox.id,
+ inboxID: inbox.id,
inboxPatch: {
status: "READ",
},
diff --git a/frontend/src/components/InstanceForm.vue b/frontend/src/components/InstanceForm.vue
index d503e485be..95d74f81e6 100644
--- a/frontend/src/components/InstanceForm.vue
+++ b/frontend/src/components/InstanceForm.vue
@@ -117,17 +117,17 @@ input[type="number"] {
id="environment"
name="environment"
:disabled="!create"
- :selectedId="
+ :selectedID="
create
- ? state.instance.environmentId
+ ? state.instance.environmentID
: state.instance.environment.id
"
@select-environment-id="
- (environmentId) => {
+ (environmentID) => {
if (create) {
- state.instance.environmentId = environmentId;
+ state.instance.environmentID = environmentID;
} else {
- updateInstance('environmentId', environmentId);
+ updateInstance('environmentID', environmentID);
}
}
"
@@ -569,7 +569,7 @@ export default {
instance: props.instance
? cloneDeep(props.instance)
: {
- environmentId: UNKNOWN_ID,
+ environmentID: UNKNOWN_ID,
name: "New Instance",
engine: "MYSQL",
// In dev mode, Bytebase is likely run in naked style and access the local network via 127.0.0.1.
@@ -778,7 +778,7 @@ export default {
state.creatingOrUpdating = true;
store
.dispatch("instance/patchInstance", {
- instanceId: (state.instance as Instance).id,
+ instanceID: (state.instance as Instance).id,
instancePatch: patchedInstance,
})
.then((instance) => {
@@ -798,7 +798,7 @@ export default {
// Backend will sync the schema upon connection info change, so here we try to fetch the synced schema.
if (connectionInfoChanged) {
store.dispatch(
- "database/fetchDatabaseListByInstanceId",
+ "database/fetchDatabaseListByInstanceID",
instance.id
);
}
@@ -829,7 +829,7 @@ export default {
useEmptyPassword: state.useEmptyPassword,
host: state.instance.host,
port: state.instance.port,
- instanceId: props.create ? undefined : (state.instance as Instance).id,
+ instanceID: props.create ? undefined : (state.instance as Instance).id,
};
store
.dispatch("sql/ping", connectionInfo)
diff --git a/frontend/src/components/InstanceSelect.vue b/frontend/src/components/InstanceSelect.vue
index 0220e1455c..c4ce4e5474 100644
--- a/frontend/src/components/InstanceSelect.vue
+++ b/frontend/src/components/InstanceSelect.vue
@@ -8,7 +8,7 @@
}
"
>
- <option disabled :selected="undefined === state.selectedId">
+ <option disabled :selected="undefined === state.selectedID">
Select instance
</option>
<template v-for="(instance, index) in instanceList" :key="index">
@@ -16,12 +16,12 @@
v-if="instance.rowStatus == 'NORMAL'"
:key="index"
:value="instance.id"
- :selected="instance.id == state.selectedId"
+ :selected="instance.id == state.selectedID"
>
{{ instanceName(instance) }}
</option>
<option
- v-else-if="instance.id == state.selectedId"
+ v-else-if="instance.id == state.selectedID"
:value="instance.id"
:selected="true"
>
@@ -37,7 +37,7 @@ import { useStore } from "vuex";
import { Instance } from "../types";
interface LocalState {
- selectedId?: number;
+ selectedID?: number;
}
export default {
@@ -45,10 +45,10 @@ export default {
emits: ["select-instance-id"],
components: {},
props: {
- selectedId: {
+ selectedID: {
type: Number,
},
- environmentId: {
+ environmentID: {
type: Number,
},
disabled: {
@@ -59,13 +59,13 @@ export default {
setup(props, { emit }) {
const store = useStore();
const state = reactive<LocalState>({
- selectedId: props.selectedId,
+ selectedID: props.selectedID,
});
const instanceList = computed(() => {
- if (props.environmentId) {
- return store.getters["instance/instanceListByEnvironmentId"](
- props.environmentId,
+ if (props.environmentID) {
+ return store.getters["instance/instanceListByEnvironmentID"](
+ props.environmentID,
["NORMAL", "ARCHIVED"]
);
}
@@ -73,23 +73,23 @@ export default {
});
watch(
- () => props.selectedId,
+ () => props.selectedID,
(cur, _) => {
- state.selectedId = cur;
+ state.selectedID = cur;
}
);
- // The instance list might change if environmentId changes, and the previous selected id
+ // The instance list might change if environmentID changes, and the previous selected id
// might not exist in the new list. In such case, we need to invalidate the selection
// and emit the event.
watch(
() => instanceList.value,
(curList, _) => {
if (
- state.selectedId &&
- !curList.find((instance: Instance) => instance.id == state.selectedId)
+ state.selectedID &&
+ !curList.find((instance: Instance) => instance.id == state.selectedID)
) {
- state.selectedId = undefined;
+ state.selectedID = undefined;
emit("select-instance-id", undefined);
}
}
diff --git a/frontend/src/components/InstanceTable.vue b/frontend/src/components/InstanceTable.vue
index 484661b91c..05d369c561 100644
--- a/frontend/src/components/InstanceTable.vue
+++ b/frontend/src/components/InstanceTable.vue
@@ -15,7 +15,7 @@
{{ instanceName(instance) }}
</BBTableCell>
<BBTableCell class="w-16">
- {{ environmentNameFromId(instance.environment.id) }}
+ {{ environmentNameFromID(instance.environment.id) }}
</BBTableCell>
<BBTableCell class="w-48">
<template v-if="instance.port"
@@ -58,7 +58,7 @@ import { useRouter } from "vue-router";
import { BBTableColumn } from "../bbkit/types";
import InstanceEngineIcon from "./InstanceEngineIcon.vue";
import { urlfy, instanceSlug, environmentName } from "../utils";
-import { EnvironmentId, Instance } from "../types";
+import { EnvironmentID, Instance } from "../types";
interface LocalState {
columnList: BBTableColumn[];
@@ -108,8 +108,8 @@ export default {
router.push(`/instance/${instanceSlug(instance)}`);
};
- const environmentNameFromId = function (id: EnvironmentId) {
- return environmentName(store.getters["environment/environmentById"](id));
+ const environmentNameFromID = function (id: EnvironmentID) {
+ return environmentName(store.getters["environment/environmentByID"](id));
};
const instanceLink = (instance: Instance): string => {
@@ -127,7 +127,7 @@ export default {
state,
urlfy,
clickInstance,
- environmentNameFromId,
+ environmentNameFromID,
instanceLink,
};
},
diff --git a/frontend/src/components/IssueActivityPanel.vue b/frontend/src/components/IssueActivityPanel.vue
index 919529bb24..43ecef7e88 100644
--- a/frontend/src/components/IssueActivityPanel.vue
+++ b/frontend/src/components/IssueActivityPanel.vue
@@ -344,14 +344,14 @@
<span
v-if="
activity.type == 'bb.issue.create' &&
- activity.payload.rollbackIssueId
+ activity.payload.rollbackIssueID
"
>
(rollback
<router-link
- :to="`/issue/${activity.payload.rollbackIssueId}`"
+ :to="`/issue/${activity.payload.rollbackIssueID}`"
class="normal-link"
- >{{ `issue/${activity.payload.rollbackIssueId}` }}
+ >{{ `issue/${activity.payload.rollbackIssueID}` }}
</router-link>
)
</span>
@@ -496,7 +496,7 @@
v-if="activity.type == 'bb.pipeline.task.file.commit'"
>
<a
- :href="`${activity.payload.vcsInstanceUrl}/${activity.payload.repositoryFullPath}/-/commit/${activity.payload.commitId}`"
+ :href="`${activity.payload.vcsInstanceUrl}/${activity.payload.repositoryFullPath}/-/commit/${activity.payload.commitID}`"
target="__blank"
class="normal-link flex flex-row items-center"
>View commit
@@ -631,14 +631,14 @@ import {
ActivityTaskFileCommitPayload,
} from "../types";
import {
- findTaskById,
+ findTaskByID,
issueActivityActionSentence,
issueSlug,
sizeToFit,
stageSlug,
taskSlug,
} from "../utils";
-import { IssueTemplate, IssueBuiltinFieldId } from "../plugins";
+import { IssueTemplate, IssueBuiltinFieldID } from "../plugins";
interface LocalState {
showDeleteCommentModal: boolean;
@@ -746,8 +746,8 @@ export default {
return list.filter((activity: Activity) => {
if (activity.type == "bb.issue.field.update") {
let containUserVisibleChange =
- (activity.payload as ActivityIssueFieldUpdatePayload).fieldId !=
- IssueBuiltinFieldId.SUBSCRIBER_LIST;
+ (activity.payload as ActivityIssueFieldUpdatePayload).fieldID !=
+ IssueBuiltinFieldID.SUBSCRIBER_LIST;
return containUserVisibleChange;
}
return true;
@@ -769,7 +769,7 @@ export default {
const doCreateComment = () => {
const createActivity: ActivityCreate = {
type: "bb.issue.comment.create",
- containerId: props.issue.id,
+ containerID: props.issue.id,
comment: newComment.value,
};
store.dispatch("activity/createActivity", createActivity).then(() => {
@@ -808,7 +808,7 @@ export default {
const doUpdateComment = () => {
const activityPatch = store
.dispatch("activity/updateComment", {
- activityId: state.activeActivity!.id,
+ activityID: state.activeActivity!.id,
updatedComment: editComment.value,
})
.then(() => {
@@ -870,7 +870,7 @@ export default {
if (activity.type == "bb.pipeline.task.status.update") {
if (props.issue.pipeline.id != EMPTY_ID) {
const payload = activity.payload as ActivityTaskStatusUpdatePayload;
- const task = findTaskById(props.issue.pipeline, payload.taskId);
+ const task = findTaskByID(props.issue.pipeline, payload.taskID);
var link = "";
if (task.id != UNKNOWN_ID) {
link = `/issue/${issueSlug(
@@ -924,7 +924,7 @@ export default {
if (activity.creator.id != SYSTEM_BOT_ID) {
// If creator is not the robot (which means we do NOT use task name in the subject),
// then we append the task name here.
- const task = findTaskById(props.issue.pipeline, payload.taskId);
+ const task = findTaskByID(props.issue.pipeline, payload.taskID);
str += ` task ${task.name}`;
}
return str;
diff --git a/frontend/src/components/IssueOutputPanel.vue b/frontend/src/components/IssueOutputPanel.vue
index 7145b54311..f8651288f2 100644
--- a/frontend/src/components/IssueOutputPanel.vue
+++ b/frontend/src/components/IssueOutputPanel.vue
@@ -133,11 +133,11 @@
class="mt-1 w-64"
:disabled="!allowEditDatabase"
:mode="'ENVIRONMENT'"
- :environmentId="environmentId"
- :selectedId="fieldValue(field) || UNKNOWN_ID"
+ :environmentID="environmentID"
+ :selectedID="fieldValue(field) || UNKNOWN_ID"
@select-database-id="
- (databaseId) => {
- trySaveCustomField(field, databaseId);
+ (databaseID) => {
+ trySaveCustomField(field, databaseID);
}
"
/>
@@ -169,8 +169,8 @@ import isEqual from "lodash-es/isEqual";
import { toClipboard } from "@soerenmartius/vue3-clipboard";
import DatabaseSelect from "../components/DatabaseSelect.vue";
import { activeEnvironment, fullDatabasePath } from "../utils";
-import { OutputField, IssueBuiltinFieldId, IssueContext } from "../plugins";
-import { DatabaseId, EnvironmentId, Issue, UNKNOWN_ID } from "../types";
+import { OutputField, IssueBuiltinFieldID, IssueContext } from "../plugins";
+import { DatabaseID, EnvironmentID, Issue, UNKNOWN_ID } from "../types";
interface LocalState {}
@@ -200,7 +200,7 @@ export default {
const currentUser = computed(() => store.getters["auth/currentUser"]());
- const environmentId = computed((): EnvironmentId => {
+ const environmentID = computed((): EnvironmentID => {
return activeEnvironment(props.issue.pipeline).id;
});
@@ -257,7 +257,7 @@ export default {
const trySaveCustomField = (
field: OutputField,
- value: string | DatabaseId
+ value: string | DatabaseID
) => {
if (!isEqual(value, fieldValue(field))) {
emit("update-custom-field", field, value);
@@ -267,7 +267,7 @@ export default {
return {
UNKNOWN_ID,
state,
- environmentId,
+ environmentID,
fieldValue,
issueContext,
allowEditDatabase,
diff --git a/frontend/src/components/IssueSidebar.vue b/frontend/src/components/IssueSidebar.vue
index a7774b7279..b41be9264c 100644
--- a/frontend/src/components/IssueSidebar.vue
+++ b/frontend/src/components/IssueSidebar.vue
@@ -23,11 +23,11 @@
<div class="col-span-2">
<MemberSelect
:disabled="!allowEditAssignee"
- :selectedId="create ? issue.assigneeId : issue.assignee?.id"
+ :selectedID="create ? issue.assigneeID : issue.assignee?.id"
:allowedRoleList="['OWNER', 'DBA']"
@select-principal-id="
- (principalId) => {
- $emit('update-assignee-id', principalId);
+ (principalID) => {
+ $emit('update-assignee-id', principalID);
}
"
/>
@@ -80,8 +80,8 @@
<div class="col-span-2">
<StageSelect
:pipeline="issue.pipeline"
- :selectedId="selectedStage.id"
- @select-stage-id="(stageId) => $emit('select-stage-id', stageId)"
+ :selectedID="selectedStage.id"
+ @select-stage-id="(stageID) => $emit('select-stage-id', stageID)"
/>
</div>
</template>
@@ -181,10 +181,10 @@
v-if="!create"
:issue="issue"
@add-subscriber-id="
- (subscriberId) => $emit('add-subscriber-id', subscriberId)
+ (subscriberID) => $emit('add-subscriber-id', subscriberID)
"
@remove-subscriber-id="
- (subscriberId) => $emit('remove-subscriber-id', subscriberId)
+ (subscriberID) => $emit('remove-subscriber-id', subscriberID)
"
/>
</aside>
@@ -309,8 +309,8 @@ export default {
const environment = computed((): Environment => {
if (props.create) {
const stage = props.selectedStage as StageCreate;
- return store.getters["environment/environmentById"](
- stage.environmentId
+ return store.getters["environment/environmentByID"](
+ stage.environmentID
);
}
const stage = props.selectedStage as Stage;
@@ -319,8 +319,8 @@ export default {
const project = computed((): Project => {
if (props.create) {
- return store.getters["project/projectById"](
- (props.issue as IssueCreate).projectId
+ return store.getters["project/projectByID"](
+ (props.issue as IssueCreate).projectID
);
}
return (props.issue as Issue).project;
@@ -391,7 +391,7 @@ export default {
} else {
store
.dispatch(
- "database/fetchDatabaseListByInstanceId",
+ "database/fetchDatabaseListByInstanceID",
props.instance.value.id
)
.then((list: Database[]) => {
diff --git a/frontend/src/components/IssueStatusTransitionButtonGroup.vue b/frontend/src/components/IssueStatusTransitionButtonGroup.vue
index 2d8c78e606..80bf0fbe00 100644
--- a/frontend/src/components/IssueStatusTransitionButtonGroup.vue
+++ b/frontend/src/components/IssueStatusTransitionButtonGroup.vue
@@ -151,7 +151,7 @@ import {
Principal,
SYSTEM_BOT_ID,
Task,
- TaskId,
+ TaskID,
UNKNOWN_ID,
} from "../types";
import { IssueTemplate } from "../plugins";
@@ -400,7 +400,7 @@ export default {
return false;
}
- if (newIssue.assigneeId == UNKNOWN_ID) {
+ if (newIssue.assigneeID == UNKNOWN_ID) {
return false;
}
diff --git a/frontend/src/components/MemberAddOrInvite.vue b/frontend/src/components/MemberAddOrInvite.vue
index 1449b9f4b3..7fefcf996d 100644
--- a/frontend/src/components/MemberAddOrInvite.vue
+++ b/frontend/src/components/MemberAddOrInvite.vue
@@ -251,7 +251,7 @@ export default {
.dispatch("principal/createPrincipal", newPrincipal)
.then((principal: Principal) => {
const newMember: MemberCreate = {
- principalId: principal.id,
+ principalID: principal.id,
status: isAdd.value ? "ACTIVE" : "INVITED",
role,
};
diff --git a/frontend/src/components/MemberSelect.vue b/frontend/src/components/MemberSelect.vue
index a461a3c669..e86e5851b4 100644
--- a/frontend/src/components/MemberSelect.vue
+++ b/frontend/src/components/MemberSelect.vue
@@ -6,7 +6,7 @@
:disabled="disabled"
@select-item="
(principal) => {
- state.selectedId = principal.id;
+ state.selectedID = principal.id;
$emit('select-principal-id', parseInt(principal.id));
}
"
@@ -43,14 +43,14 @@ import PrincipalAvatar from "./PrincipalAvatar.vue";
import {
Member,
Principal,
- PrincipalId,
+ PrincipalID,
RoleType,
SYSTEM_BOT_ID,
} from "../types";
import { isDBA, isDeveloper, isOwner } from "../utils";
interface LocalState {
- selectedId?: PrincipalId;
+ selectedID?: PrincipalID;
showMenu: boolean;
}
@@ -59,7 +59,7 @@ export default {
emits: ["select-principal-id"],
components: { PrincipalAvatar },
props: {
- selectedId: {
+ selectedID: {
type: Number,
},
disabled: {
@@ -81,7 +81,7 @@ export default {
},
setup(props, { emit }) {
const state = reactive<LocalState>({
- selectedId: props.selectedId,
+ selectedID: props.selectedID,
showMenu: false,
});
const store = useStore();
@@ -96,14 +96,14 @@ export default {
});
// If system bot is the selected ID (e.g. when issue is created by the bot on observing new sql file),
// Then we add system bot to the list so it can display properly.
- if (props.selectedId == SYSTEM_BOT_ID) {
- list.unshift(store.getters["principal/principalById"](SYSTEM_BOT_ID));
+ if (props.selectedID == SYSTEM_BOT_ID) {
+ list.unshift(store.getters["principal/principalByID"](SYSTEM_BOT_ID));
}
return list.filter((item: Principal) => {
// The previouly selected item might no longer be applicable.
// e.g. The select limits to DBA only and the selected principal is no longer a DBA
// in such case, we still show the item.
- if (item.id == props.selectedId) {
+ if (item.id == props.selectedID) {
return true;
}
@@ -119,15 +119,15 @@ export default {
});
watch(
- () => props.selectedId,
+ () => props.selectedID,
(cur, _) => {
- state.selectedId = cur;
+ state.selectedID = cur;
}
);
const selectedPrincipal = computed(() =>
principalList.value.find(
- (principal: Principal) => principal.id == state.selectedId
+ (principal: Principal) => principal.id == state.selectedID
)
);
diff --git a/frontend/src/components/MemberTable.vue b/frontend/src/components/MemberTable.vue
index a9a0921d8c..cb75780454 100644
--- a/frontend/src/components/MemberTable.vue
+++ b/frontend/src/components/MemberTable.vue
@@ -151,7 +151,7 @@ import { computed, PropType, reactive } from "vue";
import { useStore } from "vuex";
import RoleSelect from "../components/RoleSelect.vue";
import PrincipalAvatar from "../components/PrincipalAvatar.vue";
-import { MemberId, RoleType, MemberPatch, Member, RowStatus } from "../types";
+import { MemberID, RoleType, MemberPatch, Member, RowStatus } from "../types";
import { BBTableColumn, BBTableSectionDataSource } from "../bbkit/types";
import { isOwner } from "../utils";
@@ -275,7 +275,7 @@ export default {
// return !hasAdminFeature.value && isOwner(currentUser.value.role);
});
- const changeRole = (id: MemberId, role: RoleType) => {
+ const changeRole = (id: MemberID, role: RoleType) => {
const memberPatch: MemberPatch = {
role,
};
@@ -285,7 +285,7 @@ export default {
});
};
- const changeRowStatus = (id: MemberId, rowStatus: RowStatus) => {
+ const changeRowStatus = (id: MemberID, rowStatus: RowStatus) => {
const memberPatch: MemberPatch = {
rowStatus,
};
diff --git a/frontend/src/components/MigrationHistoryTable.vue b/frontend/src/components/MigrationHistoryTable.vue
index c35f3ea258..2a5ce5552e 100644
--- a/frontend/src/components/MigrationHistoryTable.vue
+++ b/frontend/src/components/MigrationHistoryTable.vue
@@ -53,13 +53,13 @@
>
</BBTableCell>
<BBTableCell>
- <template v-if="history.issueId">
+ <template v-if="history.issueID">
<!--Short circuit the click event to prevent propagating to row click-->
<router-link
@click.stop=""
- :to="`/issue/${history.issueId}`"
+ :to="`/issue/${history.issueID}`"
class="normal-link"
- >{{ history.issueId }}
+ >{{ history.issueID }}
</router-link>
</template>
</BBTableCell>
diff --git a/frontend/src/components/ProjectActivityPanel.vue b/frontend/src/components/ProjectActivityPanel.vue
index 5c53bbb595..5a80f78a74 100644
--- a/frontend/src/components/ProjectActivityPanel.vue
+++ b/frontend/src/components/ProjectActivityPanel.vue
@@ -36,7 +36,7 @@ export default {
const prepareActivityList = () => {
store
.dispatch("activity/fetchActivityListForProject", {
- projectId: props.project.id,
+ projectID: props.project.id,
})
.then((list) => {
state.activityList = list;
diff --git a/frontend/src/components/ProjectGeneralSettingPanel.vue b/frontend/src/components/ProjectGeneralSettingPanel.vue
index 3abb3c2aee..9990b9100b 100644
--- a/frontend/src/components/ProjectGeneralSettingPanel.vue
+++ b/frontend/src/components/ProjectGeneralSettingPanel.vue
@@ -108,7 +108,7 @@ export default {
}
store
.dispatch("project/patchProject", {
- projectId: props.project.id,
+ projectID: props.project.id,
projectPatch,
})
.then((updatedProject: Project) => {
diff --git a/frontend/src/components/ProjectListSidePanel.vue b/frontend/src/components/ProjectListSidePanel.vue
index 5eea69ec16..b131734770 100644
--- a/frontend/src/components/ProjectListSidePanel.vue
+++ b/frontend/src/components/ProjectListSidePanel.vue
@@ -27,7 +27,7 @@ export default {
// It will also be called when user logout
if (currentUser.value.id != UNKNOWN_ID) {
store.dispatch("project/fetchProjectListByUser", {
- userId: currentUser.value.id,
+ userID: currentUser.value.id,
});
}
};
diff --git a/frontend/src/components/ProjectMemberPanel.vue b/frontend/src/components/ProjectMemberPanel.vue
index 4aaaa1936f..11bdb9aaa7 100644
--- a/frontend/src/components/ProjectMemberPanel.vue
+++ b/frontend/src/components/ProjectMemberPanel.vue
@@ -14,10 +14,10 @@
name="user"
:required="false"
:placeholder="'Select user'"
- :selectedId="state.principalId"
+ :selectedID="state.principalID"
@select-principal-id="
- (principalId) => {
- state.principalId = principalId;
+ (principalID) => {
+ state.principalID = principalID;
clearValidationError();
validateMember();
}
@@ -91,7 +91,7 @@ import MemberSelect from "../components/MemberSelect.vue";
import ProjectMemberTable from "../components/ProjectMemberTable.vue";
import {
DEFAULT_PROJECT_ID,
- PrincipalId,
+ PrincipalID,
Project,
ProjectMember,
ProjectMemberCreate,
@@ -101,7 +101,7 @@ import {
import { isOwner, isProjectOwner } from "../utils";
interface LocalState {
- principalId: PrincipalId;
+ principalID: PrincipalID;
role: ProjectRoleType;
error: string;
}
@@ -121,7 +121,7 @@ export default {
const currentUser = computed(() => store.getters["auth/currentUser"]());
const state = reactive<LocalState>({
- principalId: UNKNOWN_ID,
+ principalID: UNKNOWN_ID,
role: "DEVELOPER",
error: "",
});
@@ -156,15 +156,15 @@ export default {
const hasValidMember = computed(() => {
return (
- state.principalId != UNKNOWN_ID && validateInviteInternal().length == 0
+ state.principalID != UNKNOWN_ID && validateInviteInternal().length == 0
);
});
const validateInviteInternal = (): string => {
- if (state.principalId != UNKNOWN_ID) {
+ if (state.principalID != UNKNOWN_ID) {
if (
props.project.memberList.find((item: ProjectMember) => {
- return item.principal.id == state.principalId;
+ return item.principal.id == state.principalID;
})
) {
return "Already a project member";
@@ -184,15 +184,15 @@ export default {
const addMember = () => {
// If admin feature is NOT enabled, then we set every member to OWNER role.
const projectMember: ProjectMemberCreate = {
- principalId: state.principalId,
+ principalID: state.principalID,
role: hasAdminFeature.value ? state.role : "OWNER",
};
- const member = store.getters["member/memberByPrincipalId"](
- state.principalId
+ const member = store.getters["member/memberByPrincipalID"](
+ state.principalID
);
store
.dispatch("project/createdMember", {
- projectId: props.project.id,
+ projectID: props.project.id,
projectMember,
})
.then(() => {
@@ -203,7 +203,7 @@ export default {
});
});
- state.principalId = UNKNOWN_ID;
+ state.principalID = UNKNOWN_ID;
state.role = "DEVELOPER";
state.error = "";
};
diff --git a/frontend/src/components/ProjectMemberTable.vue b/frontend/src/components/ProjectMemberTable.vue
index edb5005f0b..0651fcd97e 100644
--- a/frontend/src/components/ProjectMemberTable.vue
+++ b/frontend/src/components/ProjectMemberTable.vue
@@ -138,7 +138,7 @@ import {
Project,
ProjectMember,
ProjectRoleType,
- MemberId,
+ MemberID,
ProjectMemberPatch,
} from "../types";
import { BBTableColumn, BBTableSectionDataSource } from "../bbkit/types";
@@ -260,13 +260,13 @@ export default {
return false;
};
- const changeRole = (id: MemberId, role: ProjectRoleType) => {
+ const changeRole = (id: MemberID, role: ProjectRoleType) => {
const projectMemberPatch: ProjectMemberPatch = {
role,
};
store.dispatch("project/patchMember", {
- projectId: props.project.id,
- memberId: id,
+ projectID: props.project.id,
+ memberID: id,
projectMemberPatch,
});
};
diff --git a/frontend/src/components/ProjectMigrationHistoryPanel.vue b/frontend/src/components/ProjectMigrationHistoryPanel.vue
index 44d3a7eda3..668ea82dec 100644
--- a/frontend/src/components/ProjectMigrationHistoryPanel.vue
+++ b/frontend/src/components/ProjectMigrationHistoryPanel.vue
@@ -95,7 +95,7 @@ export default {
if (migration.status == "OK") {
store
.dispatch("instance/fetchMigrationHistory", {
- instanceId: database.instance.id,
+ instanceID: database.instance.id,
databaseName: database.name,
limit: MAX_MIGRAION_HISTORY_COUNT,
})
diff --git a/frontend/src/components/ProjectOverviewPanel.vue b/frontend/src/components/ProjectOverviewPanel.vue
index 136bb6643a..cc3e690069 100644
--- a/frontend/src/components/ProjectOverviewPanel.vue
+++ b/frontend/src/components/ProjectOverviewPanel.vue
@@ -108,7 +108,7 @@ export default {
const prepareActivityList = () => {
store
.dispatch("activity/fetchActivityListForProject", {
- projectId: props.project.id,
+ projectID: props.project.id,
limit: ACTIVITY_LIMIT,
})
.then((list) => {
@@ -121,7 +121,7 @@ export default {
const prepareIssueList = () => {
store
.dispatch("issue/fetchIssueList", {
- projectId: props.project.id,
+ projectID: props.project.id,
})
.then((issueList: Issue[]) => {
state.progressIssueList = [];
diff --git a/frontend/src/components/ProjectSelect.vue b/frontend/src/components/ProjectSelect.vue
index d7568b62a9..09b7edaa4f 100644
--- a/frontend/src/components/ProjectSelect.vue
+++ b/frontend/src/components/ProjectSelect.vue
@@ -8,14 +8,14 @@
}
"
>
- <option disabled :selected="UNKNOWN_ID == state.selectedId">
+ <option disabled :selected="UNKNOWN_ID == state.selectedID">
Select project
</option>
<!-- If includeDefaultProject is false but the selected project is the default
project, we will show it. If includeDefaultProject is true, then it's
already in the list, so no need to show it twice -->
<option
- v-if="!includeDefaultProject && state.selectedId == DEFAULT_PROJECT_ID"
+ v-if="!includeDefaultProject && state.selectedID == DEFAULT_PROJECT_ID"
:selected="true"
>
Default
@@ -25,22 +25,22 @@
are unable to cleanup properly. In such case, the seleted project id
is orphaned and we just display the id. -->
<option
- v-else-if="selectedIdNotInList"
- :value="state.selectedId"
+ v-else-if="selectedIDNotInList"
+ :value="state.selectedID"
:selected="true"
>
- {{ state.selectedId }}
+ {{ state.selectedID }}
</option>
<template v-for="(project, index) in projectList" :key="index">
<option
v-if="project.rowStatus == 'NORMAL'"
:value="project.id"
- :selected="project.id == state.selectedId"
+ :selected="project.id == state.selectedID"
>
{{ projectName(project) }}
</option>
<option
- v-else-if="project.id == state.selectedId"
+ v-else-if="project.id == state.selectedID"
:value="project.id"
:selected="true"
>
@@ -70,7 +70,7 @@ import {
import { isDBAOrOwner } from "../utils";
interface LocalState {
- selectedId: number;
+ selectedID: number;
}
export default {
@@ -78,7 +78,7 @@ export default {
emits: ["select-project-id"],
components: {},
props: {
- selectedId: {
+ selectedID: {
default: UNKNOWN_ID,
type: Number,
},
@@ -98,7 +98,7 @@ export default {
setup(props, { emit }) {
const store = useStore();
const state = reactive<LocalState>({
- selectedId: props.selectedId,
+ selectedID: props.selectedID,
});
const currentUser: ComputedRef<Principal> = computed(() =>
@@ -107,7 +107,7 @@ export default {
const prepareProjectList = () => {
store.dispatch("project/fetchProjectListByUser", {
- userId: currentUser.value.id,
+ userID: currentUser.value.id,
rowStatusList: ["NORMAL", "ARCHIVED"],
});
};
@@ -125,7 +125,7 @@ export default {
);
if (props.includeDefaultProject) {
- list.unshift(store.getters["project/projectById"](DEFAULT_PROJECT_ID));
+ list.unshift(store.getters["project/projectByID"](DEFAULT_PROJECT_ID));
}
if (!hasAdminFeature || isDBAOrOwner(currentUser.value.role)) {
@@ -149,22 +149,22 @@ export default {
});
});
- const selectedIdNotInList = computed((): boolean => {
- if (props.selectedId == UNKNOWN_ID) {
+ const selectedIDNotInList = computed((): boolean => {
+ if (props.selectedID == UNKNOWN_ID) {
return false;
}
return (
projectList.value.find((item) => {
- return item.id == props.selectedId;
+ return item.id == props.selectedID;
}) == null
);
});
watch(
- () => props.selectedId,
+ () => props.selectedID,
(cur, _) => {
- state.selectedId = cur;
+ state.selectedID = cur;
}
);
@@ -173,7 +173,7 @@ export default {
DEFAULT_PROJECT_ID,
state,
projectList,
- selectedIdNotInList,
+ selectedIDNotInList,
};
},
};
diff --git a/frontend/src/components/ProjectSettingPanel.vue b/frontend/src/components/ProjectSettingPanel.vue
index 8ffa8814fe..e65e0c4af7 100644
--- a/frontend/src/components/ProjectSettingPanel.vue
+++ b/frontend/src/components/ProjectSettingPanel.vue
@@ -79,7 +79,7 @@ export default {
rowStatus: archive ? "ARCHIVED" : "NORMAL",
};
store.dispatch("project/patchProject", {
- projectId: props.project.id,
+ projectID: props.project.id,
projectPatch,
});
};
diff --git a/frontend/src/components/ProjectVersionControlPanel.vue b/frontend/src/components/ProjectVersionControlPanel.vue
index c48ae0724f..e3d68c02cb 100644
--- a/frontend/src/components/ProjectVersionControlPanel.vue
+++ b/frontend/src/components/ProjectVersionControlPanel.vue
@@ -148,7 +148,7 @@ export default {
});
const prepareRepository = () => {
- store.dispatch("repository/fetchRepositoryByProjectId", props.project.id);
+ store.dispatch("repository/fetchRepositoryByProjectID", props.project.id);
};
watchEffect(prepareRepository);
@@ -161,7 +161,7 @@ export default {
);
const repository = computed((): Repository => {
- return store.getters["repository/repositoryByProjectId"](
+ return store.getters["repository/repositoryByProjectID"](
props.project.id
);
});
diff --git a/frontend/src/components/ProjectWebhookForm.vue b/frontend/src/components/ProjectWebhookForm.vue
index 10350f5fda..a839261d75 100644
--- a/frontend/src/components/ProjectWebhookForm.vue
+++ b/frontend/src/components/ProjectWebhookForm.vue
@@ -355,7 +355,7 @@ export default {
const createWebhook = () => {
store
.dispatch("projectWebhook/createProjectWebhook", {
- projectId: props.project.id,
+ projectID: props.project.id,
projectWebhookCreate: state.webhook,
})
.then((webhook: ProjectWebhook) => {
@@ -385,9 +385,9 @@ export default {
projectWebhookPatch.activityList = state.webhook.activityList.join(",");
}
store
- .dispatch("projectWebhook/updateProjectWebhookById", {
- projectId: props.project.id,
- projectWebhookId: (state.webhook as ProjectWebhook).id,
+ .dispatch("projectWebhook/updateProjectWebhookByID", {
+ projectID: props.project.id,
+ projectWebhookID: (state.webhook as ProjectWebhook).id,
projectWebhookPatch,
})
.then((webhook: ProjectWebhook) => {
@@ -402,9 +402,9 @@ export default {
const deleteWebhook = () => {
const name = state.webhook.name;
store
- .dispatch("projectWebhook/deleteProjectWebhookById", {
- projectId: props.project.id,
- projectWebhookId: (state.webhook as ProjectWebhook).id,
+ .dispatch("projectWebhook/deleteProjectWebhookByID", {
+ projectID: props.project.id,
+ projectWebhookID: (state.webhook as ProjectWebhook).id,
})
.then(() => {
store.dispatch("notification/pushNotification", {
diff --git a/frontend/src/components/ProjectWebhookPanel.vue b/frontend/src/components/ProjectWebhookPanel.vue
index 14cb8a04b5..2470283ee8 100644
--- a/frontend/src/components/ProjectWebhookPanel.vue
+++ b/frontend/src/components/ProjectWebhookPanel.vue
@@ -75,7 +75,7 @@ export default {
const prepareProjectWebhookList = () => {
store.dispatch(
- "projectWebhook/fetchProjectWebhookListByProjectId",
+ "projectWebhook/fetchProjectWebhookListByProjectID",
props.project.id
);
};
@@ -83,7 +83,7 @@ export default {
watchEffect(prepareProjectWebhookList);
const projectWebhookList = computed(() => {
- return store.getters["projectWebhook/projectWebhookListByProjectId"](
+ return store.getters["projectWebhook/projectWebhookListByProjectID"](
props.project.id
);
});
diff --git a/frontend/src/components/ProvideDashboardContext.vue b/frontend/src/components/ProvideDashboardContext.vue
index 833e2a516c..56a126f692 100644
--- a/frontend/src/components/ProvideDashboardContext.vue
+++ b/frontend/src/components/ProvideDashboardContext.vue
@@ -28,7 +28,7 @@ export default {
store.dispatch("principal/fetchPrincipalList"),
store.dispatch("environment/fetchEnvironmentList"),
// The default project hosts databases not explicitly assigned to other users project.
- store.dispatch("project/fetchProjectById", DEFAULT_PROJECT_ID),
+ store.dispatch("project/fetchProjectByID", DEFAULT_PROJECT_ID),
store.dispatch("uistate/restoreState"),
]);
},
diff --git a/frontend/src/components/ProvideInstanceContext.vue b/frontend/src/components/ProvideInstanceContext.vue
index d7e5813522..07198b1ed2 100644
--- a/frontend/src/components/ProvideInstanceContext.vue
+++ b/frontend/src/components/ProvideInstanceContext.vue
@@ -21,11 +21,11 @@ export default {
const prepareInstanceContext = async function () {
await Promise.all([
store.dispatch(
- "database/fetchDatabaseListByInstanceId",
+ "database/fetchDatabaseListByInstanceID",
idFromSlug(props.instanceSlug)
),
store.dispatch(
- "instance/fetchInstanceUserListById",
+ "instance/fetchInstanceUserListByID",
idFromSlug(props.instanceSlug)
),
]);
diff --git a/frontend/src/components/QuickActionPanel.vue b/frontend/src/components/QuickActionPanel.vue
index 4e7760049b..448084070a 100644
--- a/frontend/src/components/QuickActionPanel.vue
+++ b/frontend/src/components/QuickActionPanel.vue
@@ -398,7 +398,7 @@
"
>
<AlterSchemaPrepForm
- :projectId="projectId"
+ :projectID="projectID"
@dismiss="state.showModal = false"
/>
</template>
@@ -406,7 +406,7 @@
v-else-if="state.quickActionType == 'quickaction.bb.database.create'"
>
<CreateDatabasePrepForm
- :projectId="projectId"
+ :projectID="projectID"
@dismiss="state.showModal = false"
/>
</template>
@@ -421,7 +421,7 @@
"
>
<TransferDatabaseForm
- :projectId="projectId"
+ :projectID="projectID"
@dismiss="state.showModal = false"
/>
</template>
@@ -438,7 +438,7 @@ import AlterSchemaPrepForm from "../components/AlterSchemaPrepForm.vue";
import CreateDatabasePrepForm from "../components/CreateDatabasePrepForm.vue";
import RequestDatabasePrepForm from "../components/RequestDatabasePrepForm.vue";
import TransferDatabaseForm from "../components/TransferDatabaseForm.vue";
-import { DEFAULT_PROJECT_ID, ProjectId, QuickActionType } from "../types";
+import { DEFAULT_PROJECT_ID, ProjectID, QuickActionType } from "../types";
import { idFromSlug } from "../utils";
interface LocalState {
@@ -475,7 +475,7 @@ export default {
quickActionType: "quickaction.bb.instance.create",
});
- const projectId = computed((): ProjectId | undefined => {
+ const projectID = computed((): ProjectID | undefined => {
if (router.currentRoute.value.name == "workspace.project.detail") {
const parts = router.currentRoute.value.path.split("/");
return idFromSlug(parts[parts.length - 1]);
@@ -544,7 +544,7 @@ export default {
return {
state,
- projectId,
+ projectID,
createProject,
goDefaultProject,
transferDatabase,
diff --git a/frontend/src/components/RepositoryPanel.vue b/frontend/src/components/RepositoryPanel.vue
index 33bf5cb970..c5d54e05f8 100644
--- a/frontend/src/components/RepositoryPanel.vue
+++ b/frontend/src/components/RepositoryPanel.vue
@@ -125,7 +125,7 @@ export default {
const repositoryInfo = computed((): ExternalRepositoryInfo => {
return {
- externalId: props.repository.externalId,
+ externalID: props.repository.externalID,
name: props.repository.name,
fullPath: props.repository.fullPath,
webURL: props.repository.webURL,
@@ -148,7 +148,7 @@ export default {
const restoreToUIWorkflowType = () => {
store
- .dispatch("repository/deleteRepositoryByProjectId", props.project.id)
+ .dispatch("repository/deleteRepositoryByProjectID", props.project.id)
.then(() => {
store.dispatch("notification/pushNotification", {
module: "bytebase",
@@ -185,8 +185,8 @@ export default {
state.repositoryConfig.schemaPathTemplate;
}
store
- .dispatch("repository/updateRepositoryByProjectId", {
- projectId: props.project.id,
+ .dispatch("repository/updateRepositoryByProjectID", {
+ projectID: props.project.id,
repositoryPatch,
})
.then(() => {
diff --git a/frontend/src/components/RepositorySetupWizard.vue b/frontend/src/components/RepositorySetupWizard.vue
index 05b4e6f694..7a42730831 100644
--- a/frontend/src/components/RepositorySetupWizard.vue
+++ b/frontend/src/components/RepositorySetupWizard.vue
@@ -102,7 +102,7 @@ export default {
refreshToken: "",
},
repositoryInfo: {
- externalId: "",
+ externalID: "",
name: "",
fullPath: "",
webURL: "",
@@ -139,8 +139,8 @@ export default {
const tryFinishSetup = (allowFinishCallback: () => void) => {
const createFunc = () => {
const repositoryCreate: RepositoryCreate = {
- vcsId: state.config.vcs.id,
- projectId: props.project.id,
+ vcsID: state.config.vcs.id,
+ projectID: props.project.id,
name: state.config.repositoryInfo.name,
fullPath: state.config.repositoryInfo.fullPath,
webURL: state.config.repositoryInfo.webURL,
@@ -148,7 +148,7 @@ export default {
baseDirectory: state.config.repositoryConfig.baseDirectory,
filePathTemplate: state.config.repositoryConfig.filePathTemplate,
schemaPathTemplate: state.config.repositoryConfig.schemaPathTemplate,
- externalId: state.config.repositoryInfo.externalId,
+ externalID: state.config.repositoryInfo.externalID,
accessToken: state.config.token.accessToken,
expiresTs: state.config.token.expiresTs,
refreshToken: state.config.token.refreshToken,
@@ -167,7 +167,7 @@ export default {
// Though the delete can succeed while the create fails, this is rare, and
// even it happens, user can still configure it again.
store
- .dispatch("repository/deleteRepositoryByProjectId", props.project.id)
+ .dispatch("repository/deleteRepositoryByProjectID", props.project.id)
.then(() => {
createFunc();
});
diff --git a/frontend/src/components/RepositoryVCSProviderPanel.vue b/frontend/src/components/RepositoryVCSProviderPanel.vue
index a178660b95..5bdaf9b138 100644
--- a/frontend/src/components/RepositoryVCSProviderPanel.vue
+++ b/frontend/src/components/RepositoryVCSProviderPanel.vue
@@ -92,7 +92,7 @@ export default {
props.config.code = payload.code;
const oAuthConfig: OAuthConfig = {
endpoint: `${state.selectedVCS!.instanceURL}/oauth/token`,
- applicationId: state.selectedVCS!.applicationId,
+ applicationID: state.selectedVCS!.applicationID,
secret: state.selectedVCS!.secret,
redirectURL: redirectURL(),
};
@@ -127,7 +127,7 @@ export default {
state.selectedVCS = vcs;
const newWindow = openWindowForOAuth(
`${vcs.instanceURL}/oauth/authorize`,
- vcs.applicationId
+ vcs.applicationID
);
if (newWindow) {
window.addEventListener(OAuthWindowEvent, eventListener, false);
diff --git a/frontend/src/components/RequestDatabasePrepForm.vue b/frontend/src/components/RequestDatabasePrepForm.vue
index c61245757c..0e00ed7bb1 100644
--- a/frontend/src/components/RequestDatabasePrepForm.vue
+++ b/frontend/src/components/RequestDatabasePrepForm.vue
@@ -9,10 +9,10 @@
class="mt-1"
id="project"
name="project"
- :selectedId="state.projectId"
+ :selectedID="state.projectID"
@select-project-id="
- (projectId) => {
- state.projectId = projectId;
+ (projectID) => {
+ state.projectID = projectID;
}
"
/>
@@ -26,16 +26,16 @@
class="mt-1 w-full"
id="environment"
name="environment"
- :selectedId="state.environmentId"
+ :selectedID="state.environmentID"
@select-environment-id="
- (environmentId) => {
- state.environmentId = environmentId;
+ (environmentID) => {
+ state.environmentID = environmentID;
}
"
/>
</div>
- <template v-if="state.environmentId">
+ <template v-if="state.environmentID">
<div class="col-span-2 col-start-1 w-64 space-y-2">
<div class="hidden radio-set-row justify-between">
<div class="radio">
@@ -81,12 +81,12 @@
/>
<div v-else class="flex flex-row space-x-4">
<DatabaseSelect
- :selectedId="state.databaseId"
+ :selectedID="state.databaseID"
:mode="'ENVIRONMENT'"
- :environmentId="state.environmentId"
+ :environmentID="state.environmentID"
@select-database-id="
- (databaseId) => {
- state.databaseId = databaseId;
+ (databaseID) => {
+ state.databaseID = databaseID;
}
"
/>
@@ -132,16 +132,16 @@ import isEmpty from "lodash-es/isEmpty";
import ProjectSelect from "../components/ProjectSelect.vue";
import DatabaseSelect from "../components/DatabaseSelect.vue";
import EnvironmentSelect from "../components/EnvironmentSelect.vue";
-import { DatabaseId, EnvironmentId, ProjectId, UNKNOWN_ID } from "../types";
+import { DatabaseID, EnvironmentID, ProjectID, UNKNOWN_ID } from "../types";
import { allowDatabaseAccess } from "../utils";
interface LocalState {
- environmentId: EnvironmentId;
- projectId: ProjectId;
+ environmentID: EnvironmentID;
+ projectID: ProjectID;
// Radio button only accept string value
create: "ON" | "OFF";
databaseName: string;
- databaseId: DatabaseId;
+ databaseID: DatabaseID;
readonly: boolean;
}
@@ -171,11 +171,11 @@ export default {
});
const state = reactive<LocalState>({
- environmentId: UNKNOWN_ID,
- projectId: UNKNOWN_ID,
+ environmentID: UNKNOWN_ID,
+ projectID: UNKNOWN_ID,
create: "ON",
databaseName: "",
- databaseId: UNKNOWN_ID,
+ databaseID: UNKNOWN_ID,
readonly: true,
});
@@ -184,12 +184,12 @@ export default {
return false;
}
- if (!state.databaseId) {
+ if (!state.databaseID) {
return false;
}
return allowDatabaseAccess(
- store.getters["database/databaseById"](state.databaseId),
+ store.getters["database/databaseByID"](state.databaseID),
currentUser.value,
state.readonly ? "RO" : "RW"
);
@@ -197,10 +197,10 @@ export default {
const allowRequest = computed(() => {
return (
- state.environmentId != UNKNOWN_ID &&
- state.projectId != UNKNOWN_ID &&
+ state.environmentID != UNKNOWN_ID &&
+ state.projectID != UNKNOWN_ID &&
((state.create == "ON" && !isEmpty(state.databaseName)) ||
- (state.create == "OFF" && state.databaseId != UNKNOWN_ID)) &&
+ (state.create == "OFF" && state.databaseID != UNKNOWN_ID)) &&
!alreadyGranted.value
);
});
@@ -212,8 +212,8 @@ export default {
const request = () => {
emit("dismiss");
- const environment = store.getters["environment/environmentById"](
- state.environmentId
+ const environment = store.getters["environment/environmentByID"](
+ state.environmentID
);
if (state.create == "ON") {
router.push({
@@ -224,14 +224,14 @@ export default {
query: {
template: "bb.issue.database.create",
name: `[${environment.name}] Request new database '${state.databaseName}'`,
- environment: state.environmentId,
- project: state.projectId,
+ environment: state.environmentID,
+ project: state.projectID,
databaseName: state.databaseName,
},
});
} else {
- const database = store.getters["database/databaseById"](
- state.databaseId
+ const database = store.getters["database/databaseByID"](
+ state.databaseID
);
router.push({
name: "workspace.issue.detail",
@@ -243,9 +243,9 @@ export default {
name: `[${environment.name}] Request database '${database.name}' ${
state.readonly ? "Readonly access" : "Read & Write access"
}`,
- environment: state.environmentId,
- project: state.projectId,
- databaseList: state.databaseId,
+ environment: state.environmentID,
+ project: state.projectID,
+ databaseList: state.databaseID,
readonly: state.readonly ? "true" : "false",
},
});
diff --git a/frontend/src/components/StageSelect.vue b/frontend/src/components/StageSelect.vue
index 2505ead91c..9577277c78 100644
--- a/frontend/src/components/StageSelect.vue
+++ b/frontend/src/components/StageSelect.vue
@@ -8,7 +8,7 @@
"
>
<template v-for="(stage, index) in pipeline.stageList" :key="index">
- <option :value="stage.id" :selected="stage.id == state.selectedId">
+ <option :value="stage.id" :selected="stage.id == state.selectedID">
{{ isActiveStage(stage.id) ? stage.name + " (active)" : stage.name }}
</option>
</template>
@@ -17,11 +17,11 @@
<script lang="ts">
import { PropType, reactive, watch } from "vue";
-import { UNKNOWN_ID, Pipeline, StageId } from "../types";
+import { UNKNOWN_ID, Pipeline, StageID } from "../types";
import { activeStage } from "../utils";
interface LocalState {
- selectedId: number;
+ selectedID: number;
}
export default {
@@ -33,26 +33,26 @@ export default {
required: true,
type: Object as PropType<Pipeline>,
},
- selectedId: {
+ selectedID: {
default: UNKNOWN_ID,
type: Number,
},
},
setup(props, { emit }) {
const state = reactive<LocalState>({
- selectedId: props.selectedId,
+ selectedID: props.selectedID,
});
watch(
- () => props.selectedId,
+ () => props.selectedID,
(cur, _) => {
- state.selectedId = cur;
+ state.selectedID = cur;
}
);
- const isActiveStage = (stageId: StageId): boolean => {
+ const isActiveStage = (stageID: StageID): boolean => {
const stage = activeStage(props.pipeline);
- return stage.id == stageId;
+ return stage.id == stageID;
};
return {
diff --git a/frontend/src/components/StatusTransitionForm.vue b/frontend/src/components/StatusTransitionForm.vue
index 624d8dbfd1..b8d50b8459 100644
--- a/frontend/src/components/StatusTransitionForm.vue
+++ b/frontend/src/components/StatusTransitionForm.vue
@@ -30,11 +30,11 @@
class="mt-1 w-64"
:disabled="true"
:mode="'ENVIRONMENT'"
- :environmentId="environmentId"
- :selectedId="state.outputValueList[index]"
+ :environmentID="environmentID"
+ :selectedID="state.outputValueList[index]"
@select-database-id="
- (databaseId) => {
- state.outputValueList[index] = databaseId;
+ (databaseID) => {
+ state.outputValueList[index] = databaseID;
}
"
/>
@@ -137,7 +137,7 @@ import cloneDeep from "lodash-es/cloneDeep";
import DatabaseSelect from "./DatabaseSelect.vue";
import TaskCheckBadgeBar from "./TaskCheckBadgeBar.vue";
import { Issue, IssueStatusTransition, Task, TaskCheckRun } from "../types";
-import { OutputField, IssueBuiltinFieldId } from "../plugins";
+import { OutputField, IssueBuiltinFieldID } from "../plugins";
import { activeEnvironment, TaskStatusTransition } from "../utils";
type CheckSummary = {
@@ -191,7 +191,7 @@ export default {
),
});
- const environmentId = computed(() => {
+ const environmentID = computed(() => {
return activeEnvironment(props.issue.pipeline).id;
});
@@ -292,7 +292,7 @@ export default {
return {
state,
- environmentId,
+ environmentID,
commentTextArea,
submitButtonStyle,
allowSubmit,
diff --git a/frontend/src/components/TaskRunTable.vue b/frontend/src/components/TaskRunTable.vue
index f0629892cd..23227ddfbb 100644
--- a/frontend/src/components/TaskRunTable.vue
+++ b/frontend/src/components/TaskRunTable.vue
@@ -175,7 +175,7 @@ export default {
link: `/db/${databaseSlug(
props.task.database!
)}/history/${migrationHistorySlug(
- taskRun.result.migrationId!,
+ taskRun.result.migrationID!,
taskRun.result.version!
)}`,
};
diff --git a/frontend/src/components/TransferDatabaseForm.vue b/frontend/src/components/TransferDatabaseForm.vue
index b32847a95e..0c4551aac5 100644
--- a/frontend/src/components/TransferDatabaseForm.vue
+++ b/frontend/src/components/TransferDatabaseForm.vue
@@ -1,6 +1,6 @@
<template>
<div class="px-4 space-y-6 w-208">
- <div v-if="projectId != DEFAULT_PROJECT_ID" class="textlabel">
+ <div v-if="projectID != DEFAULT_PROJECT_ID" class="textlabel">
<div v-if="state.transferSource == 'DEFAULT'" class="textinfolabel mb-2">
Bytebase periodically syncs the instance schema. Newly synced databases
are first placed in this default project.
@@ -72,7 +72,7 @@ import { computed, PropType, reactive, watchEffect } from "vue";
import { useStore } from "vuex";
import { cloneDeep } from "lodash";
import DatabaseTable from "../components/DatabaseTable.vue";
-import { Database, ProjectId, DEFAULT_PROJECT_ID } from "../types";
+import { Database, ProjectID, DEFAULT_PROJECT_ID } from "../types";
import { sortDatabaseList } from "../utils";
type TransferSource = "DEFAULT" | "OTHER";
@@ -87,9 +87,9 @@ export default {
name: "TransferDatabaseForm",
emits: ["submit", "dismiss"],
props: {
- projectId: {
+ projectID: {
required: true,
- type: Number as PropType<ProjectId>,
+ type: Number as PropType<ProjectID>,
},
},
components: {
@@ -100,7 +100,7 @@ export default {
const state = reactive<LocalState>({
transferSource:
- props.projectId == DEFAULT_PROJECT_ID ? "OTHER" : "DEFAULT",
+ props.projectID == DEFAULT_PROJECT_ID ? "OTHER" : "DEFAULT",
showModal: false,
});
@@ -108,7 +108,7 @@ export default {
const prepareDatabaseListForDefaultProject = () => {
store.dispatch(
- "database/fetchDatabaseListByProjectId",
+ "database/fetchDatabaseListByProjectID",
DEFAULT_PROJECT_ID
);
};
@@ -123,14 +123,14 @@ export default {
var list;
if (state.transferSource == "DEFAULT") {
list = cloneDeep(
- store.getters["database/databaseListByProjectId"](DEFAULT_PROJECT_ID)
+ store.getters["database/databaseListByProjectID"](DEFAULT_PROJECT_ID)
);
} else {
list = cloneDeep(
- store.getters["database/databaseListByPrincipalId"](
+ store.getters["database/databaseListByPrincipalID"](
currentUser.value.id
)
- ).filter((item: Database) => item.project.id != props.projectId);
+ ).filter((item: Database) => item.project.id != props.projectID);
}
return sortDatabaseList(list, environmentList.value);
@@ -148,8 +148,8 @@ export default {
const transferDatabase = () => {
store
.dispatch("database/transferProject", {
- databaseId: state.selectedDatabase!.id,
- projectId: props.projectId,
+ databaseID: state.selectedDatabase!.id,
+ projectID: props.projectID,
})
.then((updatedDatabase) => {
store.dispatch("notification/pushNotification", {
diff --git a/frontend/src/components/VCSCard.vue b/frontend/src/components/VCSCard.vue
index 897ea84680..9d218252eb 100644
--- a/frontend/src/components/VCSCard.vue
+++ b/frontend/src/components/VCSCard.vue
@@ -30,7 +30,7 @@
<div class="grid grid-cols-4 gap-4 px-4 py-2 items-center">
<dt class="text-sm font-medium text-control-light">Application ID</dt>
<dd class="mt-1 flex text-sm text-main col-span-2">
- {{ vcs.applicationId }}
+ {{ vcs.applicationID }}
</dd>
</div>
<div class="grid grid-cols-4 gap-4 px-4 py-2 items-center">
diff --git a/frontend/src/components/VCSProviderConfirmPanel.vue b/frontend/src/components/VCSProviderConfirmPanel.vue
index 095fb1ea5f..407b87d2f5 100644
--- a/frontend/src/components/VCSProviderConfirmPanel.vue
+++ b/frontend/src/components/VCSProviderConfirmPanel.vue
@@ -50,7 +50,7 @@
Application ID
</dt>
<dd class="col-start-2 col-span-3 text-sm text-main">
- {{ config.applicationId }}
+ {{ config.applicationID }}
</dd>
</div>
<div class="grid grid-cols-4 gap-4 px-4 py-2">
diff --git a/frontend/src/components/VCSProviderOAuthPanel.vue b/frontend/src/components/VCSProviderOAuthPanel.vue
index 58c0df7dec..e3b17ac460 100644
--- a/frontend/src/components/VCSProviderOAuthPanel.vue
+++ b/frontend/src/components/VCSProviderOAuthPanel.vue
@@ -108,10 +108,10 @@
<BBTextField
class="mt-2 w-full"
:placeholder="'ex. 5333b60a6c9f234272dac2ee6b3422aaf224e0a66def54e0d243b77bexa8edda'"
- :value="config.applicationId"
- @input="changeApplicatonId($event.target.value)"
+ :value="config.applicationID"
+ @input="changeApplicatonID($event.target.value)"
/>
- <p v-if="state.showApplicationIdError" class="mt-2 text-sm text-error">
+ <p v-if="state.showApplicationIDError" class="mt-2 text-sm text-error">
Application ID must be a 64-character alphanumeric string
</p>
<div class="mt-4 textlabel">
@@ -135,7 +135,7 @@ import { computed, onUnmounted, PropType, reactive } from "@vue/runtime-core";
import isEmpty from "lodash-es/isEmpty";
import { toClipboard } from "@soerenmartius/vue3-clipboard";
import {
- isValidVCSApplicationIdOrSecret,
+ isValidVCSApplicationIDOrSecret,
TEXT_VALIDATION_DELAY,
VCSConfig,
redirectURL,
@@ -143,8 +143,8 @@ import {
import { useStore } from "vuex";
interface LocalState {
- applicationIdValidationTimer?: ReturnType<typeof setTimeout>;
- showApplicationIdError: boolean;
+ applicationIDValidationTimer?: ReturnType<typeof setTimeout>;
+ showApplicationIDError: boolean;
secretValidationTimer?: ReturnType<typeof setTimeout>;
showSecretError: boolean;
}
@@ -160,17 +160,17 @@ export default {
setup(props, ctx) {
const store = useStore();
const state = reactive<LocalState>({
- showApplicationIdError:
- !isEmpty(props.config.applicationId) &&
- !isValidVCSApplicationIdOrSecret(props.config.applicationId),
+ showApplicationIDError:
+ !isEmpty(props.config.applicationID) &&
+ !isValidVCSApplicationIDOrSecret(props.config.applicationID),
showSecretError:
!isEmpty(props.config.secret) &&
- !isValidVCSApplicationIdOrSecret(props.config.secret),
+ !isValidVCSApplicationIDOrSecret(props.config.secret),
});
onUnmounted(() => {
- if (state.applicationIdValidationTimer) {
- clearInterval(state.applicationIdValidationTimer);
+ if (state.applicationIDValidationTimer) {
+ clearInterval(state.applicationIDValidationTimer);
}
if (state.secretValidationTimer) {
clearInterval(state.secretValidationTimer);
@@ -194,28 +194,28 @@ export default {
});
};
- const changeApplicatonId = (value: string) => {
- props.config.applicationId = value;
+ const changeApplicatonID = (value: string) => {
+ props.config.applicationID = value;
- if (state.applicationIdValidationTimer) {
- clearInterval(state.applicationIdValidationTimer);
+ if (state.applicationIDValidationTimer) {
+ clearInterval(state.applicationIDValidationTimer);
}
// If text becomes valid, we immediately clear the error.
// otherwise, we delay TEXT_VALIDATION_DELAY to do the validation in case there is continous keystroke.
- if (isValidVCSApplicationIdOrSecret(props.config.applicationId)) {
- state.showApplicationIdError = false;
+ if (isValidVCSApplicationIDOrSecret(props.config.applicationID)) {
+ state.showApplicationIDError = false;
} else {
- state.applicationIdValidationTimer = setTimeout(() => {
+ state.applicationIDValidationTimer = setTimeout(() => {
// If error is already displayed, we hide the error only if there is valid input.
// Otherwise, we hide the error if input is either empty or valid.
- if (state.showApplicationIdError) {
- state.showApplicationIdError = !isValidVCSApplicationIdOrSecret(
- props.config.applicationId
+ if (state.showApplicationIDError) {
+ state.showApplicationIDError = !isValidVCSApplicationIDOrSecret(
+ props.config.applicationID
);
} else {
- state.showApplicationIdError =
- !isValidVCSApplicationIdOrSecret(props.config.applicationId) &&
- !isValidVCSApplicationIdOrSecret(props.config.applicationId);
+ state.showApplicationIDError =
+ !isValidVCSApplicationIDOrSecret(props.config.applicationID) &&
+ !isValidVCSApplicationIDOrSecret(props.config.applicationID);
}
}, TEXT_VALIDATION_DELAY);
}
@@ -229,20 +229,20 @@ export default {
}
// If text becomes valid, we immediately clear the error.
// otherwise, we delay TEXT_VALIDATION_DELAY to do the validation in case there is continous keystroke.
- if (isValidVCSApplicationIdOrSecret(props.config.secret)) {
+ if (isValidVCSApplicationIDOrSecret(props.config.secret)) {
state.showSecretError = false;
} else {
state.secretValidationTimer = setTimeout(() => {
// If error is already displayed, we hide the error only if there is valid input.
// Otherwise, we hide the error if input is either empty or valid.
if (state.showSecretError) {
- state.showSecretError = !isValidVCSApplicationIdOrSecret(
+ state.showSecretError = !isValidVCSApplicationIDOrSecret(
props.config.secret
);
} else {
state.showSecretError =
!isEmpty(props.config.secret) &&
- !isValidVCSApplicationIdOrSecret(props.config.secret);
+ !isValidVCSApplicationIDOrSecret(props.config.secret);
}
}, TEXT_VALIDATION_DELAY);
}
@@ -253,7 +253,7 @@ export default {
state,
createAdminApplicationURL,
copyRedirecURI,
- changeApplicatonId,
+ changeApplicatonID,
changeSecret,
};
},
diff --git a/frontend/src/components/VCSSetupWizard.vue b/frontend/src/components/VCSSetupWizard.vue
index ae4d9e7156..f5ed62ebe8 100644
--- a/frontend/src/components/VCSSetupWizard.vue
+++ b/frontend/src/components/VCSSetupWizard.vue
@@ -36,7 +36,7 @@ import VCSProviderBasicInfoPanel from "./VCSProviderBasicInfoPanel.vue";
import VCSProviderOAuthPanel from "./VCSProviderOAuthPanel.vue";
import VCSProviderConfirmPanel from "./VCSProviderConfirmPanel.vue";
import {
- isValidVCSApplicationIdOrSecret,
+ isValidVCSApplicationIDOrSecret,
VCSConfig,
VCSCreate,
VCS,
@@ -82,7 +82,7 @@ export default {
type: "GITLAB_SELF_HOST",
name: "GitLab self-host",
instanceURL: "",
- applicationId: "",
+ applicationID: "",
secret: "",
},
currentStep: 0,
@@ -94,7 +94,7 @@ export default {
if (state.config.type == "GITLAB_SELF_HOST") {
const oAuthConfig: OAuthConfig = {
endpoint: `${state.config.instanceURL}/oauth/token`,
- applicationId: state.config.applicationId,
+ applicationID: state.config.applicationID,
secret: state.config.secret,
redirectURL: redirectURL(),
};
@@ -122,8 +122,8 @@ export default {
return isURL(state.config.instanceURL);
} else if (state.currentStep == OAUTH_INFO_STEP) {
return (
- isValidVCSApplicationIdOrSecret(state.config.applicationId) &&
- isValidVCSApplicationIdOrSecret(state.config.secret)
+ isValidVCSApplicationIDOrSecret(state.config.applicationID) &&
+ isValidVCSApplicationIDOrSecret(state.config.secret)
);
}
return true;
@@ -152,7 +152,7 @@ export default {
if (state.currentStep == OAUTH_INFO_STEP && newStep > oldStep) {
const newWindow = openWindowForOAuth(
`${state.config.instanceURL}/oauth/authorize`,
- state.config.applicationId
+ state.config.applicationID
);
if (newWindow) {
state.oAuthResultCallback = (token: OAuthToken | undefined) => {
diff --git a/frontend/src/layouts/ProjectLayout.vue b/frontend/src/layouts/ProjectLayout.vue
index 564c06901b..7ca2c119d0 100644
--- a/frontend/src/layouts/ProjectLayout.vue
+++ b/frontend/src/layouts/ProjectLayout.vue
@@ -81,7 +81,7 @@ export default {
});
const project = computed(() => {
- return store.getters["project/projectById"](
+ return store.getters["project/projectByID"](
idFromSlug(props.projectSlug)
);
});
diff --git a/frontend/src/plugins/issue/DatabaseCreateTemplate.ts b/frontend/src/plugins/issue/DatabaseCreateTemplate.ts
index 9a92b23237..b53b94e0e8 100644
--- a/frontend/src/plugins/issue/DatabaseCreateTemplate.ts
+++ b/frontend/src/plugins/issue/DatabaseCreateTemplate.ts
@@ -5,25 +5,25 @@ const template: IssueTemplate = {
type: "bb.issue.database.create",
buildIssue: (
ctx: TemplateContext
- ): Omit<IssueCreate, "projectId" | "creatorId"> => {
+ ): Omit<IssueCreate, "projectID" | "creatorID"> => {
const payload: any = {};
return {
name: "Create database",
type: "bb.issue.database.create",
description: "",
- assigneeId: UNKNOWN_ID,
+ assigneeID: UNKNOWN_ID,
pipeline: {
stageList: [
{
name: "Create database",
- environmentId: ctx.environmentList[0].id,
+ environmentID: ctx.environmentList[0].id,
taskList: [
{
name: "Create database",
status: "PENDING_APPROVAL",
type: "bb.task.database.create",
- instanceId: ctx.databaseList[0].instance.id,
+ instanceID: ctx.databaseList[0].instance.id,
statement: "",
rollbackStatement: "",
},
diff --git a/frontend/src/plugins/issue/DatabaseGrantTemplate.ts b/frontend/src/plugins/issue/DatabaseGrantTemplate.ts
index e6100b88c4..872a2a095c 100644
--- a/frontend/src/plugins/issue/DatabaseGrantTemplate.ts
+++ b/frontend/src/plugins/issue/DatabaseGrantTemplate.ts
@@ -15,26 +15,26 @@ const template: IssueTemplate = {
type: "bb.issue.database.grant",
buildIssue: (
ctx: TemplateContext
- ): Omit<IssueCreate, "projectId" | "creatorId"> => {
+ ): Omit<IssueCreate, "projectID" | "creatorID"> => {
const payload: any = {};
return {
name: "Request database access",
type: "bb.issue.database.grant",
description: "",
- assigneeId: UNKNOWN_ID,
+ assigneeID: UNKNOWN_ID,
pipeline: {
stageList: [
{
name: "Request database access",
- environmentId: ctx.environmentList[0].id,
+ environmentID: ctx.environmentList[0].id,
taskList: [
{
name: "Request database access",
status: "PENDING_APPROVAL",
type: "bb.task.general",
- instanceId: ctx.databaseList[0].instance.id,
- databaseId: ctx.databaseList[0].id,
+ instanceID: ctx.databaseList[0].instance.id,
+ databaseID: ctx.databaseList[0].id,
statement: "",
rollbackStatement: "",
},
@@ -77,21 +77,21 @@ const template: IssueTemplate = {
const issue = ctx.issue as Issue;
const database = issue.pipeline.stageList[0].taskList[0].database!;
const readonly = issue.payload[INPUT_READ_ONLY_FIELD_ID];
- let dataSourceId;
+ let dataSourceID;
for (const dataSource of database.dataSourceList) {
if (readonly && dataSource.type == "RO") {
- dataSourceId = dataSource.id;
+ dataSourceID = dataSource.id;
break;
} else if (!readonly && dataSource.type == "RW") {
- dataSourceId = dataSource.id;
+ dataSourceID = dataSource.id;
break;
}
}
- if (dataSourceId) {
+ if (dataSourceID) {
queryParamList.push(`database=${database.id}`);
- queryParamList.push(`datasource=${dataSourceId}`);
+ queryParamList.push(`datasource=${dataSourceID}`);
queryParamList.push(`grantee=${issue.creator.id}`);
diff --git a/frontend/src/plugins/issue/DatabaseSchemaBaselineTemplate.ts b/frontend/src/plugins/issue/DatabaseSchemaBaselineTemplate.ts
index b39202fab7..ea71075798 100644
--- a/frontend/src/plugins/issue/DatabaseSchemaBaselineTemplate.ts
+++ b/frontend/src/plugins/issue/DatabaseSchemaBaselineTemplate.ts
@@ -10,13 +10,13 @@ const template: IssueTemplate = {
type: "bb.issue.database.schema.baseline",
buildIssue: (
ctx: TemplateContext
- ): Omit<IssueCreate, "projectId" | "creatorId"> => {
+ ): Omit<IssueCreate, "projectID" | "creatorID"> => {
const payload: any = {};
const stageList: StageCreate[] = [];
for (let i = 0; i < ctx.databaseList.length; i++) {
stageList.push({
name: `[${ctx.environmentList[i].name}] ${ctx.databaseList[i].name}`,
- environmentId: ctx.environmentList[i].id,
+ environmentID: ctx.environmentList[i].id,
taskList: [
{
name: `Establish ${ctx.databaseList[i].name} baseline`,
@@ -28,8 +28,8 @@ const template: IssueTemplate = {
? "PENDING_APPROVAL"
: "PENDING",
type: "bb.task.database.schema.update",
- instanceId: ctx.databaseList[i].instance.id,
- databaseId: ctx.databaseList[i].id,
+ instanceID: ctx.databaseList[i].instance.id,
+ databaseID: ctx.databaseList[i].id,
statement: "/* Establish baseline using current schema */",
rollbackStatement: "",
migrationType: "BASELINE",
@@ -44,7 +44,7 @@ const template: IssueTemplate = {
: "Establish database baseline",
type: "bb.issue.database.schema.update",
description: "",
- assigneeId: UNKNOWN_ID,
+ assigneeID: UNKNOWN_ID,
pipeline: {
stageList,
name:
diff --git a/frontend/src/plugins/issue/DatabaseSchemaUpdateTemplate.ts b/frontend/src/plugins/issue/DatabaseSchemaUpdateTemplate.ts
index 9f9e6dd063..e2f3abde86 100644
--- a/frontend/src/plugins/issue/DatabaseSchemaUpdateTemplate.ts
+++ b/frontend/src/plugins/issue/DatabaseSchemaUpdateTemplate.ts
@@ -10,13 +10,13 @@ const template: IssueTemplate = {
type: "bb.issue.database.schema.update",
buildIssue: (
ctx: TemplateContext
- ): Omit<IssueCreate, "projectId" | "creatorId"> => {
+ ): Omit<IssueCreate, "projectID" | "creatorID"> => {
const payload: any = {};
const stageList: StageCreate[] = [];
for (let i = 0; i < ctx.databaseList.length; i++) {
stageList.push({
name: `[${ctx.environmentList[i].name}] ${ctx.databaseList[i].name}`,
- environmentId: ctx.environmentList[i].id,
+ environmentID: ctx.environmentList[i].id,
taskList: [
{
name: `Update ${ctx.databaseList[i].name} schema`,
@@ -28,8 +28,8 @@ const template: IssueTemplate = {
? "PENDING_APPROVAL"
: "PENDING",
type: "bb.task.database.schema.update",
- instanceId: ctx.databaseList[i].instance.id,
- databaseId: ctx.databaseList[i].id,
+ instanceID: ctx.databaseList[i].instance.id,
+ databaseID: ctx.databaseList[i].id,
statement: ctx.statementList ? ctx.statementList[i] : "",
rollbackStatement: ctx.rollbackStatementList
? ctx.rollbackStatementList[i]
@@ -46,7 +46,7 @@ const template: IssueTemplate = {
: "Update database schema",
type: "bb.issue.database.schema.update",
description: "",
- assigneeId: UNKNOWN_ID,
+ assigneeID: UNKNOWN_ID,
pipeline: {
stageList,
name:
diff --git a/frontend/src/plugins/issue/DefaultTemplate.ts b/frontend/src/plugins/issue/DefaultTemplate.ts
index 5e5b4858d5..a5797bbf48 100644
--- a/frontend/src/plugins/issue/DefaultTemplate.ts
+++ b/frontend/src/plugins/issue/DefaultTemplate.ts
@@ -5,24 +5,24 @@ const template: IssueTemplate = {
type: "bb.issue.general",
buildIssue: (
ctx: TemplateContext
- ): Omit<IssueCreate, "projectId" | "creatorId"> => {
+ ): Omit<IssueCreate, "projectID" | "creatorID"> => {
return {
name: "",
type: "bb.issue.general",
description: "",
- assigneeId: UNKNOWN_ID,
+ assigneeID: UNKNOWN_ID,
pipeline: {
stageList: [
{
name: "Troubleshoot database",
- environmentId: UNKNOWN_ID,
+ environmentID: UNKNOWN_ID,
taskList: [
{
name: "Troubleshoot database",
status: "PENDING_APPROVAL",
type: "bb.task.general",
- instanceId: UNKNOWN_ID,
- databaseId: UNKNOWN_ID,
+ instanceID: UNKNOWN_ID,
+ databaseID: UNKNOWN_ID,
statement: "",
rollbackStatement: "",
},
diff --git a/frontend/src/plugins/issue/template.ts b/frontend/src/plugins/issue/template.ts
index f47cf179e1..6b08d43f85 100644
--- a/frontend/src/plugins/issue/template.ts
+++ b/frontend/src/plugins/issue/template.ts
@@ -1,5 +1,5 @@
import { IssueType } from "../../types";
-import { FieldId, FieldInfo, IssueTemplate } from "../types";
+import { FieldID, FieldInfo, IssueTemplate } from "../types";
import DatabaseCreateTemplate from "./DatabaseCreateTemplate";
import DatabaseGrantTemplate from "./DatabaseGrantTemplate";
import DatabaseSchemaBaselineTemplate from "./DatabaseSchemaBaselineTemplate";
@@ -24,12 +24,12 @@ export function templateForType(type: TemplateType): IssueTemplate | undefined {
return allIssueTemplateList.find((template) => template.type === type);
}
-export function fieldInfoFromId(
+export function fieldInfoFromID(
template: IssueTemplate,
- fieldId: FieldId
+ fieldID: FieldID
): FieldInfo {
if (template.inputFieldList) {
- const field = template.inputFieldList.find((field) => field.id == fieldId);
+ const field = template.inputFieldList.find((field) => field.id == fieldID);
if (field) {
return {
name: field.name,
@@ -39,7 +39,7 @@ export function fieldInfoFromId(
}
if (template.outputFieldList) {
- const field = template.outputFieldList.find((field) => field.id == fieldId);
+ const field = template.outputFieldList.find((field) => field.id == fieldID);
if (field) {
return {
name: field.name,
diff --git a/frontend/src/plugins/types.ts b/frontend/src/plugins/types.ts
index 88572c12a2..b75e24fcaf 100644
--- a/frontend/src/plugins/types.ts
+++ b/frontend/src/plugins/types.ts
@@ -10,9 +10,9 @@ import {
// Issue
// It has to be string type because the id for stage field contain multiple parts.
-export type FieldId = string;
+export type FieldID = string;
-export enum IssueBuiltinFieldId {
+export enum IssueBuiltinFieldID {
NAME = "1",
STATUS = "2",
ASSIGNEE = "3",
@@ -46,7 +46,7 @@ export type InputField = {
// Used as the key to store the data. This must NOT be changed after
// in use, otherwise, it will cause data loss/corruption. Its design
// is very similar to the message field id in Protocol Buffers.
- id: FieldId;
+ id: FieldID;
// Used as the key to generate UI artifacts (e.g. query parameter).
// Though changing it won't have catastrophic consequence like changing
// id, we strongly recommend NOT to change it as well, otherwise, previous
@@ -68,7 +68,7 @@ export type InputField = {
export type OutputField = {
// Same as InputField.id
- id: FieldId;
+ id: FieldID;
// Same as InputField.name
name: string;
// Same as InputField.type
@@ -102,7 +102,7 @@ export type IssueTemplate = {
type: string;
buildIssue: (
ctx: TemplateContext
- ) => Omit<IssueCreate, "projectId" | "creatorId">;
+ ) => Omit<IssueCreate, "projectID" | "creatorID">;
inputFieldList: InputField[];
outputFieldList: OutputField[];
};
diff --git a/frontend/src/router/index.ts b/frontend/src/router/index.ts
index b93c724c8d..f4a644d64a 100644
--- a/frontend/src/router/index.ts
+++ b/frontend/src/router/index.ts
@@ -224,12 +224,12 @@ const routes: Array<RouteRecordRaw> = [
// We make an exception to use a shorthand here because it's a commonly
// accessed endpint, and maybe in the future, we will further provide a
// shortlink like u/<<uid>>
- path: "u/:principalId",
+ path: "u/:principalID",
name: "workspace.profile",
meta: {
title: (route: RouteLocationNormalized) => {
- const principalId = route.params.principalId as string;
- return store.getters["principal/principalById"](principalId)
+ const principalID = route.params.principalID as string;
+ return store.getters["principal/principalByID"](principalID)
.name;
},
},
@@ -302,7 +302,7 @@ const routes: Array<RouteRecordRaw> = [
meta: {
title: (route: RouteLocationNormalized) => {
const slug = route.params.vcsSlug as string;
- return store.getters["vcs/vcsById"](idFromSlug(slug)).name;
+ return store.getters["vcs/vcsByID"](idFromSlug(slug)).name;
},
},
component: () =>
@@ -381,7 +381,7 @@ const routes: Array<RouteRecordRaw> = [
meta: {
title: (route: RouteLocationNormalized) => {
const slug = route.params.environmentSlug as string;
- return store.getters["environment/environmentById"](
+ return store.getters["environment/environmentByID"](
idFromSlug(slug)
).name;
},
@@ -439,7 +439,7 @@ const routes: Array<RouteRecordRaw> = [
meta: {
quickActionListByRole: (route: RouteLocationNormalized) => {
const slug = route.params.projectSlug as string;
- const project = store.getters["project/projectById"](
+ const project = store.getters["project/projectByID"](
idFromSlug(slug)
);
@@ -481,7 +481,7 @@ const routes: Array<RouteRecordRaw> = [
meta: {
title: (route: RouteLocationNormalized) => {
const slug = route.params.projectSlug as string;
- return store.getters["project/projectById"](
+ return store.getters["project/projectByID"](
idFromSlug(slug)
).name;
},
@@ -509,7 +509,7 @@ const routes: Array<RouteRecordRaw> = [
.projectWebhookSlug as string;
return (
"Webhook - " +
- store.getters["projectWebhook/projectWebhookById"](
+ store.getters["projectWebhook/projectWebhookByID"](
idFromSlug(projectSlug),
idFromSlug(projectWebhookSlug)
).name
@@ -624,7 +624,7 @@ const routes: Array<RouteRecordRaw> = [
if (slug.toLowerCase() == "new") {
return "New";
}
- return store.getters["database/databaseById"](
+ return store.getters["database/databaseByID"](
idFromSlug(slug)
).name;
},
@@ -656,7 +656,7 @@ const routes: Array<RouteRecordRaw> = [
}
return (
"Data source - " +
- store.getters["dataSource/dataSourceById"](
+ store.getters["dataSource/dataSourceByID"](
idFromSlug(slug)
).name
);
@@ -672,7 +672,7 @@ const routes: Array<RouteRecordRaw> = [
meta: {
title: (route: RouteLocationNormalized) => {
const slug = route.params.migrationHistorySlug as string;
- return store.getters["instance/migrationHistoryById"](
+ return store.getters["instance/migrationHistoryByID"](
idFromSlug(slug)
).version;
},
@@ -700,7 +700,7 @@ const routes: Array<RouteRecordRaw> = [
if (slug.toLowerCase() == "new") {
return "New";
}
- return store.getters["instance/instanceById"](
+ return store.getters["instance/instanceByID"](
idFromSlug(slug)
).name;
},
@@ -719,7 +719,7 @@ const routes: Array<RouteRecordRaw> = [
if (slug.toLowerCase() == "new") {
return "New";
}
- return store.getters["issue/issueById"](idFromSlug(slug)).name;
+ return store.getters["issue/issueByID"](idFromSlug(slug)).name;
},
allowBookmark: true,
},
@@ -878,7 +878,7 @@ router.beforeEach((to, from, next) => {
}
const routerSlug = store.getters["router/routeSlug"](to);
- const principalId = routerSlug.principalId;
+ const principalID = routerSlug.principalID;
const environmentSlug = routerSlug.environmentSlug;
const projectSlug = routerSlug.projectSlug;
const projectWebhookSlug = routerSlug.projectWebhookSlug;
@@ -890,9 +890,9 @@ router.beforeEach((to, from, next) => {
const migrationHistorySlug = routerSlug.migrationHistorySlug;
const vcsSlug = routerSlug.vcsSlug;
- if (principalId) {
+ if (principalID) {
store
- .dispatch("principal/fetchPrincipalById", principalId)
+ .dispatch("principal/fetchPrincipalByID", principalID)
.then(() => {
next();
})
@@ -908,7 +908,7 @@ router.beforeEach((to, from, next) => {
if (environmentSlug) {
if (
- store.getters["environment/environmentById"](idFromSlug(environmentSlug))
+ store.getters["environment/environmentByID"](idFromSlug(environmentSlug))
) {
next();
return;
@@ -921,15 +921,15 @@ router.beforeEach((to, from, next) => {
if (projectSlug) {
store
- .dispatch("project/fetchProjectById", idFromSlug(projectSlug))
+ .dispatch("project/fetchProjectByID", idFromSlug(projectSlug))
.then(() => {
if (!projectWebhookSlug) {
next();
} else {
store
- .dispatch("projectWebhook/fetchProjectWebhookById", {
- projectId: idFromSlug(projectSlug),
- projectWebhookId: idFromSlug(projectWebhookSlug),
+ .dispatch("projectWebhook/fetchProjectWebhookByID", {
+ projectID: idFromSlug(projectSlug),
+ projectWebhookID: idFromSlug(projectWebhookSlug),
})
.then(() => {
next();
@@ -957,15 +957,15 @@ router.beforeEach((to, from, next) => {
if (issueSlug.toLowerCase() == "new") {
// For prepraing the database if user visits creating issue url directly.
if (to.query.databaseList) {
- for (const databaseId of (to.query.databaseList as string).split(",")) {
- store.dispatch("database/fetchDatabaseById", { databaseId });
+ for (const databaseID of (to.query.databaseList as string).split(",")) {
+ store.dispatch("database/fetchDatabaseByID", { databaseID });
}
}
next();
return;
}
store
- .dispatch("issue/fetchIssueById", idFromSlug(issueSlug))
+ .dispatch("issue/fetchIssueByID", idFromSlug(issueSlug))
.then(() => {
next();
})
@@ -985,16 +985,16 @@ router.beforeEach((to, from, next) => {
return;
}
store
- .dispatch("database/fetchDatabaseById", {
- databaseId: idFromSlug(databaseSlug),
+ .dispatch("database/fetchDatabaseByID", {
+ databaseID: idFromSlug(databaseSlug),
})
.then((database: Database) => {
if (!tableName && !dataSourceSlug && !migrationHistorySlug) {
next();
} else if (tableName) {
store
- .dispatch("table/fetchTableByDatabaseIdAndTableName", {
- databaseId: database.id,
+ .dispatch("table/fetchTableByDatabaseIDAndTableName", {
+ databaseID: database.id,
tableName,
})
.then(() => {
@@ -1009,9 +1009,9 @@ router.beforeEach((to, from, next) => {
});
} else if (dataSourceSlug) {
store
- .dispatch("dataSource/fetchDataSourceById", {
- dataSourceId: idFromSlug(dataSourceSlug),
- databaseId: database.id,
+ .dispatch("dataSource/fetchDataSourceByID", {
+ dataSourceID: idFromSlug(dataSourceSlug),
+ databaseID: database.id,
})
.then(() => {
next();
@@ -1025,9 +1025,9 @@ router.beforeEach((to, from, next) => {
});
} else if (migrationHistorySlug) {
store
- .dispatch("instance/fetchMigrationHistoryById", {
- instanceId: database.instance.id,
- migrationHistoryId: idFromSlug(migrationHistorySlug),
+ .dispatch("instance/fetchMigrationHistoryByID", {
+ instanceID: database.instance.id,
+ migrationHistoryID: idFromSlug(migrationHistorySlug),
})
.then(() => {
next();
@@ -1053,7 +1053,7 @@ router.beforeEach((to, from, next) => {
if (instanceSlug) {
store
- .dispatch("instance/fetchInstanceById", idFromSlug(instanceSlug))
+ .dispatch("instance/fetchInstanceByID", idFromSlug(instanceSlug))
.then(() => {
next();
})
@@ -1069,7 +1069,7 @@ router.beforeEach((to, from, next) => {
if (vcsSlug) {
store
- .dispatch("vcs/fetchVCSById", idFromSlug(vcsSlug))
+ .dispatch("vcs/fetchVCSByID", idFromSlug(vcsSlug))
.then(() => {
next();
})
diff --git a/frontend/src/store/modules/activity.ts b/frontend/src/store/modules/activity.ts
index 3f13fbf2ec..2a3bb8144c 100644
--- a/frontend/src/store/modules/activity.ts
+++ b/frontend/src/store/modules/activity.ts
@@ -2,12 +2,12 @@ import axios from "axios";
import {
Activity,
ActivityCreate,
- ActivityId,
+ ActivityID,
ActivityPatch,
ActivityState,
- IssueId,
- PrincipalId,
- ProjectId,
+ IssueID,
+ PrincipalID,
+ ProjectID,
ResourceObject,
} from "../../types";
@@ -41,40 +41,40 @@ const getters = {
activityListByUser:
(state: ActivityState) =>
- (userId: PrincipalId): Activity[] => {
- return state.activityListByUser.get(userId) || [];
+ (userID: PrincipalID): Activity[] => {
+ return state.activityListByUser.get(userID) || [];
},
activityListByIssue:
(state: ActivityState) =>
- (issueId: IssueId): Activity[] => {
- return state.activityListByIssue.get(issueId) || [];
+ (issueID: IssueID): Activity[] => {
+ return state.activityListByIssue.get(issueID) || [];
},
};
const actions = {
async fetchActivityListForUser(
{ commit, rootGetters }: any,
- userId: PrincipalId
+ userID: PrincipalID
) {
const data = (await axios.get(`/api/activity`)).data;
const activityList = data.data.map((activity: ResourceObject) => {
return convert(activity, data.included, rootGetters);
});
- commit("setActivityListForUser", { userId, activityList });
+ commit("setActivityListForUser", { userID, activityList });
return activityList;
},
async fetchActivityListForIssue(
{ commit, rootGetters }: any,
- issueId: IssueId
+ issueID: IssueID
) {
- const data = (await axios.get(`/api/activity?container=${issueId}`)).data;
+ const data = (await axios.get(`/api/activity?container=${issueID}`)).data;
const activityList = data.data.map((activity: ResourceObject) => {
return convert(activity, data.included, rootGetters);
});
- commit("setActivityListForIssue", { issueId, activityList });
+ commit("setActivityListForIssue", { issueID, activityList });
return activityList;
},
@@ -82,14 +82,14 @@ const actions = {
async fetchActivityListForProject(
{ rootGetters }: any,
{
- projectId,
+ projectID,
limit,
}: {
- projectId: ProjectId;
+ projectID: ProjectID;
limit?: number;
}
) {
- var queryList = [`container=${projectId}`];
+ var queryList = [`container=${projectID}`];
if (limit) {
queryList.push(`limit=${limit}`);
}
@@ -121,7 +121,7 @@ const actions = {
// There might exist other activities happened since the last fetch, so we do a full refetch.
if (newActivity.type.startsWith("bb.issue.")) {
- dispatch("fetchActivityListForIssue", newActivity.containerId);
+ dispatch("fetchActivityListForIssue", newActivity.containerID);
}
return createdActivity;
@@ -130,10 +130,10 @@ const actions = {
async updateComment(
{ dispatch, rootGetters }: any,
{
- activityId,
+ activityID,
updatedComment,
}: {
- activityId: ActivityId;
+ activityID: ActivityID;
updatedComment: string;
}
) {
@@ -141,7 +141,7 @@ const actions = {
comment: updatedComment,
};
const data = (
- await axios.patch(`/api/activity/${activityId}`, {
+ await axios.patch(`/api/activity/${activityID}`, {
data: {
type: "activityPatch",
attributes: activityPatch,
@@ -150,7 +150,7 @@ const actions = {
).data;
const updatedActivity = convert(data.data, data.included, rootGetters);
- dispatch("fetchActivityListForIssue", updatedActivity.containerId);
+ dispatch("fetchActivityListForIssue", updatedActivity.containerID);
return updatedActivity;
},
@@ -159,7 +159,7 @@ const actions = {
await axios.delete(`/api/activity/${activity.id}`);
if (activity.type.startsWith("bb.issue.")) {
- dispatch("fetchActivityListForIssue", activity.containerId);
+ dispatch("fetchActivityListForIssue", activity.containerID);
}
},
};
@@ -168,27 +168,27 @@ const mutations = {
setActivityListForUser(
state: ActivityState,
{
- userId,
+ userID,
activityList,
}: {
- userId: PrincipalId;
+ userID: PrincipalID;
activityList: Activity[];
}
) {
- state.activityListByUser.set(userId, activityList);
+ state.activityListByUser.set(userID, activityList);
},
setActivityListForIssue(
state: ActivityState,
{
- issueId,
+ issueID,
activityList,
}: {
- issueId: IssueId;
+ issueID: IssueID;
activityList: Activity[];
}
) {
- state.activityListByIssue.set(issueId, activityList);
+ state.activityListByIssue.set(issueID, activityList);
},
};
diff --git a/frontend/src/store/modules/auth.ts b/frontend/src/store/modules/auth.ts
index 1a77928162..b2091a4ae7 100644
--- a/frontend/src/store/modules/auth.ts
+++ b/frontend/src/store/modules/auth.ts
@@ -8,12 +8,12 @@ import {
ActivateInfo,
ResourceObject,
unknown,
- PrincipalId,
+ PrincipalID,
} from "../../types";
import { getIntCookie } from "../../utils";
function convert(user: ResourceObject, rootGetters: any): Principal {
- return rootGetters["principal/principalById"](user.id);
+ return rootGetters["principal/principalByID"](user.id);
}
const state: () => AuthState = () => ({
@@ -39,7 +39,7 @@ const actions = {
).data.data;
// Refresh the corresponding principal
- await dispatch("principal/fetchPrincipalById", loggedInUser.id, {
+ await dispatch("principal/fetchPrincipalByID", loggedInUser.id, {
root: true,
});
@@ -64,7 +64,7 @@ const actions = {
).data.data;
// Refresh the corresponding principal
- await dispatch("principal/fetchPrincipalById", newUser.id, { root: true });
+ await dispatch("principal/fetchPrincipalByID", newUser.id, { root: true });
// The conversion relies on the above refresh.
const convertedUser = convert(newUser, rootGetters);
@@ -83,7 +83,7 @@ const actions = {
).data.data;
// Refresh the corresponding principal
- dispatch("principal/fetchPrincipalById", activatedUser.id, { root: true });
+ dispatch("principal/fetchPrincipalByID", activatedUser.id, { root: true });
// The conversion relies on the above task to get the lastest data
const convertedUser = convert(activatedUser, rootGetters);
@@ -92,11 +92,11 @@ const actions = {
},
async restoreUser({ commit, dispatch }: any) {
- const userId = getIntCookie("user");
- if (userId) {
+ const userID = getIntCookie("user");
+ if (userID) {
const loggedInUser = await dispatch(
- "principal/fetchPrincipalById",
- userId,
+ "principal/fetchPrincipalByID",
+ userID,
{
root: true,
}
@@ -110,10 +110,10 @@ const actions = {
async refreshUserIfNeeded(
{ commit, state, rootGetters }: any,
- principalId: PrincipalId
+ principalID: PrincipalID
) {
- if (principalId == state.currentUser.id) {
- const refreshedUser = rootGetters["principal/principalById"](
+ if (principalID == state.currentUser.id) {
+ const refreshedUser = rootGetters["principal/principalByID"](
state.currentUser.id
);
if (!isEqual(refreshedUser, state.currentUser)) {
diff --git a/frontend/src/store/modules/backup.ts b/frontend/src/store/modules/backup.ts
index 17564f1459..25056af7fe 100644
--- a/frontend/src/store/modules/backup.ts
+++ b/frontend/src/store/modules/backup.ts
@@ -6,7 +6,7 @@ import {
BackupSettingState,
BackupSettingUpsert,
BackupState,
- DatabaseId,
+ DatabaseID,
ResourceObject,
unknown,
} from "../../types";
@@ -34,8 +34,8 @@ function convertBackupSetting(
}
const state: () => BackupState = () => ({
- backupListByDatabaseId: new Map(),
- backupSettingByDatabaseId: new Map(),
+ backupListByDatabaseID: new Map(),
+ backupSettingByDatabaseID: new Map(),
});
const getters = {
@@ -45,16 +45,16 @@ const getters = {
return convert(backup, includedList || [], rootGetters);
},
- backupListByDatabaseId:
+ backupListByDatabaseID:
(state: BackupState) =>
- (databaseId: DatabaseId): Backup[] => {
- return state.backupListByDatabaseId.get(databaseId) || [];
+ (databaseID: DatabaseID): Backup[] => {
+ return state.backupListByDatabaseID.get(databaseID) || [];
},
- backupSettingByDatabaseId:
+ backupSettingByDatabaseID:
(state: BackupSettingState) =>
- (databaseId: DatabaseId): BackupSetting => {
+ (databaseID: DatabaseID): BackupSetting => {
return (
- state.backupSettingByDatabaseId.get(databaseId) ||
+ state.backupSettingByDatabaseID.get(databaseID) ||
(unknown("BACKUP_SETTING") as BackupSetting)
);
},
@@ -64,12 +64,12 @@ const actions = {
async createBackup(
{ commit, rootGetters }: any,
{
- databaseId,
+ databaseID,
newBackup,
- }: { databaseId: DatabaseId; newBackup: BackupCreate }
+ }: { databaseID: DatabaseID; newBackup: BackupCreate }
) {
const data = (
- await axios.post(`/api/database/${newBackup.databaseId}/backup`, {
+ await axios.post(`/api/database/${newBackup.databaseID}/backup`, {
data: {
type: "BackupCreate",
attributes: newBackup,
@@ -82,8 +82,8 @@ const actions = {
rootGetters
);
- commit("setBackupByDatabaseIdAndBackupName", {
- databaseId: databaseId,
+ commit("setBackupByDatabaseIDAndBackupName", {
+ databaseID: databaseID,
backupName: createdBackup.name,
backup: createdBackup,
});
@@ -91,24 +91,24 @@ const actions = {
return createdBackup;
},
- async fetchBackupListByDatabaseId(
+ async fetchBackupListByDatabaseID(
{ commit, rootGetters }: any,
- databaseId: DatabaseId
+ databaseID: DatabaseID
) {
- const data = (await axios.get(`/api/database/${databaseId}/backup`)).data;
+ const data = (await axios.get(`/api/database/${databaseID}/backup`)).data;
const backupList = data.data.map((backup: ResourceObject) => {
return convert(backup, data.included, rootGetters);
});
- commit("setTableListByDatabaseId", { databaseId, backupList });
+ commit("setTableListByDatabaseID", { databaseID, backupList });
return backupList;
},
- async fetchBackupSettingByDatabaseId(
+ async fetchBackupSettingByDatabaseID(
{ commit, rootGetters }: any,
- databaseId: DatabaseId
+ databaseID: DatabaseID
) {
- const data = (await axios.get(`/api/database/${databaseId}/backupsetting`))
+ const data = (await axios.get(`/api/database/${databaseID}/backupsetting`))
.data;
const backupSetting: BackupSetting = convertBackupSetting(
data.data,
@@ -116,7 +116,7 @@ const actions = {
rootGetters
);
- commit("upsertBackupSettingByDatabaseId", { databaseId, backupSetting });
+ commit("upsertBackupSettingByDatabaseID", { databaseID, backupSetting });
return backupSetting;
},
@@ -126,7 +126,7 @@ const actions = {
) {
const data = (
await axios.patch(
- `/api/database/${newBackupSetting.databaseId}/backupsetting`,
+ `/api/database/${newBackupSetting.databaseID}/backupsetting`,
{
data: {
type: "BackupSettingUpsert",
@@ -141,8 +141,8 @@ const actions = {
rootGetters
);
- commit("upsertBackupSettingByDatabaseId", {
- databaseId: newBackupSetting.databaseId,
+ commit("upsertBackupSettingByDatabaseID", {
+ databaseID: newBackupSetting.databaseID,
backup: updatedBackupSetting,
});
@@ -151,32 +151,32 @@ const actions = {
};
const mutations = {
- setTableListByDatabaseId(
+ setTableListByDatabaseID(
state: BackupState,
{
- databaseId,
+ databaseID,
backupList,
}: {
- databaseId: DatabaseId;
+ databaseID: DatabaseID;
backupList: Backup[];
}
) {
- state.backupListByDatabaseId.set(databaseId, backupList);
+ state.backupListByDatabaseID.set(databaseID, backupList);
},
- setBackupByDatabaseIdAndBackupName(
+ setBackupByDatabaseIDAndBackupName(
state: BackupState,
{
- databaseId,
+ databaseID,
backupName,
backup,
}: {
- databaseId: DatabaseId;
+ databaseID: DatabaseID;
backupName: string;
backup: Backup;
}
) {
- const list = state.backupListByDatabaseId.get(databaseId);
+ const list = state.backupListByDatabaseID.get(databaseID);
if (list) {
const i = list.findIndex((item: Backup) => item.name == backupName);
if (i != -1) {
@@ -185,21 +185,21 @@ const mutations = {
list.push(backup);
}
} else {
- state.backupListByDatabaseId.set(databaseId, [backup]);
+ state.backupListByDatabaseID.set(databaseID, [backup]);
}
},
- upsertBackupSettingByDatabaseId(
+ upsertBackupSettingByDatabaseID(
state: BackupSettingState,
{
- databaseId,
+ databaseID,
backupSetting,
}: {
- databaseId: DatabaseId;
+ databaseID: DatabaseID;
backupSetting: BackupSetting;
}
) {
- state.backupSettingByDatabaseId.set(databaseId, backupSetting);
+ state.backupSettingByDatabaseID.set(databaseID, backupSetting);
},
};
diff --git a/frontend/src/store/modules/bookmark.ts b/frontend/src/store/modules/bookmark.ts
index ef9f518078..8574872c7b 100644
--- a/frontend/src/store/modules/bookmark.ts
+++ b/frontend/src/store/modules/bookmark.ts
@@ -1,6 +1,6 @@
import axios from "axios";
import {
- PrincipalId,
+ PrincipalID,
Bookmark,
BookmarkCreate,
BookmarkState,
@@ -22,13 +22,13 @@ const state: () => BookmarkState = () => ({
const getters = {
bookmarkListByUser:
(state: BookmarkState) =>
- (userId: PrincipalId): Bookmark[] => {
- return state.bookmarkListByUser.get(userId) || [];
+ (userID: PrincipalID): Bookmark[] => {
+ return state.bookmarkListByUser.get(userID) || [];
},
bookmarkByUserAndLink:
(state: BookmarkState, getters: any) =>
- (userId: PrincipalId, link: string): Bookmark => {
- const list = getters["bookmarkListByUser"](userId);
+ (userID: PrincipalID, link: string): Bookmark => {
+ const list = getters["bookmarkListByUser"](userID);
return (
list.find((item: Bookmark) => item.link == link) ||
(unknown("BOOKMARK") as Bookmark)
@@ -39,7 +39,7 @@ const getters = {
const actions = {
async fetchBookmarkListByUser(
{ commit, rootGetters }: any,
- userId: PrincipalId
+ userID: PrincipalID
) {
// API only returns bookmark for the requesting user.
// User info is retrieved from the context.
@@ -48,7 +48,7 @@ const actions = {
return convert(bookmark, rootGetters);
}
);
- commit("setBookmarkListByPrincipalId", { userId, bookmarkList });
+ commit("setBookmarkListByPrincipalID", { userID, bookmarkList });
return bookmarkList;
},
@@ -81,17 +81,17 @@ const actions = {
};
const mutations = {
- setBookmarkListByPrincipalId(
+ setBookmarkListByPrincipalID(
state: BookmarkState,
{
- userId,
+ userID,
bookmarkList,
}: {
- userId: PrincipalId;
+ userID: PrincipalID;
bookmarkList: Bookmark[];
}
) {
- state.bookmarkListByUser.set(userId, bookmarkList);
+ state.bookmarkListByUser.set(userID, bookmarkList);
},
appendBookmark(state: BookmarkState, bookmark: Bookmark) {
diff --git a/frontend/src/store/modules/command.ts b/frontend/src/store/modules/command.ts
index 4e50939d8b..fe9845b2d5 100644
--- a/frontend/src/store/modules/command.ts
+++ b/frontend/src/store/modules/command.ts
@@ -1,12 +1,12 @@
import {
Command,
- CommandId,
- CommandRegisterId,
+ CommandID,
+ CommandRegisterID,
CommandState,
} from "../../types";
const state: () => CommandState = () => ({
- commandListById: new Map(),
+ commandListByID: new Map(),
});
const actions = {
@@ -19,20 +19,20 @@ const actions = {
{ commit }: any,
{
id,
- registerId,
+ registerID,
}: {
- id: CommandId;
- registerId: CommandRegisterId;
+ id: CommandID;
+ registerID: CommandRegisterID;
}
) {
commit("removeCommand", {
id,
- registerId,
+ registerID,
});
},
- dispatchCommand({ state }: any, commandId: CommandId) {
- const list = state.commandListById.get(commandId);
+ dispatchCommand({ state }: any, commandID: CommandID) {
+ const list = state.commandListByID.get(commandID);
list?.forEach((cmd: Command) => {
cmd.run();
});
@@ -41,19 +41,19 @@ const actions = {
const mutations = {
appendCommand(state: CommandState, command: Command) {
- const list = state.commandListById.get(command.id);
+ const list = state.commandListByID.get(command.id);
if (list) {
const i = list.findIndex(
- (item) => item.registerId === command.registerId
+ (item) => item.registerID === command.registerID
);
if (i > -1) {
throw new Error(
- `'${command.registerId}' has already registered command '${command.id}', this is likely a programming error.`
+ `'${command.registerID}' has already registered command '${command.id}', this is likely a programming error.`
);
}
list.push(command);
} else {
- state.commandListById.set(command.id, [command]);
+ state.commandListByID.set(command.id, [command]);
}
},
@@ -61,22 +61,22 @@ const mutations = {
state: CommandState,
{
id,
- registerId,
+ registerID,
}: {
- id: CommandId;
- registerId: CommandRegisterId;
+ id: CommandID;
+ registerID: CommandRegisterID;
}
) {
- const list = state.commandListById.get(id);
+ const list = state.commandListByID.get(id);
if (list) {
- const i = list.findIndex((item) => item.registerId === registerId);
+ const i = list.findIndex((item) => item.registerID === registerID);
if (i >= 0) {
list.splice(i, 1);
return;
}
}
throw new Error(
- `'${registerId}' attempts to unregister command '${id}' which is not registered before, this is likely a programming error.`
+ `'${registerID}' attempts to unregister command '${id}' which is not registered before, this is likely a programming error.`
);
},
};
diff --git a/frontend/src/store/modules/dataSource.ts b/frontend/src/store/modules/dataSource.ts
index 10cef194df..f9b0178408 100644
--- a/frontend/src/store/modules/dataSource.ts
+++ b/frontend/src/store/modules/dataSource.ts
@@ -1,15 +1,15 @@
import axios from "axios";
import {
- DataSourceId,
+ DataSourceID,
DataSource,
DataSourceCreate,
DataSourceMember,
DataSourceMemberCreate,
DataSourceState,
- PrincipalId,
+ PrincipalID,
ResourceObject,
ResourceIdentifier,
- DatabaseId,
+ DatabaseID,
unknown,
Database,
Instance,
@@ -23,17 +23,17 @@ function convert(
includedList: ResourceObject[],
rootGetters: any
): DataSource {
- const databaseId = (
+ const databaseID = (
dataSource.relationships!.database.data as ResourceIdentifier
).id;
- const instanceId = (
+ const instanceID = (
dataSource.relationships!.instance.data as ResourceIdentifier
).id;
const memberList = (dataSource.attributes.memberList as []).map(
(item: any): DataSourceMember => {
return {
- principal: rootGetters["principal/principalById"](item.principalId),
- issueId: item.issueId,
+ principal: rootGetters["principal/principalByID"](item.principalID),
+ issueID: item.issueID,
createdTs: item.createdTs,
};
}
@@ -41,7 +41,7 @@ function convert(
let instance: Instance = unknown("INSTANCE") as Instance;
for (const item of includedList || []) {
- if (item.type == "instance" && item.id == instanceId) {
+ if (item.type == "instance" && item.id == instanceID) {
instance = rootGetters["instance/convert"](item);
break;
}
@@ -49,7 +49,7 @@ function convert(
let database: Database = unknown("DATABASE") as Database;
for (const item of includedList || []) {
- if (item.type == "database" && item.id == databaseId) {
+ if (item.type == "database" && item.id == databaseID) {
database = rootGetters["database/convert"](item);
break;
}
@@ -58,7 +58,7 @@ function convert(
return {
...(dataSource.attributes as Omit<
DataSource,
- "id" | "instanceId" | "database" | "memberList"
+ "id" | "instanceID" | "database" | "memberList"
>),
id: parseInt(dataSource.id),
instance,
@@ -68,7 +68,7 @@ function convert(
}
const state: () => DataSourceState = () => ({
- dataSourceById: new Map(),
+ dataSourceByID: new Map(),
});
const getters = {
@@ -81,35 +81,35 @@ const getters = {
return convert(dataSource, [], rootGetters);
},
- dataSourceById:
+ dataSourceByID:
(state: DataSourceState) =>
- (dataSourceId: DataSourceId): DataSource => {
- if (dataSourceId == EMPTY_ID) {
+ (dataSourceID: DataSourceID): DataSource => {
+ if (dataSourceID == EMPTY_ID) {
return empty("DATA_SOURCE") as DataSource;
}
return (
- state.dataSourceById.get(dataSourceId) ||
+ state.dataSourceByID.get(dataSourceID) ||
(unknown("DATA_SOURCE") as DataSource)
);
},
};
const actions = {
- async fetchDataSourceById(
+ async fetchDataSourceByID(
{ commit, rootGetters }: any,
{
- dataSourceId,
- databaseId,
- }: { dataSourceId: DataSourceId; databaseId: DatabaseId }
+ dataSourceID,
+ databaseID,
+ }: { dataSourceID: DataSourceID; databaseID: DatabaseID }
) {
const data = (
- await axios.get(`/api/database/${databaseId}/datasource/${dataSourceId}`)
+ await axios.get(`/api/database/${databaseID}/datasource/${dataSourceID}`)
).data;
const dataSource = convert(data.data, data.included, rootGetters);
- commit("setDataSourceById", {
- dataSourceId,
+ commit("setDataSourceByID", {
+ dataSourceID,
dataSource,
});
@@ -121,7 +121,7 @@ const actions = {
newDataSource: DataSourceCreate
) {
const data = (
- await axios.post(`/api/database/${newDataSource.databaseId}/datasource`, {
+ await axios.post(`/api/database/${newDataSource.databaseID}/datasource`, {
data: {
type: "DataSourceCreate",
attributes: newDataSource,
@@ -130,15 +130,15 @@ const actions = {
).data;
const createdDataSource = convert(data.data, data.included, rootGetters);
- commit("setDataSourceById", {
- dataSourceId: createdDataSource.id,
+ commit("setDataSourceByID", {
+ dataSourceID: createdDataSource.id,
dataSource: createdDataSource,
});
// Refresh the corresponding database as it contains data source.
dispatch(
- "database/fetchDatabaseById",
- { databaseId: newDataSource.databaseId },
+ "database/fetchDatabaseByID",
+ { databaseID: newDataSource.databaseID },
{ root: true }
);
@@ -148,18 +148,18 @@ const actions = {
async patchDataSource(
{ commit, dispatch, rootGetters }: any,
{
- databaseId,
- dataSourceId,
+ databaseID,
+ dataSourceID,
dataSource,
}: {
- databaseId: DatabaseId;
- dataSourceId: DataSourceId;
+ databaseID: DatabaseID;
+ dataSourceID: DataSourceID;
dataSource: DataSourcePatch;
}
) {
const data = (
await axios.patch(
- `/api/database/${databaseId}/datasource/${dataSourceId}`,
+ `/api/database/${databaseID}/datasource/${dataSourceID}`,
{
data: {
type: "dataSourcePatch",
@@ -170,49 +170,49 @@ const actions = {
).data;
const updatedDataSource = convert(data.data, data.included, rootGetters);
- commit("setDataSourceById", {
- dataSourceId: updatedDataSource.id,
+ commit("setDataSourceByID", {
+ dataSourceID: updatedDataSource.id,
dataSource: updatedDataSource,
});
// Refresh the corresponding database as it contains data source.
- dispatch("database/fetchDatabaseById", { databaseId }, { root: true });
+ dispatch("database/fetchDatabaseByID", { databaseID }, { root: true });
return updatedDataSource;
},
- async deleteDataSourceById(
+ async deleteDataSourceByID(
{ dispatch, commit }: any,
{
- databaseId,
- dataSourceId,
- }: { databaseId: DatabaseId; dataSourceId: DataSourceId }
+ databaseID,
+ dataSourceID,
+ }: { databaseID: DatabaseID; dataSourceID: DataSourceID }
) {
await axios.delete(
- `/api/database/${databaseId}/datasource/${dataSourceId}`
+ `/api/database/${databaseID}/datasource/${dataSourceID}`
);
- commit("deleteDataSourceById", dataSourceId);
+ commit("deleteDataSourceByID", dataSourceID);
// Refresh the corresponding database as it contains data source.
- dispatch("database/fetchDatabaseById", { databaseId }, { root: true });
+ dispatch("database/fetchDatabaseByID", { databaseID }, { root: true });
},
async createDataSourceMember(
{ commit, dispatch, rootGetters }: any,
{
- dataSourceId,
- databaseId,
+ dataSourceID,
+ databaseID,
newDataSourceMember,
}: {
- dataSourceId: DataSourceId;
- databaseId: DatabaseId;
+ dataSourceID: DataSourceID;
+ databaseID: DatabaseID;
newDataSourceMember: DataSourceMemberCreate;
}
) {
const data = (
await axios.post(
- `/api/database/${databaseId}/datasource/${dataSourceId}/member`,
+ `/api/database/${databaseID}/datasource/${dataSourceID}/member`,
{
data: {
type: "dataSourceMember",
@@ -224,63 +224,63 @@ const actions = {
// It's patching the data source and returns the updated data source
const updatedDataSource = convert(data.data, data.included, rootGetters);
- commit("setDataSourceById", {
- databaseId,
+ commit("setDataSourceByID", {
+ databaseID,
dataSource: updatedDataSource,
});
// Refresh the corresponding database as it contains data source and its membership info.
- dispatch("database/fetchDatabaseById", { databaseId }, { root: true });
+ dispatch("database/fetchDatabaseByID", { databaseID }, { root: true });
return updatedDataSource;
},
- async deleteDataSourceMemberByMemberId(
+ async deleteDataSourceMemberByMemberID(
{ commit, dispatch, rootGetters }: any,
{
- databaseId,
- dataSourceId,
- memberId,
+ databaseID,
+ dataSourceID,
+ memberID,
}: {
- databaseId: DatabaseId;
- dataSourceId: DataSourceId;
- memberId: PrincipalId;
+ databaseID: DatabaseID;
+ dataSourceID: DataSourceID;
+ memberID: PrincipalID;
}
) {
const data = (
await axios.delete(
- `/api/database/${databaseId}/datasource/${dataSourceId}/member/${memberId}`
+ `/api/database/${databaseID}/datasource/${dataSourceID}/member/${memberID}`
)
).data;
// It's patching the data source and returns the updated data source
const updatedDataSource = convert(data.data, data.included, rootGetters);
- commit("setDataSourceById", {
- dataSourceId: updatedDataSource.id,
+ commit("setDataSourceByID", {
+ dataSourceID: updatedDataSource.id,
dataSource: updatedDataSource,
});
// Refresh the corresponding database as it contains data source and its membership info.
- dispatch("database/fetchDatabaseById", { databaseId }, { root: true });
+ dispatch("database/fetchDatabaseByID", { databaseID }, { root: true });
},
};
const mutations = {
- setDataSourceById(
+ setDataSourceByID(
state: DataSourceState,
{
- dataSourceId,
+ dataSourceID,
dataSource,
}: {
- dataSourceId: DataSourceId;
+ dataSourceID: DataSourceID;
dataSource: DataSource;
}
) {
- state.dataSourceById.set(dataSourceId, dataSource);
+ state.dataSourceByID.set(dataSourceID, dataSource);
},
- deleteDataSourceById(state: DataSourceState, dataSourceId: DataSourceId) {
- state.dataSourceById.delete(dataSourceId);
+ deleteDataSourceByID(state: DataSourceState, dataSourceID: DataSourceID) {
+ state.dataSourceByID.delete(dataSourceID);
},
};
diff --git a/frontend/src/store/modules/database.ts b/frontend/src/store/modules/database.ts
index f7138265d7..5a76a4c1dd 100644
--- a/frontend/src/store/modules/database.ts
+++ b/frontend/src/store/modules/database.ts
@@ -4,17 +4,17 @@ import {
Backup,
Database,
DatabaseCreate,
- DatabaseId,
+ DatabaseID,
DatabaseState,
DataSource,
empty,
EMPTY_ID,
- EnvironmentId,
+ EnvironmentID,
Instance,
- InstanceId,
- PrincipalId,
+ InstanceID,
+ PrincipalID,
Project,
- ProjectId,
+ ProjectID,
ResourceIdentifier,
ResourceObject,
unknown,
@@ -28,48 +28,48 @@ function convert(
// We first populate the id for instance, project and dataSourceList.
// And if we also provide the detail info for those objects in the includedList,
// then we convert them to the detailed objects.
- const instanceId = (
+ const instanceID = (
database.relationships!.instance.data as ResourceIdentifier
).id;
let instance: Instance = unknown("INSTANCE") as Instance;
- instance.id = parseInt(instanceId);
+ instance.id = parseInt(instanceID);
- const projectId = (database.relationships!.project.data as ResourceIdentifier)
+ const projectID = (database.relationships!.project.data as ResourceIdentifier)
.id;
let project: Project = unknown("PROJECT") as Project;
- project.id = parseInt(projectId);
+ project.id = parseInt(projectID);
- const dataSourceIdList = database.relationships!.dataSource
+ const dataSourceIDList = database.relationships!.dataSource
.data as ResourceIdentifier[];
const dataSourceList: DataSource[] = [];
- for (const item of dataSourceIdList) {
+ for (const item of dataSourceIDList) {
const dataSource = unknown("DATA_SOURCE") as DataSource;
dataSource.id = parseInt(item.id);
dataSourceList.push(dataSource);
}
- const sourceBackupId = database.relationships!.sourceBackup.data
+ const sourceBackupID = database.relationships!.sourceBackup.data
? (database.relationships!.sourceBackup.data as ResourceIdentifier).id
: undefined;
let sourceBackup: Backup | undefined = undefined;
- const anomalyIdList = database.relationships!.anomaly
+ const anomalyIDList = database.relationships!.anomaly
.data as ResourceIdentifier[];
const anomalyList: Anomaly[] = [];
- for (const item of anomalyIdList) {
+ for (const item of anomalyIDList) {
const anomaly = unknown("ANOMALY") as Anomaly;
anomaly.id = parseInt(item.id);
anomalyList.push(anomaly);
}
for (const item of includedList || []) {
- if (item.type == "instance" && item.id == instanceId) {
+ if (item.type == "instance" && item.id == instanceID) {
instance = rootGetters["instance/convert"](item, includedList);
}
- if (item.type == "project" && item.id == projectId) {
+ if (item.type == "project" && item.id == projectID) {
project = rootGetters["project/convert"](item, includedList);
}
- if (item.type == "backup" && item.id == sourceBackupId) {
+ if (item.type == "backup" && item.id == sourceBackupID) {
sourceBackup = rootGetters["backup/convert"](item, includedList);
}
}
@@ -97,7 +97,7 @@ function convert(
for (const item of includedList || []) {
if (
item.type == "data-source" &&
- item.attributes.databaseId == database.id
+ item.attributes.databaseID == database.id
) {
const i = dataSourceList.findIndex(
(dataSource: DataSource) => parseInt(item.id) == dataSource.id
@@ -109,7 +109,7 @@ function convert(
}
}
- if (item.type == "anomaly" && item.attributes.databaseId == database.id) {
+ if (item.type == "anomaly" && item.attributes.databaseID == database.id) {
const i = anomalyList.findIndex(
(anomaly: Anomaly) => parseInt(item.id) == anomaly.id
);
@@ -150,8 +150,8 @@ const databaseSorter = (a: Database, b: Database): number => {
};
const state: () => DatabaseState = () => ({
- databaseListByInstanceId: new Map(),
- databaseListByProjectId: new Map(),
+ databaseListByInstanceID: new Map(),
+ databaseListByProjectID: new Map(),
});
const getters = {
@@ -161,20 +161,20 @@ const getters = {
return convert(database, inlcudedList, rootGetters);
},
- databaseListByInstanceId:
+ databaseListByInstanceID:
(state: DatabaseState) =>
- (instanceId: InstanceId): Database[] => {
- return state.databaseListByInstanceId.get(instanceId) || [];
+ (instanceID: InstanceID): Database[] => {
+ return state.databaseListByInstanceID.get(instanceID) || [];
},
- databaseListByPrincipalId:
+ databaseListByPrincipalID:
(state: DatabaseState) =>
- (userId: PrincipalId): Database[] => {
+ (userID: PrincipalID): Database[] => {
const list: Database[] = [];
- for (let [_, databaseList] of state.databaseListByInstanceId) {
+ for (let [_, databaseList] of state.databaseListByInstanceID) {
databaseList.forEach((item: Database) => {
for (const member of item.project.memberList) {
- if (member.principal.id == userId) {
+ if (member.principal.id == userID) {
list.push(item);
break;
}
@@ -184,13 +184,13 @@ const getters = {
return list;
},
- databaseListByEnvironmentId:
+ databaseListByEnvironmentID:
(state: DatabaseState) =>
- (environmentId: EnvironmentId): Database[] => {
+ (environmentID: EnvironmentID): Database[] => {
const list: Database[] = [];
- for (let [_, databaseList] of state.databaseListByInstanceId) {
+ for (let [_, databaseList] of state.databaseListByInstanceID) {
databaseList.forEach((item: Database) => {
- if (item.instance.environment.id == environmentId) {
+ if (item.instance.environment.id == environmentID) {
list.push(item);
}
});
@@ -198,29 +198,29 @@ const getters = {
return list;
},
- databaseListByProjectId:
+ databaseListByProjectID:
(state: DatabaseState) =>
- (projectId: ProjectId): Database[] => {
- return state.databaseListByProjectId.get(projectId) || [];
+ (projectID: ProjectID): Database[] => {
+ return state.databaseListByProjectID.get(projectID) || [];
},
- databaseById:
+ databaseByID:
(state: DatabaseState) =>
- (databaseId: DatabaseId, instanceId?: InstanceId): Database => {
- if (databaseId == EMPTY_ID) {
+ (databaseID: DatabaseID, instanceID?: InstanceID): Database => {
+ if (databaseID == EMPTY_ID) {
return empty("DATABASE") as Database;
}
- if (instanceId) {
- const list = state.databaseListByInstanceId.get(instanceId) || [];
+ if (instanceID) {
+ const list = state.databaseListByInstanceID.get(instanceID) || [];
return (
- list.find((item) => item.id == databaseId) ||
+ list.find((item) => item.id == databaseID) ||
(unknown("DATABASE") as Database)
);
}
- for (let [_, list] of state.databaseListByInstanceId) {
- const database = list.find((item) => item.id == databaseId);
+ for (let [_, list] of state.databaseListByInstanceID) {
+ const database = list.find((item) => item.id == databaseID);
if (database) {
return database;
}
@@ -231,32 +231,32 @@ const getters = {
};
const actions = {
- async fetchDatabaseListByInstanceId(
+ async fetchDatabaseListByInstanceID(
{ commit, rootGetters }: any,
- instanceId: InstanceId
+ instanceID: InstanceID
) {
- const data = (await axios.get(`/api/database?instance=${instanceId}`)).data;
+ const data = (await axios.get(`/api/database?instance=${instanceID}`)).data;
const databaseList = data.data.map((database: ResourceObject) => {
return convert(database, data.included, rootGetters);
});
databaseList.sort(databaseSorter);
- commit("upsertDatabaseList", { databaseList, instanceId });
+ commit("upsertDatabaseList", { databaseList, instanceID });
return databaseList;
},
- async fetchDatabaseListByProjectId(
+ async fetchDatabaseListByProjectID(
{ commit, rootGetters }: any,
- projectId: ProjectId
+ projectID: ProjectID
) {
- const data = (await axios.get(`/api/database?project=${projectId}`)).data;
+ const data = (await axios.get(`/api/database?project=${projectID}`)).data;
const databaseList = data.data.map((database: ResourceObject) => {
return convert(database, data.included, rootGetters);
});
databaseList.sort(databaseSorter);
- commit("setDatabaseListByProjectId", { databaseList, projectId });
+ commit("setDatabaseListByProjectID", { databaseList, projectID });
return databaseList;
},
@@ -274,13 +274,13 @@ const actions = {
return databaseList;
},
- async fetchDatabaseListByEnvironmentId(
+ async fetchDatabaseListByEnvironmentID(
{ state, commit, rootGetters }: any,
- environmentId: EnvironmentId
+ environmentID: EnvironmentID
) {
// Don't fetch the data source info as the current user may not have access to the
// database of this particular environment.
- const data = (await axios.get(`/api/database?environment=${environmentId}`))
+ const data = (await axios.get(`/api/database?environment=${environmentID}`))
.data;
const databaseList = data.data.map((database: ResourceObject) => {
return convert(database, data.included, rootGetters);
@@ -292,16 +292,16 @@ const actions = {
return databaseList;
},
- async fetchDatabaseById(
+ async fetchDatabaseByID(
{ commit, rootGetters }: any,
{
- databaseId,
- instanceId,
- }: { databaseId: DatabaseId; instanceId?: InstanceId }
+ databaseID,
+ instanceID,
+ }: { databaseID: DatabaseID; instanceID?: InstanceID }
) {
- const url = instanceId
- ? `/api/instance/${instanceId}/database/${databaseId}`
- : `/api/database/${databaseId}`;
+ const url = instanceID
+ ? `/api/instance/${instanceID}/database/${databaseID}`
+ : `/api/database/${databaseID}`;
const data = (await axios.get(url)).data;
const database = convert(data.data, data.included, rootGetters);
@@ -340,19 +340,19 @@ const actions = {
async transferProject(
{ commit, rootGetters }: any,
{
- databaseId,
- projectId,
+ databaseID,
+ projectID,
}: {
- databaseId: DatabaseId;
- projectId: ProjectId;
+ databaseID: DatabaseID;
+ projectID: ProjectID;
}
) {
const data = (
- await axios.patch(`/api/database/${databaseId}`, {
+ await axios.patch(`/api/database/${databaseID}`, {
data: {
type: "databasePatch",
attributes: {
- projectId,
+ projectID,
},
},
})
@@ -368,34 +368,34 @@ const actions = {
};
const mutations = {
- setDatabaseListByProjectId(
+ setDatabaseListByProjectID(
state: DatabaseState,
{
databaseList,
- projectId,
+ projectID,
}: {
databaseList: Database[];
- projectId: ProjectId;
+ projectID: ProjectID;
}
) {
- state.databaseListByProjectId.set(projectId, databaseList);
+ state.databaseListByProjectID.set(projectID, databaseList);
},
upsertDatabaseList(
state: DatabaseState,
{
databaseList,
- instanceId,
+ instanceID,
}: {
databaseList: Database[];
- instanceId?: InstanceId;
+ instanceID?: InstanceID;
}
) {
- if (instanceId) {
- state.databaseListByInstanceId.set(instanceId, databaseList);
+ if (instanceID) {
+ state.databaseListByInstanceID.set(instanceID, databaseList);
} else {
for (const database of databaseList) {
- const list = state.databaseListByInstanceId.get(database.instance.id);
+ const list = state.databaseListByInstanceID.get(database.instance.id);
if (list) {
const i = list.findIndex((item: Database) => item.id == database.id);
if (i != -1) {
@@ -404,7 +404,7 @@ const mutations = {
list.push(database);
}
} else {
- state.databaseListByInstanceId.set(database.instance.id, [database]);
+ state.databaseListByInstanceID.set(database.instance.id, [database]);
}
}
}
diff --git a/frontend/src/store/modules/environment.ts b/frontend/src/store/modules/environment.ts
index 33f82f047e..ab889fae72 100644
--- a/frontend/src/store/modules/environment.ts
+++ b/frontend/src/store/modules/environment.ts
@@ -4,7 +4,7 @@ import {
EMPTY_ID,
Environment,
EnvironmentCreate,
- EnvironmentId,
+ EnvironmentID,
EnvironmentPatch,
EnvironmentState,
ResourceObject,
@@ -48,15 +48,15 @@ const getters = {
});
},
- environmentById:
+ environmentByID:
(state: EnvironmentState) =>
- (environmentId: EnvironmentId): Environment => {
- if (environmentId == EMPTY_ID) {
+ (environmentID: EnvironmentID): Environment => {
+ if (environmentID == EMPTY_ID) {
return empty("ENVIRONMENT") as Environment;
}
for (const environment of state.environmentList) {
- if (environment.id == environmentId) {
+ if (environment.id == environmentID) {
return environment;
}
}
@@ -83,7 +83,7 @@ const actions = {
await dispatch(
"policy/fetchPolicyByEnvironmentAndType",
{
- environmentId: environment.id,
+ environmentID: environment.id,
type: "bb.policy.pipeline-approval",
},
{
@@ -114,7 +114,7 @@ const actions = {
await dispatch(
"policy/fetchPolicyByEnvironmentAndType",
{
- environmentId: createdEnvironment.id,
+ environmentID: createdEnvironment.id,
type: "bb.policy.pipeline-approval",
},
{
@@ -158,15 +158,15 @@ const actions = {
async patchEnvironment(
{ commit, rootGetters }: any,
{
- environmentId,
+ environmentID,
environmentPatch,
}: {
- environmentId: EnvironmentId;
+ environmentID: EnvironmentID;
environmentPatch: EnvironmentPatch;
}
) {
const data = (
- await axios.patch(`/api/environment/${environmentId}`, {
+ await axios.patch(`/api/environment/${environmentID}`, {
data: {
type: "environmentPatch",
attributes: environmentPatch,
diff --git a/frontend/src/store/modules/gitlab.ts b/frontend/src/store/modules/gitlab.ts
index 56bca6c827..b16d5a5f64 100644
--- a/frontend/src/store/modules/gitlab.ts
+++ b/frontend/src/store/modules/gitlab.ts
@@ -12,7 +12,7 @@ const getters = {};
function convertGitLabProject(project: any): ExternalRepositoryInfo {
return {
- externalId: project.id.toString(),
+ externalID: project.id.toString(),
name: project.name,
fullPath: project.path_with_namespace,
webURL: project.web_url,
@@ -32,7 +32,7 @@ const actions = {
): Promise<OAuthToken> {
const data = (
await axios.post(
- `${oAuthConfig.endpoint}?client_id=${oAuthConfig.applicationId}&client_secret=${oAuthConfig.secret}&code=${code}&redirect_uri=${oAuthConfig.redirectURL}&grant_type=authorization_code`
+ `${oAuthConfig.endpoint}?client_id=${oAuthConfig.applicationID}&client_secret=${oAuthConfig.secret}&code=${code}&redirect_uri=${oAuthConfig.redirectURL}&grant_type=authorization_code`
)
).data;
diff --git a/frontend/src/store/modules/inbox.ts b/frontend/src/store/modules/inbox.ts
index 8011de4af9..7b5a7ba05f 100644
--- a/frontend/src/store/modules/inbox.ts
+++ b/frontend/src/store/modules/inbox.ts
@@ -2,11 +2,11 @@ import axios from "axios";
import {
Activity,
Inbox,
- InboxId,
+ InboxID,
InboxPatch,
InboxState,
InboxSummary,
- PrincipalId,
+ PrincipalID,
ResourceIdentifier,
ResourceObject,
unknown,
@@ -17,13 +17,13 @@ function convert(
includedList: ResourceObject[],
rootGetters: any
): Inbox {
- const activityId = (inbox.relationships!.activity.data as ResourceIdentifier)
+ const activityID = (inbox.relationships!.activity.data as ResourceIdentifier)
.id;
let activity: Activity = unknown("ACTIVITY") as Activity;
- activity.id = parseInt(activityId);
+ activity.id = parseInt(activityID);
for (const item of includedList || []) {
- if (item.type == "activity" && item.id == activityId) {
+ if (item.type == "activity" && item.id == activityID) {
activity = rootGetters["activity/convert"](item, includedList);
}
}
@@ -43,15 +43,15 @@ const state: () => InboxState = () => ({
const getters = {
inboxListByUser:
(state: InboxState) =>
- (userId: PrincipalId): Inbox[] => {
- return state.inboxListByUser.get(userId) || [];
+ (userID: PrincipalID): Inbox[] => {
+ return state.inboxListByUser.get(userID) || [];
},
inboxSummaryByUser:
(state: InboxState) =>
- (userId: PrincipalId): InboxSummary => {
+ (userID: PrincipalID): InboxSummary => {
return (
- state.inboxSummaryByUser.get(userId) || {
+ state.inboxSummaryByUser.get(userID) || {
hasUnread: false,
hasUnreadError: false,
}
@@ -63,11 +63,11 @@ const actions = {
async fetchInboxListByUser(
{ commit, rootGetters }: any,
{
- userId,
+ userID,
readCreatedAfterTs,
- }: { userId: PrincipalId; readCreatedAfterTs?: number }
+ }: { userID: PrincipalID; readCreatedAfterTs?: number }
) {
- var url = `/api/inbox?user=${userId}`;
+ var url = `/api/inbox?user=${userID}`;
if (readCreatedAfterTs) {
url += `&created=${readCreatedAfterTs}`;
}
@@ -76,24 +76,24 @@ const actions = {
return convert(inbox, data.included, rootGetters);
});
- commit("setInboxListByUser", { userId, inboxList });
+ commit("setInboxListByUser", { userID, inboxList });
return inboxList;
},
- async fetchInboxSummaryByUser({ commit }: any, userId: PrincipalId) {
- const inboxSummary = (await axios.get(`/api/inbox/summary?user=${userId}`))
+ async fetchInboxSummaryByUser({ commit }: any, userID: PrincipalID) {
+ const inboxSummary = (await axios.get(`/api/inbox/summary?user=${userID}`))
.data;
- commit("setInboxSummaryByUser", { userId, inboxSummary });
+ commit("setInboxSummaryByUser", { userID, inboxSummary });
return inboxSummary;
},
async patchInbox(
{ commit, rootGetters }: any,
- { inboxId, inboxPatch }: { inboxId: InboxId; inboxPatch: InboxPatch }
+ { inboxID, inboxPatch }: { inboxID: InboxID; inboxPatch: InboxPatch }
) {
const data = (
- await axios.patch(`/api/inbox/${inboxId}`, {
+ await axios.patch(`/api/inbox/${inboxID}`, {
data: {
type: "inboxPatch",
attributes: inboxPatch,
@@ -102,7 +102,7 @@ const actions = {
).data;
const updatedInbox = convert(data.data, data.included, rootGetters);
- commit("updateInboxById", { inboxId, inbox: updatedInbox });
+ commit("updateInboxByID", { inboxID, inbox: updatedInbox });
return updatedInbox;
},
@@ -112,41 +112,41 @@ const mutations = {
setInboxListByUser(
state: InboxState,
{
- userId,
+ userID,
inboxList,
}: {
- userId: PrincipalId;
+ userID: PrincipalID;
inboxList: Inbox[];
}
) {
- state.inboxListByUser.set(userId, inboxList);
+ state.inboxListByUser.set(userID, inboxList);
},
setInboxSummaryByUser(
state: InboxState,
{
- userId,
+ userID,
inboxSummary,
}: {
- userId: PrincipalId;
+ userID: PrincipalID;
inboxSummary: InboxSummary;
}
) {
- state.inboxSummaryByUser.set(userId, inboxSummary);
+ state.inboxSummaryByUser.set(userID, inboxSummary);
},
- updateInboxById(
+ updateInboxByID(
state: InboxState,
{
- inboxId,
+ inboxID,
inbox,
}: {
- inboxId: InboxId;
+ inboxID: InboxID;
inbox: Inbox;
}
) {
for (let [_, inboxList] of state.inboxListByUser) {
- const i = inboxList.findIndex((item: Inbox) => item.id == inboxId);
+ const i = inboxList.findIndex((item: Inbox) => item.id == inboxID);
if (i >= 0) {
inboxList[i] = inbox;
}
diff --git a/frontend/src/store/modules/instance.ts b/frontend/src/store/modules/instance.ts
index a934070f7f..268370931d 100644
--- a/frontend/src/store/modules/instance.ts
+++ b/frontend/src/store/modules/instance.ts
@@ -4,16 +4,16 @@ import {
empty,
EMPTY_ID,
Environment,
- EnvironmentId,
+ EnvironmentID,
Instance,
InstanceCreate,
- InstanceId,
+ InstanceID,
InstanceMigration,
InstancePatch,
InstanceState,
INSTANCE_OPERATION_TIMEOUT,
MigrationHistory,
- MigrationHistoryId,
+ MigrationHistoryID,
ResourceIdentifier,
ResourceObject,
RowStatus,
@@ -27,16 +27,16 @@ function convert(
includedList: ResourceObject[],
rootGetters: any
): Instance {
- const environmentId = (
+ const environmentID = (
instance.relationships!.environment.data as ResourceIdentifier
).id;
let environment: Environment = unknown("ENVIRONMENT") as Environment;
- environment.id = parseInt(environmentId);
+ environment.id = parseInt(environmentID);
- const anomalyIdList = instance.relationships!.anomaly
+ const anomalyIDList = instance.relationships!.anomaly
.data as ResourceIdentifier[];
const anomalyList: Anomaly[] = [];
- for (const item of anomalyIdList) {
+ for (const item of anomalyIDList) {
const anomaly = unknown("ANOMALY") as Anomaly;
anomaly.id = parseInt(item.id);
anomalyList.push(anomaly);
@@ -63,7 +63,7 @@ function convert(
if (
item.type == "anomaly" &&
- item.attributes.instanceId == instancePartial.id
+ item.attributes.instanceID == instancePartial.id
) {
const i = anomalyList.findIndex(
(anomaly: Anomaly) => parseInt(item.id) == anomaly.id
@@ -109,21 +109,21 @@ function convertMigrationHistory(history: ResourceObject): MigrationHistory {
return {
...(history.attributes as Omit<
MigrationHistory,
- "id" | "issueId" | "payload"
+ "id" | "issueID" | "payload"
>),
id: parseInt(history.id),
- // This issueId is special since it's stored in the migration history table
- // and may refer to the issueId from the external system in the future.
- issueId: parseInt(history.attributes.issueId as string),
+ // This issueID is special since it's stored in the migration history table
+ // and may refer to the issueID from the external system in the future.
+ issueID: parseInt(history.attributes.issueID as string),
payload,
};
}
const state: () => InstanceState = () => ({
- instanceById: new Map(),
- instanceUserListById: new Map(),
- migrationHistoryById: new Map(),
- migrationHistoryListByIdAndDatabaseName: new Map(),
+ instanceByID: new Map(),
+ instanceUserListByID: new Map(),
+ migrationHistoryByID: new Map(),
+ migrationHistoryListByIDAndDatabaseName: new Map(),
});
const getters = {
@@ -137,7 +137,7 @@ const getters = {
(state: InstanceState) =>
(rowStatusList?: RowStatus[]): Instance[] => {
const list = [];
- for (const [_, instance] of state.instanceById) {
+ for (const [_, instance] of state.instanceByID) {
if (
(!rowStatusList && instance.rowStatus == "NORMAL") ||
(rowStatusList && rowStatusList.includes(instance.rowStatus))
@@ -150,45 +150,45 @@ const getters = {
});
},
- instanceListByEnvironmentId:
+ instanceListByEnvironmentID:
(state: InstanceState, getters: any) =>
- (environmentId: EnvironmentId, rowStatusList?: RowStatus[]): Instance[] => {
+ (environmentID: EnvironmentID, rowStatusList?: RowStatus[]): Instance[] => {
const list = getters["instanceList"](rowStatusList);
return list.filter((item: Instance) => {
- return item.environment.id == environmentId;
+ return item.environment.id == environmentID;
});
},
- instanceById:
+ instanceByID:
(state: InstanceState) =>
- (instanceId: InstanceId): Instance => {
- if (instanceId == EMPTY_ID) {
+ (instanceID: InstanceID): Instance => {
+ if (instanceID == EMPTY_ID) {
return empty("INSTANCE") as Instance;
}
return (
- state.instanceById.get(instanceId) || (unknown("INSTANCE") as Instance)
+ state.instanceByID.get(instanceID) || (unknown("INSTANCE") as Instance)
);
},
- instanceUserListById:
+ instanceUserListByID:
(state: InstanceState) =>
- (instanceId: InstanceId): InstanceUser[] => {
- return state.instanceUserListById.get(instanceId) || [];
+ (instanceID: InstanceID): InstanceUser[] => {
+ return state.instanceUserListByID.get(instanceID) || [];
},
- migrationHistoryById:
+ migrationHistoryByID:
(state: InstanceState) =>
- (migrationHistoryId: MigrationHistoryId): MigrationHistory | undefined => {
- return state.migrationHistoryById.get(migrationHistoryId);
+ (migrationHistoryID: MigrationHistoryID): MigrationHistory | undefined => {
+ return state.migrationHistoryByID.get(migrationHistoryID);
},
- migrationHistoryListByInstanceIdAndDatabaseName:
+ migrationHistoryListByInstanceIDAndDatabaseName:
(state: InstanceState) =>
- (instanceId: InstanceId, databaseName: string): MigrationHistory[] => {
+ (instanceID: InstanceID, databaseName: string): MigrationHistory[] => {
return (
- state.migrationHistoryListByIdAndDatabaseName.get(
- [instanceId, databaseName].join(".")
+ state.migrationHistoryListByIDAndDatabaseName.get(
+ [instanceID, databaseName].join(".")
) || []
);
},
@@ -212,15 +212,15 @@ const actions = {
return instanceList;
},
- async fetchInstanceById(
+ async fetchInstanceByID(
{ commit, rootGetters }: any,
- instanceId: InstanceId
+ instanceID: InstanceID
) {
- const data = (await axios.get(`/api/instance/${instanceId}`)).data;
+ const data = (await axios.get(`/api/instance/${instanceID}`)).data;
const instance = convert(data.data, data.included, rootGetters);
- commit("setInstanceById", {
- instanceId,
+ commit("setInstanceByID", {
+ instanceID,
instance,
});
return instance;
@@ -246,8 +246,8 @@ const actions = {
).data;
const createdInstance = convert(data.data, data.included, rootGetters);
- commit("setInstanceById", {
- instanceId: createdInstance.id,
+ commit("setInstanceByID", {
+ instanceID: createdInstance.id,
instance: createdInstance,
});
@@ -257,16 +257,16 @@ const actions = {
async patchInstance(
{ commit, rootGetters }: any,
{
- instanceId,
+ instanceID,
instancePatch,
}: {
- instanceId: InstanceId;
+ instanceID: InstanceID;
instancePatch: InstancePatch;
}
) {
const data = (
await axios.patch(
- `/api/instance/${instanceId}`,
+ `/api/instance/${instanceID}`,
{
data: {
type: "instancePatch",
@@ -280,34 +280,34 @@ const actions = {
).data;
const updatedInstance = convert(data.data, data.included, rootGetters);
- commit("setInstanceById", {
- instanceId: updatedInstance.id,
+ commit("setInstanceByID", {
+ instanceID: updatedInstance.id,
instance: updatedInstance,
});
return updatedInstance;
},
- async deleteInstanceById(
+ async deleteInstanceByID(
{ commit }: { state: InstanceState; commit: any },
- instanceId: InstanceId
+ instanceID: InstanceID
) {
- await axios.delete(`/api/instance/${instanceId}`);
+ await axios.delete(`/api/instance/${instanceID}`);
- commit("deleteInstanceById", instanceId);
+ commit("deleteInstanceByID", instanceID);
},
- async fetchInstanceUserListById(
+ async fetchInstanceUserListByID(
{ commit, rootGetters }: any,
- instanceId: InstanceId
+ instanceID: InstanceID
) {
- const data = (await axios.get(`/api/instance/${instanceId}/user`)).data;
+ const data = (await axios.get(`/api/instance/${instanceID}/user`)).data;
const instanceUserList = data.data.map((instanceUser: ResourceObject) => {
return convertUser(instanceUser, data.included, rootGetters);
});
- commit("setInstanceUserListById", {
- instanceId,
+ commit("setInstanceUserListByID", {
+ instanceID,
instanceUserList,
});
return instanceUserList;
@@ -315,10 +315,10 @@ const actions = {
async checkMigrationSetup(
{}: any,
- instanceId: InstanceId
+ instanceID: InstanceID
): Promise<InstanceMigration> {
const data = (
- await axios.get(`/api/instance/${instanceId}/migration/status`, {
+ await axios.get(`/api/instance/${instanceID}/migration/status`, {
timeout: INSTANCE_OPERATION_TIMEOUT,
})
).data.data;
@@ -331,10 +331,10 @@ const actions = {
async createMigrationSetup(
{ rootGetters }: any,
- instanceId: InstanceId
+ instanceID: InstanceID
): Promise<SqlResultSet> {
const data = (
- await axios.post(`/api/instance/${instanceId}/migration`, undefined, {
+ await axios.post(`/api/instance/${instanceID}/migration`, undefined, {
timeout: INSTANCE_OPERATION_TIMEOUT,
})
).data.data;
@@ -342,19 +342,19 @@ const actions = {
return rootGetters["sql/convert"](data);
},
- async fetchMigrationHistoryById(
+ async fetchMigrationHistoryByID(
{ commit, rootGetters }: any,
{
- instanceId,
- migrationHistoryId,
+ instanceID,
+ migrationHistoryID,
}: {
- instanceId: InstanceId;
- migrationHistoryId: MigrationHistoryId;
+ instanceID: InstanceID;
+ migrationHistoryID: MigrationHistoryID;
}
) {
const data = (
await axios.get(
- `/api/instance/${instanceId}/migration/history/${migrationHistoryId}`,
+ `/api/instance/${instanceID}/migration/history/${migrationHistoryID}`,
{
timeout: INSTANCE_OPERATION_TIMEOUT,
}
@@ -362,8 +362,8 @@ const actions = {
).data;
const migrationHistory = convertMigrationHistory(data.data);
- commit("setMigrationHistoryById", {
- migrationHistoryId,
+ commit("setMigrationHistoryByID", {
+ migrationHistoryID,
migrationHistory,
});
return migrationHistory;
@@ -372,18 +372,18 @@ const actions = {
async fetchMigrationHistoryByVersion(
{ commit }: any,
{
- instanceId,
+ instanceID,
databaseName,
version,
}: {
- instanceId: InstanceId;
+ instanceID: InstanceID;
databaseName: string;
version: string;
}
) {
const data = (
await axios.get(
- `/api/instance/${instanceId}/migration/history?database=${databaseName}&version=${version}`,
+ `/api/instance/${instanceID}/migration/history?database=${databaseName}&version=${version}`,
{
timeout: INSTANCE_OPERATION_TIMEOUT,
}
@@ -394,8 +394,8 @@ const actions = {
});
if (historyList.length > 0) {
- commit("setMigrationHistoryById", {
- migrationHistoryId: historyList[0].id,
+ commit("setMigrationHistoryByID", {
+ migrationHistoryID: historyList[0].id,
migrationHistory: historyList[0],
});
return historyList[0];
@@ -408,16 +408,16 @@ const actions = {
async fetchMigrationHistory(
{ commit }: any,
{
- instanceId,
+ instanceID,
databaseName,
limit,
}: {
- instanceId: InstanceId;
+ instanceID: InstanceID;
databaseName: string;
limit?: number;
}
): Promise<MigrationHistory> {
- var url = `/api/instance/${instanceId}/migration/history?database=${databaseName}`;
+ var url = `/api/instance/${instanceID}/migration/history?database=${databaseName}`;
if (limit) {
url += `&limit=${limit}`;
}
@@ -430,8 +430,8 @@ const actions = {
return convertMigrationHistory(history);
});
- commit("setMigrationHistoryListByInstanceIdAndDatabaseName", {
- instanceId,
+ commit("setMigrationHistoryListByInstanceIDAndDatabaseName", {
+ instanceID,
databaseName,
historyList,
});
@@ -443,67 +443,67 @@ const actions = {
const mutations = {
setInstanceList(state: InstanceState, instanceList: Instance[]) {
instanceList.forEach((instance) => {
- state.instanceById.set(instance.id, instance);
+ state.instanceByID.set(instance.id, instance);
});
},
- setInstanceById(
+ setInstanceByID(
state: InstanceState,
{
- instanceId,
+ instanceID,
instance,
}: {
- instanceId: InstanceId;
+ instanceID: InstanceID;
instance: Instance;
}
) {
- state.instanceById.set(instanceId, instance);
+ state.instanceByID.set(instanceID, instance);
},
- deleteInstanceById(state: InstanceState, instanceId: InstanceId) {
- state.instanceById.delete(instanceId);
+ deleteInstanceByID(state: InstanceState, instanceID: InstanceID) {
+ state.instanceByID.delete(instanceID);
},
- setInstanceUserListById(
+ setInstanceUserListByID(
state: InstanceState,
{
- instanceId,
+ instanceID,
instanceUserList,
}: {
- instanceId: InstanceId;
+ instanceID: InstanceID;
instanceUserList: InstanceUser[];
}
) {
- state.instanceUserListById.set(instanceId, instanceUserList);
+ state.instanceUserListByID.set(instanceID, instanceUserList);
},
- setMigrationHistoryById(
+ setMigrationHistoryByID(
state: InstanceState,
{
- migrationHistoryId,
+ migrationHistoryID,
migrationHistory,
}: {
- migrationHistoryId: MigrationHistoryId;
+ migrationHistoryID: MigrationHistoryID;
migrationHistory: MigrationHistory;
}
) {
- state.migrationHistoryById.set(migrationHistoryId, migrationHistory);
+ state.migrationHistoryByID.set(migrationHistoryID, migrationHistory);
},
- setMigrationHistoryListByInstanceIdAndDatabaseName(
+ setMigrationHistoryListByInstanceIDAndDatabaseName(
state: InstanceState,
{
- instanceId,
+ instanceID,
databaseName,
historyList,
}: {
- instanceId: InstanceId;
+ instanceID: InstanceID;
databaseName: string;
historyList: MigrationHistory[];
}
) {
- state.migrationHistoryListByIdAndDatabaseName.set(
- [instanceId, databaseName].join("."),
+ state.migrationHistoryListByIDAndDatabaseName.set(
+ [instanceID, databaseName].join("."),
historyList
);
},
diff --git a/frontend/src/store/modules/issue.ts b/frontend/src/store/modules/issue.ts
index 51143723ea..138fd90719 100644
--- a/frontend/src/store/modules/issue.ts
+++ b/frontend/src/store/modules/issue.ts
@@ -4,15 +4,15 @@ import {
EMPTY_ID,
Issue,
IssueCreate,
- IssueId,
+ IssueID,
IssuePatch,
IssueState,
IssueStatus,
IssueStatusPatch,
Pipeline,
- PrincipalId,
+ PrincipalID,
Project,
- ProjectId,
+ ProjectID,
ResourceIdentifier,
ResourceObject,
unknown,
@@ -23,15 +23,15 @@ function convert(
includedList: ResourceObject[],
rootGetters: any
): Issue {
- const projectId = (issue.relationships!.project.data as ResourceIdentifier)
+ const projectID = (issue.relationships!.project.data as ResourceIdentifier)
.id;
let project: Project = unknown("PROJECT") as Project;
- project.id = parseInt(projectId);
+ project.id = parseInt(projectID);
- const pipelineId = (issue.relationships!.pipeline.data as ResourceIdentifier)
+ const pipelineID = (issue.relationships!.pipeline.data as ResourceIdentifier)
.id;
let pipeline = unknown("PIPELINE") as Pipeline;
- pipeline.id = parseInt(pipelineId);
+ pipeline.id = parseInt(pipelineID);
for (const item of includedList || []) {
if (
@@ -59,18 +59,18 @@ function convert(
}
const state: () => IssueState = () => ({
- issueById: new Map(),
+ issueByID: new Map(),
});
const getters = {
- issueById:
+ issueByID:
(state: IssueState) =>
- (issueId: IssueId): Issue => {
- if (issueId == EMPTY_ID) {
+ (issueID: IssueID): Issue => {
+ if (issueID == EMPTY_ID) {
return empty("ISSUE") as Issue;
}
- return state.issueById.get(issueId) || (unknown("ISSUE") as Issue);
+ return state.issueByID.get(issueID) || (unknown("ISSUE") as Issue);
},
};
@@ -79,13 +79,13 @@ const actions = {
{ rootGetters }: any,
{
issueStatusList,
- userId,
- projectId,
+ userID,
+ projectID,
limit,
}: {
issueStatusList?: IssueStatus[];
- userId?: PrincipalId;
- projectId?: ProjectId;
+ userID?: PrincipalID;
+ projectID?: ProjectID;
limit?: number;
}
) {
@@ -93,11 +93,11 @@ const actions = {
if (issueStatusList) {
queryList.push(`status=${issueStatusList.join(",")}`);
}
- if (userId) {
- queryList.push(`user=${userId}`);
+ if (userID) {
+ queryList.push(`user=${userID}`);
}
- if (projectId) {
- queryList.push(`project=${projectId}`);
+ if (projectID) {
+ queryList.push(`project=${projectID}`);
}
if (limit) {
queryList.push(`limit=${limit}`);
@@ -115,11 +115,11 @@ const actions = {
return issueList;
},
- async fetchIssueById({ commit, rootGetters }: any, issueId: IssueId) {
- const data = (await axios.get(`/api/issue/${issueId}`)).data;
+ async fetchIssueByID({ commit, rootGetters }: any, issueID: IssueID) {
+ const data = (await axios.get(`/api/issue/${issueID}`)).data;
const issue = convert(data.data, data.included, rootGetters);
- commit("setIssueById", {
- issueId,
+ commit("setIssueByID", {
+ issueID,
issue,
});
@@ -132,9 +132,9 @@ const actions = {
for (const stage of issue.pipeline.stageList) {
for (const task of stage.taskList) {
commit(
- "instance/setInstanceById",
+ "instance/setInstanceByID",
{
- instanceId: task.instance.id,
+ instanceID: task.instance.id,
instance: task.instance,
},
{ root: true }
@@ -169,8 +169,8 @@ const actions = {
).data;
const createdIssue = convert(data.data, data.included, rootGetters);
- commit("setIssueById", {
- issueId: createdIssue.id,
+ commit("setIssueByID", {
+ issueID: createdIssue.id,
issue: createdIssue,
});
@@ -180,15 +180,15 @@ const actions = {
async patchIssue(
{ commit, dispatch, rootGetters }: any,
{
- issueId,
+ issueID,
issuePatch,
}: {
- issueId: IssueId;
+ issueID: IssueID;
issuePatch: IssuePatch;
}
) {
const data = (
- await axios.patch(`/api/issue/${issueId}`, {
+ await axios.patch(`/api/issue/${issueID}`, {
data: {
type: "issuePatch",
attributes: issuePatch,
@@ -197,12 +197,12 @@ const actions = {
).data;
const updatedIssue = convert(data.data, data.included, rootGetters);
- commit("setIssueById", {
- issueId: issueId,
+ commit("setIssueByID", {
+ issueID: issueID,
issue: updatedIssue,
});
- dispatch("activity/fetchActivityListForIssue", issueId, { root: true });
+ dispatch("activity/fetchActivityListForIssue", issueID, { root: true });
return updatedIssue;
},
@@ -210,15 +210,15 @@ const actions = {
async updateIssueStatus(
{ commit, dispatch, rootGetters }: any,
{
- issueId,
+ issueID,
issueStatusPatch,
}: {
- issueId: IssueId;
+ issueID: IssueID;
issueStatusPatch: IssueStatusPatch;
}
) {
const data = (
- await axios.patch(`/api/issue/${issueId}/status`, {
+ await axios.patch(`/api/issue/${issueID}/status`, {
data: {
type: "issueStatusPatch",
attributes: issueStatusPatch,
@@ -227,29 +227,29 @@ const actions = {
).data;
const updatedIssue = convert(data.data, data.included, rootGetters);
- commit("setIssueById", {
- issueId: issueId,
+ commit("setIssueByID", {
+ issueID: issueID,
issue: updatedIssue,
});
- dispatch("activity/fetchActivityListForIssue", issueId, { root: true });
+ dispatch("activity/fetchActivityListForIssue", issueID, { root: true });
return updatedIssue;
},
};
const mutations = {
- setIssueById(
+ setIssueByID(
state: IssueState,
{
- issueId,
+ issueID,
issue,
}: {
- issueId: IssueId;
+ issueID: IssueID;
issue: Issue;
}
) {
- state.issueById.set(issueId, issue);
+ state.issueByID.set(issueID, issue);
},
};
diff --git a/frontend/src/store/modules/issueSubscriber.ts b/frontend/src/store/modules/issueSubscriber.ts
index e8d045293b..0ae2aa774f 100644
--- a/frontend/src/store/modules/issueSubscriber.ts
+++ b/frontend/src/store/modules/issueSubscriber.ts
@@ -1,11 +1,11 @@
import axios from "axios";
import {
- PrincipalId,
+ PrincipalID,
IssueSubscriber,
IssueSubscriberState,
ResourceObject,
Principal,
- IssueId,
+ IssueID,
} from "../../types";
function convert(
@@ -13,7 +13,7 @@ function convert(
rootGetters: any
): IssueSubscriber {
return {
- issueId: issueSubscriber.attributes.issueId as IssueId,
+ issueID: issueSubscriber.attributes.issueID as IssueID,
subscriber: issueSubscriber.attributes.subscriber as Principal,
};
}
@@ -25,23 +25,23 @@ const state: () => IssueSubscriberState = () => ({
const getters = {
subscriberListByIssue:
(state: IssueSubscriberState) =>
- (issueId: IssueId): IssueSubscriber[] => {
- return state.subscriberListByIssue.get(issueId) || [];
+ (issueID: IssueID): IssueSubscriber[] => {
+ return state.subscriberListByIssue.get(issueID) || [];
},
};
const actions = {
async fetchSubscriberListByIssue(
{ commit, rootGetters }: any,
- issueId: IssueId
+ issueID: IssueID
) {
const subscriberList = (
- await axios.get(`/api/issue/${issueId}/subscriber`)
+ await axios.get(`/api/issue/${issueID}/subscriber`)
).data.data.map((issueSubscriber: ResourceObject) => {
return convert(issueSubscriber, rootGetters);
});
- commit("setSubscriberListByIssueId", {
- issueId,
+ commit("setSubscriberListByIssueID", {
+ issueID,
subscriberList,
});
return subscriberList;
@@ -50,20 +50,20 @@ const actions = {
async createSubscriber(
{ commit, rootGetters }: any,
{
- issueId,
- subscriberId,
+ issueID,
+ subscriberID,
}: {
- issueId: IssueId;
- subscriberId: PrincipalId;
+ issueID: IssueID;
+ subscriberID: PrincipalID;
}
) {
const createdIssueSubscriber = convert(
(
- await axios.post(`/api/issue/${issueId}/subscriber`, {
+ await axios.post(`/api/issue/${issueID}/subscriber`, {
data: {
type: "issueSubscriber",
attributes: {
- subscriberId,
+ subscriberID,
},
},
})
@@ -71,8 +71,8 @@ const actions = {
rootGetters
);
- commit("upsertSubsriberListByIssueId", {
- issueId,
+ commit("upsertSubsriberListByIssueID", {
+ issueID,
subscriber: createdIssueSubscriber,
});
@@ -82,44 +82,44 @@ const actions = {
async deleteSubscriber(
{ commit }: any,
{
- issueId,
- subscriberId,
+ issueID,
+ subscriberID,
}: {
- issueId: IssueId;
- subscriberId: PrincipalId;
+ issueID: IssueID;
+ subscriberID: PrincipalID;
}
) {
- await axios.delete(`/api/issue/${issueId}/subscriber/${subscriberId}`);
+ await axios.delete(`/api/issue/${issueID}/subscriber/${subscriberID}`);
- commit("deleteIssueSubscriberByIssueId", { issueId, subscriberId });
+ commit("deleteIssueSubscriberByIssueID", { issueID, subscriberID });
},
};
const mutations = {
- setSubscriberListByIssueId(
+ setSubscriberListByIssueID(
state: IssueSubscriberState,
{
- issueId,
+ issueID,
subscriberList,
}: {
- issueId: IssueId;
+ issueID: IssueID;
subscriberList: IssueSubscriber[];
}
) {
- state.subscriberListByIssue.set(issueId, subscriberList);
+ state.subscriberListByIssue.set(issueID, subscriberList);
},
- upsertSubsriberListByIssueId(
+ upsertSubsriberListByIssueID(
state: IssueSubscriberState,
{
- issueId,
+ issueID,
subscriber,
}: {
- issueId: IssueId;
+ issueID: IssueID;
subscriber: IssueSubscriber;
}
) {
- const list = state.subscriberListByIssue.get(issueId);
+ const list = state.subscriberListByIssue.get(issueID);
if (list) {
const i = list.findIndex(
(item: IssueSubscriber) =>
@@ -131,24 +131,24 @@ const mutations = {
list.push(subscriber);
}
} else {
- state.subscriberListByIssue.set(issueId, [subscriber]);
+ state.subscriberListByIssue.set(issueID, [subscriber]);
}
},
- deleteIssueSubscriberByIssueId(
+ deleteIssueSubscriberByIssueID(
state: IssueSubscriberState,
{
- issueId,
- subscriberId,
+ issueID,
+ subscriberID,
}: {
- issueId: IssueId;
- subscriberId: PrincipalId;
+ issueID: IssueID;
+ subscriberID: PrincipalID;
}
) {
- const list = state.subscriberListByIssue.get(issueId);
+ const list = state.subscriberListByIssue.get(issueID);
if (list) {
const i = list.findIndex(
- (item: IssueSubscriber) => item.subscriber.id == subscriberId
+ (item: IssueSubscriber) => item.subscriber.id == subscriberID
);
if (i != -1) {
list.splice(i, 1);
diff --git a/frontend/src/store/modules/member.ts b/frontend/src/store/modules/member.ts
index fb5386621d..1272370c1f 100644
--- a/frontend/src/store/modules/member.ts
+++ b/frontend/src/store/modules/member.ts
@@ -1,12 +1,12 @@
import axios from "axios";
import {
Member,
- MemberId,
+ MemberID,
MemberCreate,
MemberPatch,
MemberState,
ResourceObject,
- PrincipalId,
+ PrincipalID,
unknown,
empty,
EMPTY_ID,
@@ -38,9 +38,9 @@ const getters = {
return state.memberList;
},
- memberByPrincipalId:
+ memberByPrincipalID:
(state: MemberState) =>
- (id: PrincipalId): Member => {
+ (id: PrincipalID): Member => {
if (id == EMPTY_ID) {
return empty("MEMBER") as Member;
}
@@ -72,7 +72,7 @@ const actions = {
return memberList;
},
- // Returns existing member if the principalId has already been created.
+ // Returns existing member if the principalID has already been created.
async createdMember({ commit, rootGetters }: any, newMember: MemberCreate) {
const data = (
await axios.post(`/api/member`, {
@@ -91,7 +91,7 @@ const actions = {
async patchMember(
{ commit, rootGetters }: any,
- { id, memberPatch }: { id: MemberId; memberPatch: MemberPatch }
+ { id, memberPatch }: { id: MemberID; memberPatch: MemberPatch }
) {
const data = (
await axios.patch(`/api/member/${id}`, {
@@ -108,9 +108,9 @@ const actions = {
return updatedMember;
},
- async deleteMemberById(
+ async deleteMemberByID(
{ state, commit }: { state: MemberState; commit: any },
- id: MemberId
+ id: MemberID
) {
await axios.delete(`/api/member/${id}`);
diff --git a/frontend/src/store/modules/pipeline.ts b/frontend/src/store/modules/pipeline.ts
index e5b6318dad..f8b84e88a6 100644
--- a/frontend/src/store/modules/pipeline.ts
+++ b/frontend/src/store/modules/pipeline.ts
@@ -15,10 +15,10 @@ function convert(
rootGetters: any
): Pipeline {
const stageList: Stage[] = [];
- const stageIdList = pipeline.relationships!.stage
+ const stageIDList = pipeline.relationships!.stage
.data as ResourceIdentifier[];
- // Needs to iterate through stageIdList to maintain the order
- for (const idItem of stageIdList) {
+ // Needs to iterate through stageIDList to maintain the order
+ for (const idItem of stageIDList) {
for (const item of includedList || []) {
if (item.type == "stage") {
if (idItem.id == item.id) {
diff --git a/frontend/src/store/modules/policy.ts b/frontend/src/store/modules/policy.ts
index b6214ab1c3..25f57f85c1 100644
--- a/frontend/src/store/modules/policy.ts
+++ b/frontend/src/store/modules/policy.ts
@@ -1,7 +1,7 @@
import axios from "axios";
import {
Environment,
- EnvironmentId,
+ EnvironmentID,
PolicyState,
ResourceIdentifier,
ResourceObject,
@@ -14,11 +14,11 @@ function convert(
includedList: ResourceObject[],
rootGetters: any
): Policy {
- const environmentId = (
+ const environmentID = (
policy.relationships!.environment.data as ResourceIdentifier
).id;
let environment: Environment = unknown("ENVIRONMENT") as Environment;
- environment.id = parseInt(environmentId);
+ environment.id = parseInt(environmentID);
for (const item of includedList || []) {
if (
@@ -39,14 +39,14 @@ function convert(
}
const state: () => PolicyState = () => ({
- policyMapByEnvironmentId: new Map(),
+ policyMapByEnvironmentID: new Map(),
});
const getters = {
- policyByEnvironmentIdAndType:
+ policyByEnvironmentIDAndType:
(state: PolicyState) =>
- (environmentId: EnvironmentId, type: PolicyType): Policy | undefined => {
- const map = state.policyMapByEnvironmentId.get(environmentId);
+ (environmentID: EnvironmentID, type: PolicyType): Policy | undefined => {
+ const map = state.policyMapByEnvironmentID.get(environmentID);
if (map) {
return map.get(type);
}
@@ -57,13 +57,13 @@ const getters = {
const actions = {
async fetchPolicyByEnvironmentAndType(
{ commit, rootGetters }: any,
- { environmentId, type }: { environmentId: EnvironmentId; type: PolicyType }
+ { environmentID, type }: { environmentID: EnvironmentID; type: PolicyType }
): Promise<Policy> {
const data = (
- await axios.get(`/api/policy/environment/${environmentId}?type=${type}`)
+ await axios.get(`/api/policy/environment/${environmentID}?type=${type}`)
).data;
const policy = convert(data.data, data.included, rootGetters);
- commit("setPolicyByEnvironmentId", { environmentId, policy });
+ commit("setPolicyByEnvironmentID", { environmentID, policy });
return policy;
},
@@ -71,18 +71,18 @@ const actions = {
async upsertPolicyByEnvironmentAndType(
{ commit, rootGetters }: any,
{
- environmentId,
+ environmentID,
type,
policyUpsert,
}: {
- environmentId: EnvironmentId;
+ environmentID: EnvironmentID;
type: PolicyType;
policyUpsert: PolicyUpsert;
}
): Promise<Policy> {
const data = (
await axios.patch(
- `/api/policy/environment/${environmentId}?type=${type}`,
+ `/api/policy/environment/${environmentID}?type=${type}`,
{
data: {
type: "policyUpsert",
@@ -95,29 +95,29 @@ const actions = {
).data;
const policy = convert(data.data, data.included, rootGetters);
- commit("setPolicyByEnvironmentId", { environmentId, policy });
+ commit("setPolicyByEnvironmentID", { environmentID, policy });
return policy;
},
};
const mutations = {
- setPolicyByEnvironmentId(
+ setPolicyByEnvironmentID(
state: PolicyState,
{
- environmentId,
+ environmentID,
policy,
}: {
- environmentId: EnvironmentId;
+ environmentID: EnvironmentID;
policy: Policy;
}
) {
- const map = state.policyMapByEnvironmentId.get(environmentId);
+ const map = state.policyMapByEnvironmentID.get(environmentID);
if (map) {
map.set(policy.type, policy);
} else {
- state.policyMapByEnvironmentId.set(
- environmentId,
+ state.policyMapByEnvironmentID.set(
+ environmentID,
new Map([[policy.type, policy]])
);
}
diff --git a/frontend/src/store/modules/principal.ts b/frontend/src/store/modules/principal.ts
index 50e3a50dbc..d171e0eba5 100644
--- a/frontend/src/store/modules/principal.ts
+++ b/frontend/src/store/modules/principal.ts
@@ -1,6 +1,6 @@
import axios from "axios";
import {
- PrincipalId,
+ PrincipalID,
Principal,
PrincipalCreate,
PrincipalPatch,
@@ -17,9 +17,9 @@ import { randomString } from "../../utils";
function convert(principal: ResourceObject): Principal {
return {
id: parseInt(principal.id),
- creatorId: principal.attributes.creatorId as PrincipalId,
+ creatorID: principal.attributes.creatorID as PrincipalID,
createdTs: principal.attributes.createdTs as number,
- updaterId: principal.attributes.updaterId as PrincipalId,
+ updaterID: principal.attributes.updaterID as PrincipalID,
updatedTs: principal.attributes.updatedTs as number,
type: principal.attributes.type as PrincipalType,
name: principal.attributes.name as string,
@@ -43,15 +43,15 @@ const getters = {
return state.principalList;
},
- principalById:
+ principalByID:
(state: PrincipalState) =>
- (principalId: PrincipalId): Principal => {
- if (principalId == EMPTY_ID) {
+ (principalID: PrincipalID): Principal => {
+ if (principalID == EMPTY_ID) {
return empty("PRINCIPAL") as Principal;
}
return (
- state.principalList.find((item) => item.id == principalId) ||
+ state.principalList.find((item) => item.id == principalID) ||
(unknown("PRINCIPAL") as Principal)
);
},
@@ -70,9 +70,9 @@ const actions = {
return principalList;
},
- async fetchPrincipalById({ commit }: any, principalId: PrincipalId) {
+ async fetchPrincipalByID({ commit }: any, principalID: PrincipalID) {
const principal = convert(
- (await axios.get(`/api/principal/${principalId}`)).data.data
+ (await axios.get(`/api/principal/${principalID}`)).data.data
);
commit("upsertPrincipalInList", principal);
@@ -105,16 +105,16 @@ const actions = {
async patchPrincipal(
{ commit, dispatch }: any,
{
- principalId,
+ principalID,
principalPatch,
}: {
- principalId: PrincipalId;
+ principalID: PrincipalID;
principalPatch: PrincipalPatch;
}
) {
const updatedPrincipal = convert(
(
- await axios.patch(`/api/principal/${principalId}`, {
+ await axios.patch(`/api/principal/${principalID}`, {
data: {
type: "principalPatch",
attributes: principalPatch,
diff --git a/frontend/src/store/modules/project.ts b/frontend/src/store/modules/project.ts
index 2ef956ecd9..77115130b1 100644
--- a/frontend/src/store/modules/project.ts
+++ b/frontend/src/store/modules/project.ts
@@ -2,12 +2,12 @@ import axios from "axios";
import {
empty,
EMPTY_ID,
- MemberId,
+ MemberID,
Principal,
- PrincipalId,
+ PrincipalID,
Project,
ProjectCreate,
- ProjectId,
+ ProjectID,
ProjectMember,
ProjectMemberCreate,
ProjectMemberPatch,
@@ -44,9 +44,9 @@ function convert(
const memberList: ProjectMember[] = [];
for (const item of includedList || []) {
if (item.type == "projectMember") {
- const projectMemberIdList = project.relationships!.projectMember
+ const projectMemberIDList = project.relationships!.projectMember
.data as ResourceIdentifier[];
- for (const idItem of projectMemberIdList) {
+ for (const idItem of projectMemberIDList) {
if (idItem.id == item.id) {
const member = convertMember(item, includedList, rootGetters);
member.project = projectWithoutMemberList;
@@ -92,7 +92,7 @@ function convertMember(
}
const state: () => ProjectState = () => ({
- projectById: new Map(),
+ projectByID: new Map(),
});
const getters = {
@@ -104,15 +104,15 @@ const getters = {
projectListByUser:
(state: ProjectState) =>
- (userId: PrincipalId, rowStatusList?: RowStatus[]): Project[] => {
+ (userID: PrincipalID, rowStatusList?: RowStatus[]): Project[] => {
const result: Project[] = [];
- for (const [_, project] of state.projectById) {
+ for (const [_, project] of state.projectByID) {
if (
(!rowStatusList && project.rowStatus == "NORMAL") ||
(rowStatusList && rowStatusList.includes(project.rowStatus))
) {
for (const member of project.memberList) {
- if (member.principal.id == userId) {
+ if (member.principal.id == userID) {
result.push(project);
break;
}
@@ -123,15 +123,15 @@ const getters = {
return result;
},
- projectById:
+ projectByID:
(state: ProjectState) =>
- (projectId: ProjectId): Project => {
- if (projectId == EMPTY_ID) {
+ (projectID: ProjectID): Project => {
+ if (projectID == EMPTY_ID) {
return empty("PROJECT") as Project;
}
return (
- state.projectById.get(projectId) || (unknown("PROJECT") as Project)
+ state.projectByID.get(projectID) || (unknown("PROJECT") as Project)
);
},
};
@@ -150,15 +150,15 @@ const actions = {
async fetchProjectListByUser(
{ commit, rootGetters }: any,
{
- userId,
+ userID,
rowStatusList,
}: {
- userId: PrincipalId;
+ userID: PrincipalID;
rowStatusList?: RowStatus[];
}
) {
const path =
- `/api/project?user=${userId}` +
+ `/api/project?user=${userID}` +
(rowStatusList ? "&rowstatus=" + rowStatusList.join(",") : "");
const data = (await axios.get(`${path}`)).data;
const projectList = data.data.map((project: ResourceObject) => {
@@ -169,12 +169,12 @@ const actions = {
return projectList;
},
- async fetchProjectById({ commit, rootGetters }: any, projectId: ProjectId) {
- const data = (await axios.get(`/api/project/${projectId}`)).data;
+ async fetchProjectByID({ commit, rootGetters }: any, projectID: ProjectID) {
+ const data = (await axios.get(`/api/project/${projectID}`)).data;
const project = convert(data.data, data.included, rootGetters);
- commit("setProjectById", {
- projectId,
+ commit("setProjectByID", {
+ projectID,
project,
});
return project;
@@ -191,8 +191,8 @@ const actions = {
).data;
const createdProject = convert(data.data, data.included, rootGetters);
- commit("setProjectById", {
- projectId: createdProject.id,
+ commit("setProjectByID", {
+ projectID: createdProject.id,
project: createdProject,
});
@@ -202,15 +202,15 @@ const actions = {
async patchProject(
{ commit, rootGetters }: any,
{
- projectId,
+ projectID,
projectPatch,
}: {
- projectId: ProjectId;
+ projectID: ProjectID;
projectPatch: ProjectPatch;
}
) {
const data = (
- await axios.patch(`/api/project/${projectId}`, {
+ await axios.patch(`/api/project/${projectID}`, {
data: {
type: "projectPatch",
attributes: projectPatch,
@@ -219,8 +219,8 @@ const actions = {
).data;
const updatedProject = convert(data.data, data.included, rootGetters);
- commit("setProjectById", {
- projectId,
+ commit("setProjectByID", {
+ projectID,
project: updatedProject,
});
@@ -228,25 +228,25 @@ const actions = {
},
// Project Role Mapping
- // Returns existing member if the principalId has already been created.
+ // Returns existing member if the principalID has already been created.
async createdMember(
{ dispatch }: any,
{
- projectId,
+ projectID,
projectMember,
}: {
- projectId: ProjectId;
+ projectID: ProjectID;
projectMember: ProjectMemberCreate;
}
) {
- await axios.post(`/api/project/${projectId}/member`, {
+ await axios.post(`/api/project/${projectID}/member`, {
data: {
type: "projectMemberCreate",
attributes: projectMember,
},
});
- const updatedProject = await dispatch("fetchProjectById", projectId);
+ const updatedProject = await dispatch("fetchProjectByID", projectID);
return updatedProject;
},
@@ -254,23 +254,23 @@ const actions = {
async patchMember(
{ dispatch }: any,
{
- projectId,
- memberId,
+ projectID,
+ memberID,
projectMemberPatch,
}: {
- projectId: ProjectId;
- memberId: MemberId;
+ projectID: ProjectID;
+ memberID: MemberID;
projectMemberPatch: ProjectMemberPatch;
}
) {
- await axios.patch(`/api/project/${projectId}/member/${memberId}`, {
+ await axios.patch(`/api/project/${projectID}/member/${memberID}`, {
data: {
type: "projectMemberPatch",
attributes: projectMemberPatch,
},
});
- const updatedProject = await dispatch("fetchProjectById", projectId);
+ const updatedProject = await dispatch("fetchProjectByID", projectID);
return updatedProject;
},
@@ -279,7 +279,7 @@ const actions = {
await axios.delete(`/api/project/${member.project.id}/member/${member.id}`);
const updatedProject = await dispatch(
- "fetchProjectById",
+ "fetchProjectByID",
member.project.id
);
@@ -288,22 +288,22 @@ const actions = {
};
const mutations = {
- setProjectById(
+ setProjectByID(
state: ProjectState,
{
- projectId,
+ projectID,
project,
}: {
- projectId: ProjectId;
+ projectID: ProjectID;
project: Project;
}
) {
- state.projectById.set(projectId, project);
+ state.projectByID.set(projectID, project);
},
upsertProjectList(state: ProjectState, projectList: Project[]) {
for (const project of projectList) {
- state.projectById.set(project.id, project);
+ state.projectByID.set(project.id, project);
}
},
};
diff --git a/frontend/src/store/modules/projectWebhook.ts b/frontend/src/store/modules/projectWebhook.ts
index 2cf9630f55..3617902e70 100644
--- a/frontend/src/store/modules/projectWebhook.ts
+++ b/frontend/src/store/modules/projectWebhook.ts
@@ -1,9 +1,9 @@
import axios from "axios";
import {
- ProjectId,
+ ProjectID,
ProjectWebhook,
ProjectWebhookCreate,
- ProjectWebhookId,
+ ProjectWebhookID,
ProjectWebhookPatch,
ProjectWebhookState,
ProjectWebhookTestResult,
@@ -31,26 +31,26 @@ function convertTestResult(
}
const state: () => ProjectWebhookState = () => ({
- projectWebhookListByProjectId: new Map(),
+ projectWebhookListByProjectID: new Map(),
});
const getters = {
- projectWebhookListByProjectId:
+ projectWebhookListByProjectID:
(state: ProjectWebhookState) =>
- (projectId: ProjectId): ProjectWebhook[] => {
- return state.projectWebhookListByProjectId.get(projectId) || [];
+ (projectID: ProjectID): ProjectWebhook[] => {
+ return state.projectWebhookListByProjectID.get(projectID) || [];
},
- projectWebhookById:
+ projectWebhookByID:
(state: ProjectWebhookState) =>
(
- projectId: ProjectId,
- projectWebhookId: ProjectWebhookId
+ projectID: ProjectID,
+ projectWebhookID: ProjectWebhookID
): ProjectWebhook => {
- const list = state.projectWebhookListByProjectId.get(projectId);
+ const list = state.projectWebhookListByProjectID.get(projectID);
if (list) {
for (const hook of list) {
- if (hook.id == projectWebhookId) {
+ if (hook.id == projectWebhookID) {
return hook;
}
}
@@ -63,15 +63,15 @@ const actions = {
async createProjectWebhook(
{ commit, rootGetters }: any,
{
- projectId,
+ projectID,
projectWebhookCreate,
}: {
- projectId: ProjectId;
+ projectID: ProjectID;
projectWebhookCreate: ProjectWebhookCreate;
}
): Promise<ProjectWebhook> {
const data = (
- await axios.post(`/api/project/${projectId}/webhook`, {
+ await axios.post(`/api/project/${projectID}/webhook`, {
data: {
type: "projectWebhookCreate",
attributes: projectWebhookCreate,
@@ -84,71 +84,71 @@ const actions = {
rootGetters
);
- commit("upsertProjectWebhookByProjectId", {
- projectId,
+ commit("upsertProjectWebhookByProjectID", {
+ projectID,
projectWebhook: createdProjectWebhook,
});
return createdProjectWebhook;
},
- async fetchProjectWebhookListByProjectId(
+ async fetchProjectWebhookListByProjectID(
{ commit, rootGetters }: any,
- projectId: ProjectId
+ projectID: ProjectID
): Promise<ProjectWebhook[]> {
- const data = (await axios.get(`/api/project/${projectId}/webhook`)).data;
+ const data = (await axios.get(`/api/project/${projectID}/webhook`)).data;
const projectWebhookList = data.data.map(
(projectWebhook: ResourceObject) => {
return convert(projectWebhook, data.included, rootGetters);
}
);
- commit("setProjectWebhookListByProjectId", {
- projectId,
+ commit("setProjectWebhookListByProjectID", {
+ projectID,
projectWebhookList,
});
return projectWebhookList;
},
- async fetchProjectWebhookById(
+ async fetchProjectWebhookByID(
{ commit, rootGetters }: any,
{
- projectId,
- projectWebhookId,
+ projectID,
+ projectWebhookID,
}: {
- projectId: ProjectId;
- projectWebhookId: ProjectWebhookId;
+ projectID: ProjectID;
+ projectWebhookID: ProjectWebhookID;
}
): Promise<ProjectWebhook> {
const data = (
- await axios.get(`/api/project/${projectId}/webhook/${projectWebhookId}`)
+ await axios.get(`/api/project/${projectID}/webhook/${projectWebhookID}`)
).data;
const projectWebhook = convert(data.data, data.included, rootGetters);
- commit("upsertProjectWebhookByProjectId", {
- projectId,
+ commit("upsertProjectWebhookByProjectID", {
+ projectID,
projectWebhook,
});
return projectWebhook;
},
- async updateProjectWebhookById(
+ async updateProjectWebhookByID(
{ commit, rootGetters }: any,
{
- projectId,
- projectWebhookId,
+ projectID,
+ projectWebhookID,
projectWebhookPatch,
}: {
- projectId: ProjectId;
- projectWebhookId: ProjectWebhookId;
+ projectID: ProjectID;
+ projectWebhookID: ProjectWebhookID;
projectWebhookPatch: ProjectWebhookPatch;
}
) {
const data = (
await axios.patch(
- `/api/project/${projectId}/webhook/${projectWebhookId}`,
+ `/api/project/${projectID}/webhook/${projectWebhookID}`,
{
data: {
type: "projectWebhookPatch",
@@ -163,45 +163,45 @@ const actions = {
rootGetters
);
- commit("upsertProjectWebhookByProjectId", {
- projectId,
+ commit("upsertProjectWebhookByProjectID", {
+ projectID,
projectWebhook: updatedProjectWebhook,
});
return updatedProjectWebhook;
},
- async deleteProjectWebhookById(
+ async deleteProjectWebhookByID(
{ dispatch, commit }: any,
{
- projectId,
- projectWebhookId,
+ projectID,
+ projectWebhookID,
}: {
- projectId: ProjectId;
- projectWebhookId: ProjectWebhookId;
+ projectID: ProjectID;
+ projectWebhookID: ProjectWebhookID;
}
) {
- await axios.delete(`/api/project/${projectId}/webhook/${projectWebhookId}`);
+ await axios.delete(`/api/project/${projectID}/webhook/${projectWebhookID}`);
- commit("deleteProjectWebhookById", {
- projectId,
- projectWebhookId,
+ commit("deleteProjectWebhookByID", {
+ projectID,
+ projectWebhookID,
});
},
- async testProjectWebhookById(
+ async testProjectWebhookByID(
{ dispatch, commit }: any,
{
- projectId,
- projectWebhookId,
+ projectID,
+ projectWebhookID,
}: {
- projectId: ProjectId;
- projectWebhookId: ProjectWebhookId;
+ projectID: ProjectID;
+ projectWebhookID: ProjectWebhookID;
}
) {
const data = (
await axios.get(
- `/api/project/${projectId}/webhook/${projectWebhookId}/test`
+ `/api/project/${projectID}/webhook/${projectWebhookID}/test`
)
).data;
@@ -210,30 +210,30 @@ const actions = {
};
const mutations = {
- setProjectWebhookListByProjectId(
+ setProjectWebhookListByProjectID(
state: ProjectWebhookState,
{
- projectId,
+ projectID,
projectWebhookList,
}: {
- projectId: ProjectId;
+ projectID: ProjectID;
projectWebhookList: ProjectWebhook[];
}
) {
- state.projectWebhookListByProjectId.set(projectId, projectWebhookList);
+ state.projectWebhookListByProjectID.set(projectID, projectWebhookList);
},
- upsertProjectWebhookByProjectId(
+ upsertProjectWebhookByProjectID(
state: ProjectWebhookState,
{
- projectId,
+ projectID,
projectWebhook,
}: {
- projectId: ProjectId;
+ projectID: ProjectID;
projectWebhook: ProjectWebhook;
}
) {
- const list = state.projectWebhookListByProjectId.get(projectId);
+ const list = state.projectWebhookListByProjectID.get(projectID);
if (list) {
const i = list.findIndex((item) => item.id == projectWebhook.id);
if (i >= 0) {
@@ -242,23 +242,23 @@ const mutations = {
list.push(projectWebhook);
}
} else {
- state.projectWebhookListByProjectId.set(projectId, [projectWebhook]);
+ state.projectWebhookListByProjectID.set(projectID, [projectWebhook]);
}
},
- deleteProjectWebhookById(
+ deleteProjectWebhookByID(
state: ProjectWebhookState,
{
- projectId,
- projectWebhookId,
+ projectID,
+ projectWebhookID,
}: {
- projectId: ProjectId;
- projectWebhookId: ProjectWebhookId;
+ projectID: ProjectID;
+ projectWebhookID: ProjectWebhookID;
}
) {
- const list = state.projectWebhookListByProjectId.get(projectId);
+ const list = state.projectWebhookListByProjectID.get(projectID);
if (list) {
- const i = list.findIndex((item) => item.id == projectWebhookId);
+ const i = list.findIndex((item) => item.id == projectWebhookID);
if (i >= 0) {
list.splice(i, 1);
}
diff --git a/frontend/src/store/modules/repository.ts b/frontend/src/store/modules/repository.ts
index 6686e5fb89..35c24274a2 100644
--- a/frontend/src/store/modules/repository.ts
+++ b/frontend/src/store/modules/repository.ts
@@ -1,7 +1,7 @@
import axios from "axios";
import {
Project,
- ProjectId,
+ ProjectID,
Repository,
RepositoryCreate,
RepositoryPatch,
@@ -10,7 +10,7 @@ import {
ResourceObject,
unknown,
VCS,
- VCSId,
+ VCSID,
} from "../../types";
function convert(
@@ -18,21 +18,21 @@ function convert(
includedList: ResourceObject[],
rootGetters: any
): Repository {
- const vcsId = (repository.relationships!.vcs.data as ResourceIdentifier).id;
+ const vcsID = (repository.relationships!.vcs.data as ResourceIdentifier).id;
let vcs: VCS = unknown("VCS") as VCS;
- vcs.id = parseInt(vcsId);
+ vcs.id = parseInt(vcsID);
- const projectId = (
+ const projectID = (
repository.relationships!.project.data as ResourceIdentifier
).id;
let project: Project = unknown("PROJECT") as Project;
- project.id = parseInt(projectId);
+ project.id = parseInt(projectID);
for (const item of includedList || []) {
- if (item.type == "vcs" && item.id == vcsId) {
+ if (item.type == "vcs" && item.id == vcsID) {
vcs = rootGetters["vcs/convert"](item);
}
- if (item.type == "project" && item.id == projectId) {
+ if (item.type == "project" && item.id == projectID) {
project = rootGetters["project/convert"](item, includedList);
}
}
@@ -46,22 +46,22 @@ function convert(
}
const state: () => RepositoryState = () => ({
- repositoryListByVCSId: new Map(),
- repositoryByProjectId: new Map(),
+ repositoryListByVCSID: new Map(),
+ repositoryByProjectID: new Map(),
});
const getters = {
- repositoryListByVCSId:
+ repositoryListByVCSID:
(state: RepositoryState) =>
- (vcsId: VCSId): Repository[] => {
- return state.repositoryListByVCSId.get(vcsId) || [];
+ (vcsID: VCSID): Repository[] => {
+ return state.repositoryListByVCSID.get(vcsID) || [];
},
- repositoryByProjectId:
+ repositoryByProjectID:
(state: RepositoryState) =>
- (projectId: ProjectId): Repository => {
+ (projectID: ProjectID): Repository => {
return (
- state.repositoryByProjectId.get(projectId) ||
+ state.repositoryByProjectID.get(projectID) ||
(unknown("REPOSITORY") as Repository)
);
},
@@ -74,7 +74,7 @@ const actions = {
): Promise<Repository> {
const data = (
await axios.post(
- `/api/project/${repositoryCreate.projectId}/repository`,
+ `/api/project/${repositoryCreate.projectID}/repository`,
{
data: {
type: "RepositoryCreate",
@@ -85,46 +85,46 @@ const actions = {
).data;
const createdRepository = convert(data.data, data.included, rootGetters);
- commit("setRepositoryByProjectId", {
- projectId: repositoryCreate.projectId,
+ commit("setRepositoryByProjectID", {
+ projectID: repositoryCreate.projectID,
repository: createdRepository,
});
// Refetch the project as the project workflow type has been updated to "VCS"
- dispatch("project/fetchProjectById", repositoryCreate.projectId, {
+ dispatch("project/fetchProjectByID", repositoryCreate.projectID, {
root: true,
});
return createdRepository;
},
- async fetchRepositoryListByVCSId(
+ async fetchRepositoryListByVCSID(
{ commit, rootGetters }: any,
- vcsId: VCSId
+ vcsID: VCSID
): Promise<Repository[]> {
- const data = (await axios.get(`/api/vcs/${vcsId}/repository`)).data;
+ const data = (await axios.get(`/api/vcs/${vcsID}/repository`)).data;
const repositoryList = data.data.map((repository: ResourceObject) => {
return convert(repository, data.included, rootGetters);
});
- commit("setRepositoryListByVCSId", { vcsId, repositoryList });
+ commit("setRepositoryListByVCSID", { vcsID, repositoryList });
return repositoryList;
},
- async fetchRepositoryByProjectId(
+ async fetchRepositoryByProjectID(
{ commit, rootGetters }: any,
- projectId: ProjectId
+ projectID: ProjectID
): Promise<Repository> {
- const data = (await axios.get(`/api/project/${projectId}/repository`)).data;
+ const data = (await axios.get(`/api/project/${projectID}/repository`)).data;
const repositoryList = data.data.map((repository: ResourceObject) => {
return convert(repository, data.included, rootGetters);
});
// Expect server to return at most one item, otherwise it will throw error
if (repositoryList.length > 0) {
- commit("setRepositoryByProjectId", {
- projectId,
+ commit("setRepositoryByProjectID", {
+ projectID,
repository: repositoryList[0],
});
return repositoryList[0];
@@ -133,18 +133,18 @@ const actions = {
return unknown("REPOSITORY") as Repository;
},
- async updateRepositoryByProjectId(
+ async updateRepositoryByProjectID(
{ commit, rootGetters }: any,
{
- projectId,
+ projectID,
repositoryPatch,
}: {
- projectId: ProjectId;
+ projectID: ProjectID;
repositoryPatch: RepositoryPatch;
}
) {
const data = (
- await axios.patch(`/api/project/${projectId}/repository`, {
+ await axios.patch(`/api/project/${projectID}/repository`, {
data: {
type: "repositoryPatch",
attributes: repositoryPatch,
@@ -153,57 +153,57 @@ const actions = {
).data;
const updatedRepository = convert(data.data, data.included, rootGetters);
- commit("setRepositoryByProjectId", {
- projectId,
+ commit("setRepositoryByProjectID", {
+ projectID,
repository: updatedRepository,
});
return updatedRepository;
},
- async deleteRepositoryByProjectId(
+ async deleteRepositoryByProjectID(
{ dispatch, commit }: any,
- projectId: ProjectId
+ projectID: ProjectID
) {
- await axios.delete(`/api/project/${projectId}/repository`);
- commit("deleteRepositoryByProjectId", projectId);
+ await axios.delete(`/api/project/${projectID}/repository`);
+ commit("deleteRepositoryByProjectID", projectID);
// Refetch the project as the project workflow type has been updated to "UI"
- dispatch("project/fetchProjectById", projectId, {
+ dispatch("project/fetchProjectByID", projectID, {
root: true,
});
},
};
const mutations = {
- setRepositoryListByVCSId(
+ setRepositoryListByVCSID(
state: RepositoryState,
{
- vcsId,
+ vcsID,
repositoryList,
}: {
- vcsId: VCSId;
+ vcsID: VCSID;
repositoryList: Repository[];
}
) {
- state.repositoryListByVCSId.set(vcsId, repositoryList);
+ state.repositoryListByVCSID.set(vcsID, repositoryList);
},
- setRepositoryByProjectId(
+ setRepositoryByProjectID(
state: RepositoryState,
{
- projectId,
+ projectID,
repository,
}: {
- projectId: ProjectId;
+ projectID: ProjectID;
repository: Repository;
}
) {
- state.repositoryByProjectId.set(projectId, repository);
+ state.repositoryByProjectID.set(projectID, repository);
},
- deleteRepositoryByProjectId(state: RepositoryState, projectId: ProjectId) {
- state.repositoryByProjectId.delete(projectId);
+ deleteRepositoryByProjectID(state: RepositoryState, projectID: ProjectID) {
+ state.repositoryByProjectID.delete(projectID);
},
};
diff --git a/frontend/src/store/modules/router.ts b/frontend/src/store/modules/router.ts
index 0ae667367e..9fba9ec0b7 100644
--- a/frontend/src/store/modules/router.ts
+++ b/frontend/src/store/modules/router.ts
@@ -12,14 +12,14 @@ const getters = {
(state: RouterState) =>
(currentRoute: RouteLocationNormalized): RouterSlug => {
{
- // /u/:principalId
+ // /u/:principalID
// Total 2 elements, 2nd element is the principal id
const profileComponents = currentRoute.path.match(
"/u/([0-9a-zA-Z_-]+)"
) || ["/", undefined];
if (profileComponents[1]) {
return {
- principalId: parseInt(profileComponents[1]),
+ principalID: parseInt(profileComponents[1]),
};
}
}
@@ -149,7 +149,7 @@ const getters = {
}
{
- // /setting/version-control/:vcsId
+ // /setting/version-control/:vcsID
// Total 2 elements, 2nd element is the version control system id
const vcsComponents = currentRoute.path.match(
"/setting/version-control/([0-9a-zA-Z_-]+)"
diff --git a/frontend/src/store/modules/sql.ts b/frontend/src/store/modules/sql.ts
index 0ee0bf89e8..185f0dbbd7 100644
--- a/frontend/src/store/modules/sql.ts
+++ b/frontend/src/store/modules/sql.ts
@@ -1,7 +1,7 @@
import axios from "axios";
import {
ConnectionInfo,
- InstanceId,
+ InstanceID,
INSTANCE_OPERATION_TIMEOUT,
ResourceObject,
SqlResultSet,
@@ -34,7 +34,7 @@ const actions = {
return convert(data);
},
- async syncSchema({ dispatch }: any, instanceId: InstanceId) {
+ async syncSchema({ dispatch }: any, instanceID: InstanceID) {
const data = (
await axios.post(
`/api/sql/syncschema`,
@@ -42,7 +42,7 @@ const actions = {
data: {
type: "sqlSyncSchema",
attributes: {
- instanceId,
+ instanceID,
},
},
},
@@ -55,11 +55,11 @@ const actions = {
const resultSet = convert(data);
if (!resultSet.error) {
// Refresh the corresponding list.
- dispatch("database/fetchDatabaseListByInstanceId", instanceId, {
+ dispatch("database/fetchDatabaseListByInstanceID", instanceID, {
root: true,
});
- dispatch("instance/fetchInstanceUserListById", instanceId, {
+ dispatch("instance/fetchInstanceUserListByID", instanceID, {
root: true,
});
}
diff --git a/frontend/src/store/modules/stage.ts b/frontend/src/store/modules/stage.ts
index 54eaf1febb..7e0a1d3d9e 100644
--- a/frontend/src/store/modules/stage.ts
+++ b/frontend/src/store/modules/stage.ts
@@ -6,7 +6,7 @@ import {
StageState,
Task,
unknown,
- PipelineId,
+ PipelineID,
Pipeline,
Environment,
} from "../../types";
@@ -18,16 +18,16 @@ function convertPartial(
includedList: ResourceObject[],
rootGetters: any
): Omit<Stage, "pipeline"> {
- const environmentId = (
+ const environmentID = (
stage.relationships!.environment.data as ResourceIdentifier
).id;
let environment: Environment = unknown("ENVIRONMENT") as Environment;
- environment.id = parseInt(environmentId);
+ environment.id = parseInt(environmentID);
const taskList: Task[] = [];
- const taskIdList = stage.relationships!.task.data as ResourceIdentifier[];
- // Needs to iterate through taskIdList to maintain the order
- for (const idItem of taskIdList) {
+ const taskIDList = stage.relationships!.task.data as ResourceIdentifier[];
+ // Needs to iterate through taskIDList to maintain the order
+ for (const idItem of taskIDList) {
for (const item of includedList || []) {
if (item.type == "task") {
if (idItem.id == item.id) {
@@ -66,9 +66,9 @@ const getters = {
(state: StageState, getters: any, rootState: any, rootGetters: any) =>
(stage: ResourceObject, includedList: ResourceObject[]): Stage => {
// It's only called when pipeline tries to convert itself, so we don't have a issue yet.
- const pipelineId = stage.attributes.pipelineId as PipelineId;
+ const pipelineID = stage.attributes.pipelineID as PipelineID;
let pipeline: Pipeline = unknown("PIPELINE") as Pipeline;
- pipeline.id = pipelineId;
+ pipeline.id = pipelineID;
const result: Stage = {
...convertPartial(stage, includedList, rootGetters),
diff --git a/frontend/src/store/modules/table.ts b/frontend/src/store/modules/table.ts
index a99403e3ee..008e354155 100644
--- a/frontend/src/store/modules/table.ts
+++ b/frontend/src/store/modules/table.ts
@@ -1,7 +1,7 @@
import axios from "axios";
import {
Database,
- DatabaseId,
+ DatabaseID,
ResourceIdentifier,
ResourceObject,
Table,
@@ -14,12 +14,12 @@ function convert(
includedList: ResourceObject[],
rootGetters: any
): Table {
- const databaseId = (table.relationships!.database.data as ResourceIdentifier)
+ const databaseID = (table.relationships!.database.data as ResourceIdentifier)
.id;
let database: Database = unknown("DATABASE") as Database;
for (const item of includedList || []) {
- if (item.type == "database" && item.id == databaseId) {
+ if (item.type == "database" && item.id == databaseID) {
database = rootGetters["database/convert"](item, includedList);
break;
}
@@ -32,73 +32,73 @@ function convert(
}
const state: () => TableState = () => ({
- tableListByDatabaseId: new Map(),
+ tableListByDatabaseID: new Map(),
});
const getters = {
- tableListByDatabaseIdAndTableName:
+ tableListByDatabaseIDAndTableName:
(state: TableState) =>
- (databaseId: DatabaseId, tableName: string): Table | undefined => {
- const list = state.tableListByDatabaseId.get(databaseId);
+ (databaseID: DatabaseID, tableName: string): Table | undefined => {
+ const list = state.tableListByDatabaseID.get(databaseID);
if (list) {
return list.find((item: Table) => item.name == tableName);
}
return undefined;
},
- tableListByDatabaseId:
+ tableListByDatabaseID:
(state: TableState) =>
- (databaseId: DatabaseId): Table[] => {
- return state.tableListByDatabaseId.get(databaseId) || [];
+ (databaseID: DatabaseID): Table[] => {
+ return state.tableListByDatabaseID.get(databaseID) || [];
},
};
const actions = {
- async fetchTableByDatabaseIdAndTableName(
+ async fetchTableByDatabaseIDAndTableName(
{ commit, rootGetters }: any,
- { databaseId, tableName }: { databaseId: DatabaseId; tableName: string }
+ { databaseID, tableName }: { databaseID: DatabaseID; tableName: string }
) {
const data = (
- await axios.get(`/api/database/${databaseId}/table/${tableName}`)
+ await axios.get(`/api/database/${databaseID}/table/${tableName}`)
).data;
const table = convert(data.data, data.included, rootGetters);
- commit("setTableByDatabaseIdAndTableName", {
- databaseId,
+ commit("setTableByDatabaseIDAndTableName", {
+ databaseID,
tableName,
table,
});
return table;
},
- async fetchTableListByDatabaseId(
+ async fetchTableListByDatabaseID(
{ commit, rootGetters }: any,
- databaseId: DatabaseId
+ databaseID: DatabaseID
) {
- const data = (await axios.get(`/api/database/${databaseId}/table`)).data;
+ const data = (await axios.get(`/api/database/${databaseID}/table`)).data;
const tableList = data.data.map((table: ResourceObject) => {
return convert(table, data.included, rootGetters);
});
- commit("setTableListByDatabaseId", { databaseId, tableList });
+ commit("setTableListByDatabaseID", { databaseID, tableList });
return tableList;
},
};
const mutations = {
- setTableByDatabaseIdAndTableName(
+ setTableByDatabaseIDAndTableName(
state: TableState,
{
- databaseId,
+ databaseID,
tableName,
table,
}: {
- databaseId: DatabaseId;
+ databaseID: DatabaseID;
tableName: string;
table: Table;
}
) {
- const list = state.tableListByDatabaseId.get(databaseId);
+ const list = state.tableListByDatabaseID.get(databaseID);
if (list) {
const i = list.findIndex((item: Table) => item.name == tableName);
if (i != -1) {
@@ -107,21 +107,21 @@ const mutations = {
list.push(table);
}
} else {
- state.tableListByDatabaseId.set(databaseId, [table]);
+ state.tableListByDatabaseID.set(databaseID, [table]);
}
},
- setTableListByDatabaseId(
+ setTableListByDatabaseID(
state: TableState,
{
- databaseId,
+ databaseID,
tableList,
}: {
- databaseId: DatabaseId;
+ databaseID: DatabaseID;
tableList: Table[];
}
) {
- state.tableListByDatabaseId.set(databaseId, tableList);
+ state.tableListByDatabaseID.set(databaseID, tableList);
},
};
diff --git a/frontend/src/store/modules/task.ts b/frontend/src/store/modules/task.ts
index bae6741416..02e2136e38 100644
--- a/frontend/src/store/modules/task.ts
+++ b/frontend/src/store/modules/task.ts
@@ -2,17 +2,17 @@ import axios from "axios";
import {
empty,
Instance,
- IssueId,
+ IssueID,
Pipeline,
- PipelineId,
+ PipelineID,
Principal,
ResourceIdentifier,
ResourceObject,
Stage,
- StageId,
+ StageID,
Task,
TaskCheckRun,
- TaskId,
+ TaskID,
TaskPatch,
TaskRun,
TaskState,
@@ -78,10 +78,10 @@ function convertPartial(
: {};
const taskRunList: TaskRun[] = [];
- const taskRunIdList = task.relationships!.taskRun
+ const taskRunIDList = task.relationships!.taskRun
.data as ResourceIdentifier[];
- // Needs to iterate through taskIdList to maintain the order
- for (const idItem of taskRunIdList) {
+ // Needs to iterate through taskIDList to maintain the order
+ for (const idItem of taskRunIDList) {
for (const item of includedList || []) {
if (item.type == "taskRun") {
if (idItem.id == item.id) {
@@ -97,10 +97,10 @@ function convertPartial(
}
const taskCheckRunList: TaskCheckRun[] = [];
- const taskCheckRunIdList = task.relationships!.taskCheckRun
+ const taskCheckRunIDList = task.relationships!.taskCheckRun
.data as ResourceIdentifier[];
- // Needs to iterate through taskIdList to maintain the order
- for (const idItem of taskCheckRunIdList) {
+ // Needs to iterate through taskIDList to maintain the order
+ for (const idItem of taskCheckRunIDList) {
for (const item of includedList || []) {
if (item.type == "taskCheckRun") {
if (idItem.id == item.id) {
@@ -115,10 +115,10 @@ function convertPartial(
}
}
- const instanceId = (task.relationships!.instance.data as ResourceIdentifier)
+ const instanceID = (task.relationships!.instance.data as ResourceIdentifier)
.id;
let instance: Instance = empty("INSTANCE") as Instance;
- instance.id = parseInt(instanceId);
+ instance.id = parseInt(instanceID);
let database = undefined;
for (const item of includedList || []) {
@@ -167,13 +167,13 @@ const getters = {
(state: TaskState, getters: any, rootState: any, rootGetters: any) =>
(task: ResourceObject, includedList: ResourceObject[]): Task => {
// It's only called when pipeline/stage tries to convert itself, so we don't have a issue yet.
- const pipelineId = task.attributes.pipelineId as PipelineId;
+ const pipelineID = task.attributes.pipelineID as PipelineID;
let pipeline: Pipeline = unknown("PIPELINE") as Pipeline;
- pipeline.id = pipelineId;
+ pipeline.id = pipelineID;
- const stageId = task.attributes.stageId as StageId;
+ const stageID = task.attributes.stageID as StageID;
let stage: Stage = unknown("STAGE") as Stage;
- stage.id = stageId;
+ stage.id = stageID;
return {
...convertPartial(task, includedList, rootGetters),
@@ -187,19 +187,19 @@ const actions = {
async updateStatus(
{ dispatch, rootGetters }: any,
{
- issueId,
- pipelineId,
- taskId,
+ issueID,
+ pipelineID,
+ taskID,
taskStatusPatch,
}: {
- issueId: IssueId;
- pipelineId: PipelineId;
- taskId: TaskId;
+ issueID: IssueID;
+ pipelineID: PipelineID;
+ taskID: TaskID;
taskStatusPatch: TaskStatusPatch;
}
) {
const data = (
- await axios.patch(`/api/pipeline/${pipelineId}/task/${taskId}/status`, {
+ await axios.patch(`/api/pipeline/${pipelineID}/task/${taskID}/status`, {
data: {
type: "taskStatusPatch",
attributes: taskStatusPatch,
@@ -208,7 +208,7 @@ const actions = {
).data;
const task = convertPartial(data.data, data.included, rootGetters);
- dispatch("issue/fetchIssueById", issueId, { root: true });
+ dispatch("issue/fetchIssueByID", issueID, { root: true });
return task;
},
@@ -216,19 +216,19 @@ const actions = {
async patchTask(
{ dispatch, rootGetters }: any,
{
- issueId,
- pipelineId,
- taskId,
+ issueID,
+ pipelineID,
+ taskID,
taskPatch,
}: {
- issueId: IssueId;
- pipelineId: PipelineId;
- taskId: TaskId;
+ issueID: IssueID;
+ pipelineID: PipelineID;
+ taskID: TaskID;
taskPatch: TaskPatch;
}
) {
const data = (
- await axios.patch(`/api/pipeline/${pipelineId}/task/${taskId}`, {
+ await axios.patch(`/api/pipeline/${pipelineID}/task/${taskID}`, {
data: {
type: "taskPatch",
attributes: taskPatch,
@@ -237,7 +237,7 @@ const actions = {
).data;
const task = convertPartial(data.data, data.included, rootGetters);
- dispatch("issue/fetchIssueById", issueId, { root: true });
+ dispatch("issue/fetchIssueByID", issueID, { root: true });
return task;
},
@@ -245,21 +245,21 @@ const actions = {
async runChecks(
{ dispatch, rootGetters }: any,
{
- issueId,
- pipelineId,
- taskId,
+ issueID,
+ pipelineID,
+ taskID,
}: {
- issueId: IssueId;
- pipelineId: PipelineId;
- taskId: TaskId;
+ issueID: IssueID;
+ pipelineID: PipelineID;
+ taskID: TaskID;
}
) {
const data = (
- await axios.post(`/api/pipeline/${pipelineId}/task/${taskId}/check`)
+ await axios.post(`/api/pipeline/${pipelineID}/task/${taskID}/check`)
).data;
const task = convertPartial(data.data, data.included, rootGetters);
- dispatch("issue/fetchIssueById", issueId, { root: true });
+ dispatch("issue/fetchIssueByID", issueID, { root: true });
return task;
},
diff --git a/frontend/src/store/modules/vcs.ts b/frontend/src/store/modules/vcs.ts
index fd8b4d9afb..cc25e16bce 100644
--- a/frontend/src/store/modules/vcs.ts
+++ b/frontend/src/store/modules/vcs.ts
@@ -1,6 +1,6 @@
import axios from "axios";
import {
- VCSId,
+ VCSID,
VCS,
VCSCreate,
VCSState,
@@ -19,8 +19,8 @@ function convert(vcs: ResourceObject): VCS {
}
const state: () => VCSState = () => ({
- vcsById: new Map(),
- repositoryListByVCSId: new Map(),
+ vcsByID: new Map(),
+ repositoryListByVCSID: new Map(),
});
const getters = {
@@ -32,20 +32,20 @@ const getters = {
vcsList: (state: VCSState) => (): VCS[] => {
const list = [];
- for (const [_, vcs] of state.vcsById) {
+ for (const [_, vcs] of state.vcsByID) {
list.push(vcs);
}
return list;
},
- vcsById:
+ vcsByID:
(state: VCSState) =>
- (vcsId: VCSId): VCS => {
- if (vcsId == EMPTY_ID) {
+ (vcsID: VCSID): VCS => {
+ if (vcsID == EMPTY_ID) {
return empty("VCS") as VCS;
}
- return state.vcsById.get(vcsId) || (unknown("VCS") as VCS);
+ return state.vcsByID.get(vcsID) || (unknown("VCS") as VCS);
},
};
@@ -66,12 +66,12 @@ const actions = {
return vcsList;
},
- async fetchVCSById({ commit }: any, vcsId: VCSId) {
- const data = (await axios.get(`/api/vcs/${vcsId}`)).data;
+ async fetchVCSByID({ commit }: any, vcsID: VCSID) {
+ const data = (await axios.get(`/api/vcs/${vcsID}`)).data;
const vcs = convert(data.data);
- commit("setVCSById", {
- vcsId,
+ commit("setVCSByID", {
+ vcsID,
vcs,
});
return vcs;
@@ -88,8 +88,8 @@ const actions = {
).data;
const createdVCS = convert(data.data);
- commit("setVCSById", {
- vcsId: createdVCS.id,
+ commit("setVCSByID", {
+ vcsID: createdVCS.id,
vcs: createdVCS,
});
@@ -99,15 +99,15 @@ const actions = {
async patchVCS(
{ commit }: any,
{
- vcsId,
+ vcsID,
vcsPatch,
}: {
- vcsId: VCSId;
+ vcsID: VCSID;
vcsPatch: VCSPatch;
}
) {
const data = (
- await axios.patch(`/api/vcs/${vcsId}`, {
+ await axios.patch(`/api/vcs/${vcsID}`, {
data: {
type: "VCSCreate",
attributes: vcsPatch,
@@ -116,46 +116,46 @@ const actions = {
).data;
const updatedVCS = convert(data.data);
- commit("setVCSById", {
- vcsId: updatedVCS.id,
+ commit("setVCSByID", {
+ vcsID: updatedVCS.id,
vcs: updatedVCS,
});
return updatedVCS;
},
- async deleteVCSById(
+ async deleteVCSByID(
{ commit }: { state: VCSState; commit: any },
- vcsId: VCSId
+ vcsID: VCSID
) {
- await axios.delete(`/api/vcs/${vcsId}`);
+ await axios.delete(`/api/vcs/${vcsID}`);
- commit("deleteVCSById", vcsId);
+ commit("deleteVCSByID", vcsID);
},
};
const mutations = {
setVCSList(state: VCSState, vcsList: VCS[]) {
vcsList.forEach((vcs) => {
- state.vcsById.set(vcs.id, vcs);
+ state.vcsByID.set(vcs.id, vcs);
});
},
- setVCSById(
+ setVCSByID(
state: VCSState,
{
- vcsId,
+ vcsID,
vcs,
}: {
- vcsId: VCSId;
+ vcsID: VCSID;
vcs: VCS;
}
) {
- state.vcsById.set(vcsId, vcs);
+ state.vcsByID.set(vcsID, vcs);
},
- deleteVCSById(state: VCSState, vcsId: VCSId) {
- state.vcsById.delete(vcsId);
+ deleteVCSByID(state: VCSState, vcsID: VCSID) {
+ state.vcsByID.delete(vcsID);
},
};
diff --git a/frontend/src/store/modules/view.ts b/frontend/src/store/modules/view.ts
index e001676d63..394af00bbb 100644
--- a/frontend/src/store/modules/view.ts
+++ b/frontend/src/store/modules/view.ts
@@ -1,7 +1,7 @@
import axios from "axios";
import {
Database,
- DatabaseId,
+ DatabaseID,
ResourceIdentifier,
ResourceObject,
unknown,
@@ -14,12 +14,12 @@ function convert(
includedList: ResourceObject[],
rootGetters: any
): View {
- const databaseId = (view.relationships!.database.data as ResourceIdentifier)
+ const databaseID = (view.relationships!.database.data as ResourceIdentifier)
.id;
let database: Database = unknown("DATABASE") as Database;
for (const item of includedList || []) {
- if (item.type == "database" && item.id == databaseId) {
+ if (item.type == "database" && item.id == databaseID) {
database = rootGetters["database/convert"](item, includedList);
break;
}
@@ -32,44 +32,44 @@ function convert(
}
const state: () => ViewState = () => ({
- viewListByDatabaseId: new Map(),
+ viewListByDatabaseID: new Map(),
});
const getters = {
- viewListByDatabaseId:
+ viewListByDatabaseID:
(state: ViewState) =>
- (databaseId: DatabaseId): View[] => {
- return state.viewListByDatabaseId.get(databaseId) || [];
+ (databaseID: DatabaseID): View[] => {
+ return state.viewListByDatabaseID.get(databaseID) || [];
},
};
const actions = {
- async fetchViewListByDatabaseId(
+ async fetchViewListByDatabaseID(
{ commit, rootGetters }: any,
- databaseId: DatabaseId
+ databaseID: DatabaseID
) {
- const data = (await axios.get(`/api/database/${databaseId}/view`)).data;
+ const data = (await axios.get(`/api/database/${databaseID}/view`)).data;
const viewList = data.data.map((view: ResourceObject) => {
return convert(view, data.included, rootGetters);
});
- commit("setViewListByDatabaseId", { databaseId, viewList });
+ commit("setViewListByDatabaseID", { databaseID, viewList });
return viewList;
},
};
const mutations = {
- setViewListByDatabaseId(
+ setViewListByDatabaseID(
state: ViewState,
{
- databaseId,
+ databaseID,
viewList,
}: {
- databaseId: DatabaseId;
+ databaseID: DatabaseID;
viewList: View[];
}
) {
- state.viewListByDatabaseId.set(databaseId, viewList);
+ state.viewListByDatabaseID.set(databaseID, viewList);
},
};
diff --git a/frontend/src/types/InstanceUser.ts b/frontend/src/types/InstanceUser.ts
index 4af7525490..76b99a0fec 100644
--- a/frontend/src/types/InstanceUser.ts
+++ b/frontend/src/types/InstanceUser.ts
@@ -1,10 +1,10 @@
-import { InstanceId, InstanceUserId } from "./id";
+import { InstanceID, InstanceUserID } from "./id";
export type InstanceUser = {
- id: InstanceUserId;
+ id: InstanceUserID;
// Related fields
- instanceId: InstanceId;
+ instanceID: InstanceID;
// Domain specific fields
name: string;
diff --git a/frontend/src/types/activity.ts b/frontend/src/types/activity.ts
index f28b9f813f..8805ab17dc 100644
--- a/frontend/src/types/activity.ts
+++ b/frontend/src/types/activity.ts
@@ -1,5 +1,5 @@
-import { FieldId } from "../plugins";
-import { ActivityId, ContainerId, IssueId, PrincipalId, TaskId } from "./id";
+import { FieldID } from "../plugins";
+import { ActivityID, ContainerID, IssueID, PrincipalID, TaskID } from "./id";
import { IssueStatus } from "./issue";
import { MemberStatus, RoleType } from "./member";
import { TaskStatus } from "./pipeline";
@@ -71,7 +71,7 @@ export type ActivityLevel = "INFO" | "WARN" | "ERROR";
export type ActivityIssueCreatePayload = {
issueName: string;
- rollbackIssueId?: IssueId;
+ rollbackIssueID?: IssueID;
};
export type ActivityIssueCommentCreatePayload = {
@@ -79,7 +79,7 @@ export type ActivityIssueCommentCreatePayload = {
};
export type ActivityIssueFieldUpdatePayload = {
- fieldId: FieldId;
+ fieldID: FieldID;
oldValue?: string;
newValue?: string;
issueName: string;
@@ -92,7 +92,7 @@ export type ActivityIssueStatusUpdatePayload = {
};
export type ActivityTaskStatusUpdatePayload = {
- taskId: TaskId;
+ taskID: TaskID;
oldStatus: TaskStatus;
newStatus: TaskStatus;
issueName: string;
@@ -100,16 +100,16 @@ export type ActivityTaskStatusUpdatePayload = {
};
export type ActivityTaskFileCommitPayload = {
- taskId: TaskId;
+ taskID: TaskID;
vcsInstanceUrl: string;
repositoryFullPath: string;
branch: string;
filePath: string;
- commitId: string;
+ commitID: string;
};
export type ActivityMemberCreatePayload = {
- principalId: PrincipalId;
+ principalID: PrincipalID;
principalName: string;
principalEmail: string;
memberStatus: MemberStatus;
@@ -117,7 +117,7 @@ export type ActivityMemberCreatePayload = {
};
export type ActivityMemberRoleUpdatePayload = {
- principalId: PrincipalId;
+ principalID: PrincipalID;
principalName: string;
principalEmail: string;
oldRole: RoleType;
@@ -125,7 +125,7 @@ export type ActivityMemberRoleUpdatePayload = {
};
export type ActivityMemberActivateDeactivatePayload = {
- principalId: PrincipalId;
+ principalID: PrincipalID;
principalName: string;
principalEmail: string;
role: RoleType;
@@ -133,12 +133,12 @@ export type ActivityMemberActivateDeactivatePayload = {
export type ActivityProjectRepositoryPushPayload = {
pushEvent: VCSPushEvent;
- issueId?: number;
+ issueID?: number;
issueName?: string;
};
export type ActivityProjectDatabaseTransferPayload = {
- databaseId: number;
+ databaseID: number;
databaseName: string;
};
@@ -156,7 +156,7 @@ export type ActionPayloadType =
| ActivityProjectDatabaseTransferPayload;
export type Activity = {
- id: ActivityId;
+ id: ActivityID;
// Standard fields
creator: Principal;
@@ -167,7 +167,7 @@ export type Activity = {
// Domain specific fields
// The object where this activity belongs
// e.g if type is "bb.issue.xxx", then this field refers to the corresponding issue's id.
- containerId: ContainerId;
+ containerID: ContainerID;
type: ActivityType;
level: ActivityLevel;
comment: string;
@@ -176,7 +176,7 @@ export type Activity = {
export type ActivityCreate = {
// Domain specific fields
- containerId: ContainerId;
+ containerID: ContainerID;
type: ActivityType;
comment: string;
payload?: ActionPayloadType;
diff --git a/frontend/src/types/anomaly.ts b/frontend/src/types/anomaly.ts
index 2caf6378a6..db828c621f 100644
--- a/frontend/src/types/anomaly.ts
+++ b/frontend/src/types/anomaly.ts
@@ -1,11 +1,11 @@
import {
- AnomalyId,
+ AnomalyID,
BackupPlanPolicySchedule,
Database,
- DatabaseId,
- EnvironmentId,
+ DatabaseID,
+ EnvironmentID,
Instance,
- InstanceId,
+ InstanceID,
Principal,
} from ".";
@@ -22,7 +22,7 @@ export type AnomalyInstanceConnectionPayload = {
};
export type AnomalyDatabaseBackupPolicyViolationPayload = {
- environmentId: EnvironmentId;
+ environmentID: EnvironmentID;
expectedSchedule: BackupPlanPolicySchedule;
actualSchedule: BackupPlanPolicySchedule;
};
@@ -51,12 +51,12 @@ export type AnomalyPayload =
export type AnomalySeverity = "MEDIUM" | "HIGH" | "CRITICAL";
export type Anomaly = {
- id: AnomalyId;
+ id: AnomalyID;
// Related fields
- instanceId: InstanceId;
+ instanceID: InstanceID;
instance: Instance;
- databaseId?: DatabaseId;
+ databaseID?: DatabaseID;
database?: Database;
// Standard fields
diff --git a/frontend/src/types/backup.ts b/frontend/src/types/backup.ts
index 7065cac278..b9af03cf1b 100644
--- a/frontend/src/types/backup.ts
+++ b/frontend/src/types/backup.ts
@@ -1,4 +1,4 @@
-import { BackupId, BackupSettingId, DatabaseId } from "./id";
+import { BackupID, BackupSettingID, DatabaseID } from "./id";
import { Principal } from "./principal";
export type BackupStatus = "PENDING_CREATE" | "DONE" | "FAILED";
@@ -9,10 +9,10 @@ export type BackupStorageBackend = "LOCAL";
// Backup
export type Backup = {
- id: BackupId;
+ id: BackupID;
// Related fields
- databaseId: DatabaseId;
+ databaseID: DatabaseID;
// Standard fields
creator: Principal;
@@ -31,7 +31,7 @@ export type Backup = {
export type BackupCreate = {
// Related fields
- databaseId: DatabaseId;
+ databaseID: DatabaseID;
// Domain specific fields
name: string;
@@ -42,10 +42,10 @@ export type BackupCreate = {
// Backup setting.
export type BackupSetting = {
- id: BackupSettingId;
+ id: BackupSettingID;
// Related fields
- databaseId: DatabaseId;
+ databaseID: DatabaseID;
// Standard fields
creator: Principal;
@@ -61,7 +61,7 @@ export type BackupSetting = {
export type BackupSettingUpsert = {
// Related fields
- databaseId: DatabaseId;
+ databaseID: DatabaseID;
// Domain specific fields
enabled: boolean;
diff --git a/frontend/src/types/bookmark.ts b/frontend/src/types/bookmark.ts
index 03ec18ced4..5d46ea9b6f 100644
--- a/frontend/src/types/bookmark.ts
+++ b/frontend/src/types/bookmark.ts
@@ -1,8 +1,8 @@
-import { BookmarkId } from "./id";
+import { BookmarkID } from "./id";
import { Principal } from "./principal";
export type Bookmark = {
- id: BookmarkId;
+ id: BookmarkID;
// Standard fields
creator: Principal;
diff --git a/frontend/src/types/column.ts b/frontend/src/types/column.ts
index 71c3968352..f3ddf88985 100644
--- a/frontend/src/types/column.ts
+++ b/frontend/src/types/column.ts
@@ -1,17 +1,17 @@
-import { ColumnId, DatabaseId, TableId } from "./id";
+import { ColumnID, DatabaseID, TableID } from "./id";
// Column
export type Column = {
- id: ColumnId;
+ id: ColumnID;
// Related fields
- databaseId: DatabaseId;
- tableId: TableId;
+ databaseID: DatabaseID;
+ tableID: TableID;
// Standard fields
- creatorId: number;
+ creatorID: number;
createdTs: number;
- updaterId: number;
+ updaterID: number;
updatedTs: number;
// Domain specific fields
diff --git a/frontend/src/types/common.ts b/frontend/src/types/common.ts
index 5664ecb572..134eca4e44 100644
--- a/frontend/src/types/common.ts
+++ b/frontend/src/types/common.ts
@@ -6,7 +6,7 @@ import { Bookmark } from "./bookmark";
import { Database } from "./database";
import { DataSource } from "./dataSource";
import { Environment } from "./environment";
-import { CommandId, CommandRegisterId, PrincipalId } from "./id";
+import { CommandID, CommandRegisterID, PrincipalID } from "./id";
import { Inbox } from "./inbox";
import { Instance } from "./instance";
import { Issue } from "./issue";
@@ -52,7 +52,7 @@ export type RowStatus = "NORMAL" | "ARCHIVED";
// Router
export type RouterSlug = {
- principalId?: PrincipalId;
+ principalID?: PrincipalID;
environmentSlug?: string;
projectSlug?: string;
projectWebhookSlug?: string;
@@ -67,8 +67,8 @@ export type RouterSlug = {
// Quick Action Type
export type Command = {
- id: CommandId;
- registerId: CommandRegisterId;
+ id: CommandID;
+ registerID: CommandRegisterID;
run: () => void;
};
@@ -152,9 +152,9 @@ export const unknown = (
// Have to omit creator and updater to avoid recursion.
const UNKNOWN_PRINCIPAL: Principal = {
id: UNKNOWN_ID,
- creatorId: UNKNOWN_ID,
+ creatorID: UNKNOWN_ID,
createdTs: 0,
- updaterId: UNKNOWN_ID,
+ updaterID: UNKNOWN_ID,
updatedTs: 0,
type: "END_USER",
name: "<<Unknown principal>>",
@@ -201,7 +201,7 @@ export const unknown = (
const UNKNOWN_PROJECT_HOOK: ProjectWebhook = {
id: UNKNOWN_ID,
- projectId: UNKNOWN_ID,
+ projectID: UNKNOWN_ID,
creator: UNKNOWN_PRINCIPAL,
updater: UNKNOWN_PRINCIPAL,
createdTs: 0,
@@ -270,7 +270,7 @@ export const unknown = (
const UNKNOWN_BACKUP_SETTING: BackupSetting = {
id: UNKNOWN_ID,
- databaseId: UNKNOWN_ID,
+ databaseID: UNKNOWN_ID,
creator: UNKNOWN_PRINCIPAL,
createdTs: 0,
updater: UNKNOWN_PRINCIPAL,
@@ -318,7 +318,7 @@ export const unknown = (
type: "bb.issue.general",
description: "",
assignee: UNKNOWN_PRINCIPAL,
- subscriberIdList: [],
+ subscriberIDList: [],
payload: {},
};
@@ -357,7 +357,7 @@ export const unknown = (
createdTs: 0,
updater: UNKNOWN_PRINCIPAL,
updatedTs: 0,
- containerId: UNKNOWN_ID,
+ containerID: UNKNOWN_ID,
type: "bb.issue.create",
level: "INFO",
comment: "<<Unknown comment>>",
@@ -390,7 +390,7 @@ export const unknown = (
type: "GITLAB_SELF_HOST",
instanceURL: "",
apiURL: "",
- applicationId: "",
+ applicationID: "",
secret: "",
};
@@ -409,7 +409,7 @@ export const unknown = (
branchFilter: "",
filePathTemplate: "",
schemaPathTemplate: "",
- externalId: UNKNOWN_ID.toString(),
+ externalID: UNKNOWN_ID.toString(),
};
const UNKNOWN_ANOMALY: Anomaly = {
@@ -418,14 +418,14 @@ export const unknown = (
createdTs: 0,
updater: UNKNOWN_PRINCIPAL,
updatedTs: 0,
- instanceId: UNKNOWN_ID,
+ instanceID: UNKNOWN_ID,
instance: UNKNOWN_INSTANCE,
- databaseId: UNKNOWN_ID,
+ databaseID: UNKNOWN_ID,
database: UNKNOWN_DATABASE,
type: "bb.anomaly.database.backup.policy-violation",
severity: "MEDIUM",
payload: {
- environmentId: UNKNOWN_ID,
+ environmentID: UNKNOWN_ID,
expectedSchedule: "DAILY",
actualSchedule: "UNSET",
},
@@ -552,7 +552,7 @@ export const empty = (
const EMPTY_PROJECT_HOOK: ProjectWebhook = {
id: EMPTY_ID,
- projectId: EMPTY_ID,
+ projectID: EMPTY_ID,
creator: EMPTY_PRINCIPAL,
updater: EMPTY_PRINCIPAL,
createdTs: 0,
@@ -621,7 +621,7 @@ export const empty = (
const EMPTY_BACKUP_SETTING: BackupSetting = {
id: EMPTY_ID,
- databaseId: UNKNOWN_ID,
+ databaseID: UNKNOWN_ID,
creator: EMPTY_PRINCIPAL,
createdTs: 0,
updater: EMPTY_PRINCIPAL,
@@ -669,7 +669,7 @@ export const empty = (
type: "bb.issue.general",
description: "",
assignee: EMPTY_PRINCIPAL,
- subscriberIdList: [],
+ subscriberIDList: [],
payload: {},
};
@@ -708,7 +708,7 @@ export const empty = (
createdTs: 0,
updater: EMPTY_PRINCIPAL,
updatedTs: 0,
- containerId: EMPTY_ID,
+ containerID: EMPTY_ID,
type: "bb.issue.create",
level: "INFO",
comment: "",
@@ -741,7 +741,7 @@ export const empty = (
type: "GITLAB_SELF_HOST",
instanceURL: "",
apiURL: "",
- applicationId: "",
+ applicationID: "",
secret: "",
};
@@ -760,7 +760,7 @@ export const empty = (
branchFilter: "",
filePathTemplate: "",
schemaPathTemplate: "",
- externalId: EMPTY_ID.toString(),
+ externalID: EMPTY_ID.toString(),
};
const EMPTY_ANOMALY: Anomaly = {
@@ -769,14 +769,14 @@ export const empty = (
createdTs: 0,
updater: EMPTY_PRINCIPAL,
updatedTs: 0,
- instanceId: EMPTY_ID,
+ instanceID: EMPTY_ID,
instance: EMPTY_INSTANCE,
- databaseId: EMPTY_ID,
+ databaseID: EMPTY_ID,
database: EMPTY_DATABASE,
type: "bb.anomaly.database.backup.policy-violation",
severity: "MEDIUM",
payload: {
- environmentId: EMPTY_ID,
+ environmentID: EMPTY_ID,
expectedSchedule: "DAILY",
actualSchedule: "UNSET",
},
diff --git a/frontend/src/types/dataSource.ts b/frontend/src/types/dataSource.ts
index 439a903dd4..39ef44bfca 100644
--- a/frontend/src/types/dataSource.ts
+++ b/frontend/src/types/dataSource.ts
@@ -3,11 +3,11 @@
import { Database } from "./database";
import {
- DatabaseId,
- DataSourceId,
- InstanceId,
- IssueId,
- PrincipalId,
+ DatabaseID,
+ DataSourceID,
+ InstanceID,
+ IssueID,
+ PrincipalID,
} from "./id";
import { Instance } from "./instance";
import { Principal } from "./principal";
@@ -16,7 +16,7 @@ import { Principal } from "./principal";
export type DataSourceType = "ADMIN" | "RW" | "RO";
export type DataSource = {
- id: DataSourceId;
+ id: DataSourceID;
// Related fields
database: Database;
@@ -41,8 +41,8 @@ export type DataSource = {
export type DataSourceCreate = {
// Related fields
- databaseId: DatabaseId;
- instanceId: InstanceId;
+ databaseID: DatabaseID;
+ instanceID: InstanceID;
memberList: DataSourceMemberCreate[];
// Domain specific fields
@@ -65,11 +65,11 @@ export type DataSourceMember = {
// Domain specific fields
principal: Principal;
- issueId?: IssueId;
+ issueID?: IssueID;
};
export type DataSourceMemberCreate = {
// Domain specific fields
- principalId: PrincipalId;
- issueId?: IssueId;
+ principalID: PrincipalID;
+ issueID?: IssueID;
};
diff --git a/frontend/src/types/database.ts b/frontend/src/types/database.ts
index 6aff1c6ae8..57fd6f131a 100644
--- a/frontend/src/types/database.ts
+++ b/frontend/src/types/database.ts
@@ -5,7 +5,7 @@
import { Anomaly } from ".";
import { Backup } from "./backup";
import { DataSource } from "./dataSource";
-import { DatabaseId, InstanceId, IssueId, ProjectId } from "./id";
+import { DatabaseID, InstanceID, IssueID, ProjectID } from "./id";
import { Instance } from "./instance";
import { Principal } from "./principal";
import { Project } from "./project";
@@ -15,7 +15,7 @@ import { Project } from "./project";
export type DatabaseSyncStatus = "OK" | "NOT_FOUND";
// Database
export type Database = {
- id: DatabaseId;
+ id: DatabaseID;
// Related fields
instance: Instance;
@@ -40,17 +40,17 @@ export type Database = {
export type DatabaseCreate = {
// Related fields
- instanceId: InstanceId;
- projectId: ProjectId;
+ instanceID: InstanceID;
+ projectID: ProjectID;
// Domain specific fields
name: string;
characterSet: string;
collation: string;
- issueId?: IssueId;
+ issueID?: IssueID;
};
export type DatabasePatch = {
// Related fields
- projectId: ProjectId;
+ projectID: ProjectID;
};
diff --git a/frontend/src/types/environment.ts b/frontend/src/types/environment.ts
index 0617d77697..60280c90d9 100644
--- a/frontend/src/types/environment.ts
+++ b/frontend/src/types/environment.ts
@@ -1,9 +1,9 @@
import { RowStatus } from "./common";
-import { EnvironmentId } from "./id";
+import { EnvironmentID } from "./id";
import { Principal } from "./principal";
export type Environment = {
- id: EnvironmentId;
+ id: EnvironmentID;
// Standard fields
creator: Principal;
diff --git a/frontend/src/types/id.ts b/frontend/src/types/id.ts
index 73f544ba0b..7de891991b 100644
--- a/frontend/src/types/id.ts
+++ b/frontend/src/types/id.ts
@@ -1,74 +1,74 @@
// Use number as the ID type, though the ID type could be transparent to the client and just
// use string, however, that requires server to do string to int conversion since we store
// ID as auto incremental int in the database.
-export type IdType = number;
+export type IDType = number;
-export type ExecutionId = IdType;
+export type ExecutionID = IDType;
-export type PrincipalId = IdType;
+export type PrincipalID = IDType;
-export type MemberId = IdType;
+export type MemberID = IDType;
-export type SettingId = IdType;
+export type SettingID = IDType;
-export type BookmarkId = IdType;
+export type BookmarkID = IDType;
-export type PolicyId = IdType;
+export type PolicyID = IDType;
-export type ProjectId = IdType;
+export type ProjectID = IDType;
-export type ProjectWebhookId = IdType;
+export type ProjectWebhookID = IDType;
-export type IssueId = IdType;
+export type IssueID = IDType;
-export type PipelineId = IdType;
+export type PipelineID = IDType;
-export type StageId = IdType;
+export type StageID = IDType;
-export type TaskId = IdType;
+export type TaskID = IDType;
-export type TaskRunId = IdType;
+export type TaskRunID = IDType;
-export type TaskCheckRunId = IdType;
+export type TaskCheckRunID = IDType;
-export type ActivityId = IdType;
+export type ActivityID = IDType;
-export type InboxId = IdType;
+export type InboxID = IDType;
-export type EnvironmentId = IdType;
+export type EnvironmentID = IDType;
-export type InstanceId = IdType;
+export type InstanceID = IDType;
-export type InstanceUserId = IdType;
+export type InstanceUserID = IDType;
-export type DataSourceId = IdType;
+export type DataSourceID = IDType;
-export type DatabaseId = IdType;
+export type DatabaseID = IDType;
-export type TableId = IdType;
+export type TableID = IDType;
-export type ViewId = IdType;
+export type ViewID = IDType;
-export type ColumnId = IdType;
+export type ColumnID = IDType;
-export type TableIndexId = IdType;
+export type TableIndexID = IDType;
-export type VCSId = IdType;
+export type VCSID = IDType;
-export type RepositoryId = IdType;
+export type RepositoryID = IDType;
-export type MigrationHistoryId = IdType;
+export type MigrationHistoryID = IDType;
-export type BackupId = IdType;
+export type BackupID = IDType;
-export type BackupSettingId = IdType;
+export type BackupSettingID = IDType;
-export type AnomalyId = IdType;
+export type AnomalyID = IDType;
-export type CommandId = IdType;
-export type CommandRegisterId = IdType;
+export type CommandID = IDType;
+export type CommandRegisterID = IDType;
// This references to the object id, which can be used as a container.
// Currently, only issue can be used a container.
// The type is used by Activity and Message
-export type ContainerId = IssueId;
+export type ContainerID = IssueID;
diff --git a/frontend/src/types/inbox.ts b/frontend/src/types/inbox.ts
index 764c014ced..a766156e54 100644
--- a/frontend/src/types/inbox.ts
+++ b/frontend/src/types/inbox.ts
@@ -1,13 +1,13 @@
import { Activity } from "./activity";
-import { InboxId, PrincipalId } from "./id";
+import { InboxID, PrincipalID } from "./id";
export type InboxStatus = "UNREAD" | "READ";
export type Inbox = {
- id: InboxId;
+ id: InboxID;
// Domain specific fields
- receiver_id: PrincipalId;
+ receiver_id: PrincipalID;
activity: Activity;
status: InboxStatus;
};
diff --git a/frontend/src/types/instance.ts b/frontend/src/types/instance.ts
index fa30e33078..ec31caf924 100644
--- a/frontend/src/types/instance.ts
+++ b/frontend/src/types/instance.ts
@@ -1,7 +1,7 @@
import { Anomaly } from ".";
import { RowStatus } from "./common";
import { Environment } from "./environment";
-import { EnvironmentId, InstanceId, MigrationHistoryId } from "./id";
+import { EnvironmentID, InstanceID, MigrationHistoryID } from "./id";
import { Principal } from "./principal";
import { VCSPushEvent } from "./vcs";
@@ -42,7 +42,7 @@ export function defaultCollation(type: EngineType): string {
}
export type Instance = {
- id: InstanceId;
+ id: InstanceID;
// Related fields
environment: Environment;
@@ -69,7 +69,7 @@ export type Instance = {
export type InstanceCreate = {
// Related fields
- environmentId: EnvironmentId;
+ environmentID: EnvironmentID;
// Domain specific fields
name: string;
@@ -114,7 +114,7 @@ export type MigrationHistoryPayload = {
};
export type MigrationHistory = {
- id: MigrationHistoryId;
+ id: MigrationHistoryID;
creator: string;
createdTs: number;
updater: string;
@@ -130,6 +130,6 @@ export type MigrationHistory = {
schema: string;
schemaPrev: string;
executionDuration: number;
- issueId: number;
+ issueID: number;
payload?: MigrationHistoryPayload;
};
diff --git a/frontend/src/types/issue.ts b/frontend/src/types/issue.ts
index 8917f17c67..af6864e8ef 100644
--- a/frontend/src/types/issue.ts
+++ b/frontend/src/types/issue.ts
@@ -1,4 +1,4 @@
-import { IssueId, PrincipalId, ProjectId } from "./id";
+import { IssueID, PrincipalID, ProjectID } from "./id";
import { Pipeline, PipelineCreate } from "./pipeline";
import { Principal } from "./principal";
import { Project } from "./project";
@@ -22,7 +22,7 @@ export type IssueStatus = "OPEN" | "DONE" | "CANCELED";
export type IssuePayload = { [key: string]: any };
export type Issue = {
- id: IssueId;
+ id: IssueID;
// Related fields
project: Project;
@@ -40,21 +40,21 @@ export type Issue = {
type: IssueType;
description: string;
assignee: Principal;
- subscriberIdList: PrincipalId[];
+ subscriberIDList: PrincipalID[];
payload: IssuePayload;
};
export type IssueCreate = {
// Related fields
- projectId: ProjectId;
+ projectID: ProjectID;
pipeline: PipelineCreate;
// Domain specific fields
name: string;
type: IssueType;
description: string;
- assigneeId: PrincipalId;
- rollbackIssueId?: IssueId;
+ assigneeID: PrincipalID;
+ rollbackIssueID?: IssueID;
payload: IssuePayload;
};
@@ -62,7 +62,7 @@ export type IssuePatch = {
// Domain specific fields
name?: string;
description?: string;
- assigneeId?: PrincipalId;
+ assigneeID?: PrincipalID;
payload?: IssuePayload;
};
diff --git a/frontend/src/types/issueSubscriber.ts b/frontend/src/types/issueSubscriber.ts
index 3feac03b53..352d765e8c 100644
--- a/frontend/src/types/issueSubscriber.ts
+++ b/frontend/src/types/issueSubscriber.ts
@@ -1,8 +1,8 @@
-import { IssueId } from "./id";
+import { IssueID } from "./id";
import { Principal } from "./principal";
export type IssueSubscriber = {
// Domain specific fields
- issueId: IssueId;
+ issueID: IssueID;
subscriber: Principal;
};
diff --git a/frontend/src/types/member.ts b/frontend/src/types/member.ts
index 45fbc55dde..d5dd2b0fcc 100644
--- a/frontend/src/types/member.ts
+++ b/frontend/src/types/member.ts
@@ -1,5 +1,5 @@
import { RowStatus } from "./common";
-import { MemberId, PrincipalId } from "./id";
+import { MemberID, PrincipalID } from "./id";
import { Principal } from "./principal";
export type MemberStatus = "INVITED" | "ACTIVE";
@@ -7,7 +7,7 @@ export type MemberStatus = "INVITED" | "ACTIVE";
export type RoleType = "OWNER" | "DBA" | "DEVELOPER";
export type Member = {
- id: MemberId;
+ id: MemberID;
// Standard fields
rowStatus: RowStatus;
@@ -24,7 +24,7 @@ export type Member = {
export type MemberCreate = {
// Domain specific fields
- principalId: PrincipalId;
+ principalID: PrincipalID;
status: MemberStatus;
role: RoleType;
};
diff --git a/frontend/src/types/oauth.ts b/frontend/src/types/oauth.ts
index 021865f33d..245394cef7 100644
--- a/frontend/src/types/oauth.ts
+++ b/frontend/src/types/oauth.ts
@@ -2,7 +2,7 @@ import { randomString } from "../utils";
export type OAuthConfig = {
endpoint: string;
- applicationId: string;
+ applicationID: string;
secret: string;
redirectURL: string;
};
@@ -27,13 +27,13 @@ export function redirectURL(): string {
export function openWindowForOAuth(
endpoint: string,
- applicationId: string
+ applicationID: string
): Window | null {
const stateQueryParameter = randomString(40);
sessionStorage.setItem(OAuthStateSessionKey, stateQueryParameter);
return window.open(
- `${endpoint}?client_id=${applicationId}&redirect_uri=${encodeURIComponent(
+ `${endpoint}?client_id=${applicationID}&redirect_uri=${encodeURIComponent(
redirectURL()
)}&state=${stateQueryParameter}&response_type=code&scope=api`,
"oauth",
diff --git a/frontend/src/types/pipeline/pipeline.ts b/frontend/src/types/pipeline/pipeline.ts
index e335984eb8..205494eac0 100644
--- a/frontend/src/types/pipeline/pipeline.ts
+++ b/frontend/src/types/pipeline/pipeline.ts
@@ -1,4 +1,4 @@
-import { PipelineId } from "../id";
+import { PipelineID } from "../id";
import { Principal } from "../principal";
import { Stage, StageCreate } from "./stage";
@@ -25,7 +25,7 @@ import { Stage, StageCreate } from "./stage";
export type PipelineStatus = "OPEN" | "DONE" | "CANCELED";
export type Pipeline = {
- id: PipelineId;
+ id: PipelineID;
// Related fields
stageList: Stage[];
diff --git a/frontend/src/types/pipeline/stage.ts b/frontend/src/types/pipeline/stage.ts
index aeeb21ecac..6cbca0dffd 100644
--- a/frontend/src/types/pipeline/stage.ts
+++ b/frontend/src/types/pipeline/stage.ts
@@ -1,14 +1,14 @@
// The database belongs to an instance which in turns belongs to an environment.
import { Environment } from "../environment";
-import { EnvironmentId, StageId } from "../id";
+import { EnvironmentID, StageID } from "../id";
import { Principal } from "../principal";
import { Pipeline } from "./pipeline";
import { Task, TaskCreate } from "./task";
// THus stage can access both instance and environment info.
export type Stage = {
- id: StageId;
+ id: StageID;
// Related fields
taskList: Task[];
@@ -28,7 +28,7 @@ export type Stage = {
export type StageCreate = {
// Related fields
taskList: TaskCreate[];
- environmentId: EnvironmentId;
+ environmentID: EnvironmentID;
// Domain specific fields
name: string;
diff --git a/frontend/src/types/pipeline/task.ts b/frontend/src/types/pipeline/task.ts
index 3843f5872c..73973de840 100644
--- a/frontend/src/types/pipeline/task.ts
+++ b/frontend/src/types/pipeline/task.ts
@@ -1,12 +1,12 @@
-import { ErrorCode, MigrationHistoryId, TaskCheckRunId } from "..";
+import { ErrorCode, MigrationHistoryID, TaskCheckRunID } from "..";
import { Database } from "../database";
import {
- BackupId,
- DatabaseId,
- InstanceId,
- ProjectId,
- TaskId,
- TaskRunId,
+ BackupID,
+ DatabaseID,
+ InstanceID,
+ ProjectID,
+ TaskID,
+ TaskRunID,
} from "../id";
import { Instance, MigrationType } from "../instance";
import { Principal } from "../principal";
@@ -33,7 +33,7 @@ export type TaskGeneralPayload = {
};
export type TaskDatabaseCreatePayload = {
- projectId: ProjectId;
+ projectID: ProjectID;
statement: string;
databaseName: string;
characterSet: string;
@@ -49,7 +49,7 @@ export type TaskDatabaseSchemaUpdatePayload = {
export type TaskDatabaseRestorePayload = {
databaseName: string;
- backupId: BackupId;
+ backupID: BackupID;
};
export type TaskPayload =
@@ -59,7 +59,7 @@ export type TaskPayload =
| TaskDatabaseRestorePayload;
export type Task = {
- id: TaskId;
+ id: TaskID;
// Related fields
taskRunList: TaskRun[];
@@ -88,14 +88,14 @@ export type TaskCreate = {
name: string;
status: TaskStatus;
type: TaskType;
- instanceId: InstanceId;
- databaseId?: DatabaseId;
+ instanceID: InstanceID;
+ databaseID?: DatabaseID;
statement: string;
rollbackStatement: string;
databaseName?: string;
characterSet?: string;
collation?: string;
- backupId?: BackupId;
+ backupID?: BackupID;
migrationType?: MigrationType;
};
@@ -114,12 +114,12 @@ export type TaskRunStatus = "RUNNING" | "DONE" | "FAILED" | "CANCELED";
export type TaskRunResultPayload = {
detail: string;
- migrationId?: MigrationHistoryId;
+ migrationID?: MigrationHistoryID;
version?: string;
};
export type TaskRun = {
- id: TaskRunId;
+ id: TaskRunID;
// Standard fields
creator: Principal;
@@ -165,7 +165,7 @@ export type TaskCheckRunResultPayload = {
};
export type TaskCheckRun = {
- id: TaskCheckRunId;
+ id: TaskCheckRunID;
// Standard fields
creator: Principal;
@@ -174,7 +174,7 @@ export type TaskCheckRun = {
updatedTs: number;
// Domain specific fields
- taskId: TaskId;
+ taskID: TaskID;
status: TaskCheckRunStatus;
type: TaskCheckType;
code: ErrorCode;
diff --git a/frontend/src/types/policy.ts b/frontend/src/types/policy.ts
index d0cc13378e..9352c4945e 100644
--- a/frontend/src/types/policy.ts
+++ b/frontend/src/types/policy.ts
@@ -1,4 +1,4 @@
-import { Environment, PolicyId, Principal } from ".";
+import { Environment, PolicyID, Principal } from ".";
export type PolicyType =
| "bb.policy.pipeline-approval"
@@ -23,7 +23,7 @@ export type PolicyPayload =
| PolicyBackupPlanPolicyPayload;
export type Policy = {
- id: PolicyId;
+ id: PolicyID;
// Standard fields
creator: Principal;
diff --git a/frontend/src/types/principal.ts b/frontend/src/types/principal.ts
index 4993b178ec..5ca95859d3 100644
--- a/frontend/src/types/principal.ts
+++ b/frontend/src/types/principal.ts
@@ -1,21 +1,21 @@
// This is a facet of the underlying identity entity.
// For now, there is only user type. In the future,
-import { PrincipalId } from "./id";
+import { PrincipalID } from "./id";
import { RoleType } from "./member";
// we may support application/bot identity.
export type PrincipalType = "END_USER" | "SYSTEM_BOT";
export type Principal = {
- id: PrincipalId;
+ id: PrincipalID;
// Standard fields
- // Unlike other models, we use creatorId and updaterId instead of converting
+ // Unlike other models, we use creatorID and updaterID instead of converting
// them to full principal object to avoid recursive issue.
- creatorId: PrincipalId;
+ creatorID: PrincipalID;
createdTs: number;
- updaterId: PrincipalId;
+ updaterID: PrincipalID;
updatedTs: number;
// Domain specific fields
diff --git a/frontend/src/types/project.ts b/frontend/src/types/project.ts
index b8513a6386..7e4256daad 100644
--- a/frontend/src/types/project.ts
+++ b/frontend/src/types/project.ts
@@ -1,5 +1,5 @@
import { RowStatus } from "./common";
-import { MemberId, PrincipalId, ProjectId } from "./id";
+import { MemberID, PrincipalID, ProjectID } from "./id";
import { OAuthToken } from "./oauth";
import { Principal } from "./principal";
import { ExternalRepositoryInfo, RepositoryConfig } from "./repository";
@@ -13,7 +13,7 @@ export type ProjectVisibility = "PUBLIC" | "PRIVATE";
// Project
export type Project = {
- id: ProjectId;
+ id: ProjectID;
// Standard fields
creator: Principal;
@@ -49,7 +49,7 @@ export type ProjectPatch = {
// Project Member
export type ProjectMember = {
- id: MemberId;
+ id: MemberID;
// Related fields
project: Project;
@@ -67,7 +67,7 @@ export type ProjectMember = {
export type ProjectMemberCreate = {
// Domain specific fields
- principalId: PrincipalId;
+ principalID: PrincipalID;
role: ProjectRoleType;
};
diff --git a/frontend/src/types/projectWebhook.ts b/frontend/src/types/projectWebhook.ts
index 98ef6a053b..e76e1ec41e 100644
--- a/frontend/src/types/projectWebhook.ts
+++ b/frontend/src/types/projectWebhook.ts
@@ -1,5 +1,5 @@
import { ActivityType } from "./activity";
-import { MemberId, ProjectId } from "./id";
+import { MemberID, ProjectID } from "./id";
import { Principal } from "./principal";
type ProjectWebhookTypeItem = {
@@ -77,10 +77,10 @@ export const PROJECT_HOOK_ACTIVITY_ITEM_LIST: ProjectWebhookActivityItem[] = [
// Project Member
export type ProjectWebhook = {
- id: MemberId;
+ id: MemberID;
// Related fields
- projectId: ProjectId;
+ projectID: ProjectID;
// Standard fields
creator: Principal;
diff --git a/frontend/src/types/repository.ts b/frontend/src/types/repository.ts
index 2678774f23..a81c719e15 100644
--- a/frontend/src/types/repository.ts
+++ b/frontend/src/types/repository.ts
@@ -1,11 +1,11 @@
import isEmpty from "lodash-es/isEmpty";
-import { ProjectId, RepositoryId, VCSId } from "./id";
+import { ProjectID, RepositoryID, VCSID } from "./id";
import { Principal } from "./principal";
import { Project } from "./project";
import { VCS } from "./vcs";
export type Repository = {
- id: RepositoryId;
+ id: RepositoryID;
// Standard fields
creator: Principal;
@@ -29,13 +29,13 @@ export type Repository = {
filePathTemplate: string;
schemaPathTemplate: string;
// e.g. In GitLab, this is the corresponding project id.
- externalId: string;
+ externalID: string;
};
export type RepositoryCreate = {
// Related fields
- vcsId: VCSId;
- projectId: ProjectId;
+ vcsID: VCSID;
+ projectID: ProjectID;
// Domain specific fields
name: string;
@@ -45,7 +45,7 @@ export type RepositoryCreate = {
baseDirectory: string;
filePathTemplate: string;
schemaPathTemplate: string;
- externalId: string;
+ externalID: string;
accessToken: string;
expiresTs: number;
refreshToken: string;
@@ -67,7 +67,7 @@ export type RepositoryConfig = {
export type ExternalRepositoryInfo = {
// e.g. In GitLab, this is the corresponding project id. e.g. 123
- externalId: string;
+ externalID: string;
// e.g. sample-project
name: string;
// e.g. bytebase/sample-project
diff --git a/frontend/src/types/setting.ts b/frontend/src/types/setting.ts
index 5a3869483f..a3f628e082 100644
--- a/frontend/src/types/setting.ts
+++ b/frontend/src/types/setting.ts
@@ -1,10 +1,10 @@
-import { SettingId } from "./id";
+import { SettingID } from "./id";
import { Principal } from "./principal";
export type SettingName = "bb.console.url";
export type Setting = {
- id: SettingId;
+ id: SettingID;
// Standard fields
creator: Principal;
diff --git a/frontend/src/types/sql.ts b/frontend/src/types/sql.ts
index da99d58c59..5e4c9ed999 100644
--- a/frontend/src/types/sql.ts
+++ b/frontend/src/types/sql.ts
@@ -1,5 +1,5 @@
import { EngineType } from ".";
-import { InstanceId } from "./id";
+import { InstanceID } from "./id";
export type ConnectionInfo = {
engine: EngineType;
@@ -11,9 +11,9 @@ export type ConnectionInfo = {
useEmptyPassword: boolean;
// Instance detail page has a Test Connection button, if user doesn't input new password, we
// want the connection to use the existing password to test the connection, however, we do
- // not transfer the password back to client, thus we here pass the instanceId so the server
+ // not transfer the password back to client, thus we here pass the instanceID so the server
// can fetch the corresponding password.
- instanceId?: InstanceId;
+ instanceID?: InstanceID;
};
export type SqlResultSet = {
diff --git a/frontend/src/types/store.ts b/frontend/src/types/store.ts
index 99de8a2ea1..afe2a4f4b0 100644
--- a/frontend/src/types/store.ts
+++ b/frontend/src/types/store.ts
@@ -1,4 +1,4 @@
-import { EnvironmentId, MigrationHistoryId, Policy, PolicyType, View } from ".";
+import { EnvironmentID, MigrationHistoryID, Policy, PolicyType, View } from ".";
import { Activity } from "./activity";
import { ServerInfo } from "./actuator";
import { Backup, BackupSetting } from "./backup";
@@ -8,14 +8,14 @@ import { Database } from "./database";
import { DataSource } from "./dataSource";
import { Environment } from "./environment";
import {
- CommandId,
- DatabaseId,
- DataSourceId,
- InstanceId,
- IssueId,
- PrincipalId,
- ProjectId,
- VCSId,
+ CommandID,
+ DatabaseID,
+ DataSourceID,
+ InstanceID,
+ IssueID,
+ PrincipalID,
+ ProjectID,
+ VCSID,
} from "./id";
import { Inbox, InboxSummary } from "./inbox";
import { Instance, MigrationHistory } from "./instance";
@@ -58,25 +58,25 @@ export interface PrincipalState {
}
export interface BookmarkState {
- bookmarkListByUser: Map<PrincipalId, Bookmark[]>;
+ bookmarkListByUser: Map<PrincipalID, Bookmark[]>;
}
export interface ActivityState {
- activityListByUser: Map<PrincipalId, Activity[]>;
- activityListByIssue: Map<IssueId, Activity[]>;
+ activityListByUser: Map<PrincipalID, Activity[]>;
+ activityListByIssue: Map<IssueID, Activity[]>;
}
export interface InboxState {
- inboxListByUser: Map<PrincipalId, Inbox[]>;
- inboxSummaryByUser: Map<PrincipalId, InboxSummary>;
+ inboxListByUser: Map<PrincipalID, Inbox[]>;
+ inboxSummaryByUser: Map<PrincipalID, InboxSummary>;
}
export interface IssueState {
- issueById: Map<IssueId, Issue>;
+ issueByID: Map<IssueID, Issue>;
}
export interface IssueSubscriberState {
- subscriberListByIssue: Map<IssueId, IssueSubscriber[]>;
+ subscriberListByIssue: Map<IssueID, IssueSubscriber[]>;
}
export interface PipelineState {}
@@ -86,15 +86,15 @@ export interface StageState {}
export interface TaskState {}
export interface PolicyState {
- policyMapByEnvironmentId: Map<EnvironmentId, Map<PolicyType, Policy>>;
+ policyMapByEnvironmentID: Map<EnvironmentID, Map<PolicyType, Policy>>;
}
export interface ProjectState {
- projectById: Map<ProjectId, Project>;
+ projectByID: Map<ProjectID, Project>;
}
export interface ProjectWebhookState {
- projectWebhookListByProjectId: Map<ProjectId, ProjectWebhook[]>;
+ projectWebhookListByProjectID: Map<ProjectID, ProjectWebhook[]>;
}
export interface EnvironmentState {
@@ -102,15 +102,15 @@ export interface EnvironmentState {
}
export interface InstanceState {
- instanceById: Map<InstanceId, Instance>;
- instanceUserListById: Map<InstanceId, InstanceUser[]>;
- migrationHistoryById: Map<MigrationHistoryId, MigrationHistory>;
+ instanceByID: Map<InstanceID, Instance>;
+ instanceUserListByID: Map<InstanceID, InstanceUser[]>;
+ migrationHistoryByID: Map<MigrationHistoryID, MigrationHistory>;
// The key is a concatenation of instance id and database name
- migrationHistoryListByIdAndDatabaseName: Map<string, MigrationHistory[]>;
+ migrationHistoryListByIDAndDatabaseName: Map<string, MigrationHistory[]>;
}
export interface DataSourceState {
- dataSourceById: Map<DataSourceId, DataSource>;
+ dataSourceByID: Map<DataSourceID, DataSource>;
}
export interface DatabaseState {
@@ -118,37 +118,37 @@ export interface DatabaseState {
// In those cases, we will iterate through this map and compute the list on the fly.
// We save it by instance because database belongs to instance and saving this way
// follows that hierarchy.
- databaseListByInstanceId: Map<InstanceId, Database[]>;
- // Used exclusively for project panel, we do this to avoid interference from databaseListByInstanceId
- // where updating databaseListByInstanceId will cause reloading project related UI due to reactivity
- databaseListByProjectId: Map<ProjectId, Database[]>;
+ databaseListByInstanceID: Map<InstanceID, Database[]>;
+ // Used exclusively for project panel, we do this to avoid interference from databaseListByInstanceID
+ // where updating databaseListByInstanceID will cause reloading project related UI due to reactivity
+ databaseListByProjectID: Map<ProjectID, Database[]>;
}
export interface TableState {
- tableListByDatabaseId: Map<DatabaseId, Table[]>;
+ tableListByDatabaseID: Map<DatabaseID, Table[]>;
}
export interface ViewState {
- viewListByDatabaseId: Map<DatabaseId, View[]>;
+ viewListByDatabaseID: Map<DatabaseID, View[]>;
}
export interface BackupState {
- backupListByDatabaseId: Map<DatabaseId, Backup[]>;
+ backupListByDatabaseID: Map<DatabaseID, Backup[]>;
}
export interface BackupSettingState {
- backupSettingByDatabaseId: Map<DatabaseId, BackupSetting>;
+ backupSettingByDatabaseID: Map<DatabaseID, BackupSetting>;
}
export interface VCSState {
- vcsById: Map<VCSId, VCS>;
+ vcsByID: Map<VCSID, VCS>;
}
export interface RepositoryState {
- // repositoryListByVCSId are used in workspace version control panel, while repositoryByProjectId are used in project version control panel.
+ // repositoryListByVCSID are used in workspace version control panel, while repositoryByProjectID are used in project version control panel.
// Because they are used separately, so we don't need to worry about repository inconsistency issue betweem them.
- repositoryListByVCSId: Map<VCSId, Repository[]>;
- repositoryByProjectId: Map<ProjectId, Repository>;
+ repositoryListByVCSID: Map<VCSID, Repository[]>;
+ repositoryByProjectID: Map<ProjectID, Repository>;
}
export interface AnomalyState {}
@@ -158,5 +158,5 @@ export interface NotificationState {
}
export interface CommandState {
- commandListById: Map<CommandId, Command[]>;
+ commandListByID: Map<CommandID, Command[]>;
}
diff --git a/frontend/src/types/table.ts b/frontend/src/types/table.ts
index eac141f0bd..37fc03b579 100644
--- a/frontend/src/types/table.ts
+++ b/frontend/src/types/table.ts
@@ -1,6 +1,6 @@
import { Column } from "./column";
import { Database } from "./database";
-import { TableId } from "./id";
+import { TableID } from "./id";
import { Principal } from "./principal";
export type TableType = "BASE TABLE" | "VIEW";
@@ -8,7 +8,7 @@ export type TableEngineType = "InnoDB";
// Table
export type Table = {
- id: TableId;
+ id: TableID;
// Related fields
database: Database;
diff --git a/frontend/src/types/tableIndex.ts b/frontend/src/types/tableIndex.ts
index 318a008d28..fa06fd1b44 100644
--- a/frontend/src/types/tableIndex.ts
+++ b/frontend/src/types/tableIndex.ts
@@ -1,17 +1,17 @@
-import { DatabaseId, TableId, TableIndexId } from "./id";
+import { DatabaseID, TableID, TableIndexID } from "./id";
// Index
export type TableIndex = {
- id: TableIndexId;
+ id: TableIndexID;
// Related fields
- databaseId: DatabaseId;
- tableId: TableId;
+ databaseID: DatabaseID;
+ tableID: TableID;
// Standard fields
- creatorId: number;
+ creatorID: number;
createdTs: number;
- updaterId: number;
+ updaterID: number;
updatedTs: number;
// Domain specific fields
diff --git a/frontend/src/types/vcs.ts b/frontend/src/types/vcs.ts
index 8f7c464b46..919bdd12dd 100644
--- a/frontend/src/types/vcs.ts
+++ b/frontend/src/types/vcs.ts
@@ -1,4 +1,4 @@
-import { VCSId } from "./id";
+import { VCSID } from "./id";
import { Principal } from "./principal";
export type VCSType = "GITLAB_SELF_HOST";
@@ -7,12 +7,12 @@ export interface VCSConfig {
type: VCSType;
name: string;
instanceURL: string;
- applicationId: string;
+ applicationID: string;
secret: string;
}
export type VCS = {
- id: VCSId;
+ id: VCSID;
// Standard fields
creator: Principal;
@@ -25,7 +25,7 @@ export type VCS = {
type: VCSType;
instanceURL: string;
apiURL: string;
- applicationId: string;
+ applicationID: string;
secret: string;
};
@@ -34,14 +34,14 @@ export type VCSCreate = {
name: string;
type: VCSType;
instanceURL: string;
- applicationId: string;
+ applicationID: string;
secret: string;
};
export type VCSPatch = {
// Domain specific fields
name?: string;
- applicationId?: string;
+ applicationID?: string;
secret?: string;
};
@@ -63,13 +63,13 @@ export type VCSFileCommit = {
export type VCSPushEvent = {
vcsType: VCSType;
ref: string;
- repositoryId: string;
+ repositoryID: string;
repositoryUrl: string;
repositoryFullPath: string;
authorName: string;
fileCommit: VCSFileCommit;
};
-export function isValidVCSApplicationIdOrSecret(str: string): boolean {
+export function isValidVCSApplicationIDOrSecret(str: string): boolean {
return /^[a-zA-Z0-9_]{64}$/.test(str);
}
diff --git a/frontend/src/types/view.ts b/frontend/src/types/view.ts
index e05a6d5537..72729fefc1 100644
--- a/frontend/src/types/view.ts
+++ b/frontend/src/types/view.ts
@@ -1,10 +1,10 @@
import { Database } from "./database";
-import { ViewId } from "./id";
+import { ViewID } from "./id";
import { Principal } from "./principal";
// View
export type View = {
- id: ViewId;
+ id: ViewID;
// Related fields
database: Database;
diff --git a/frontend/src/utils/activity.ts b/frontend/src/utils/activity.ts
index 21cf7f9647..c7e5b94fa5 100644
--- a/frontend/src/utils/activity.ts
+++ b/frontend/src/utils/activity.ts
@@ -1,5 +1,5 @@
import { Store } from "vuex";
-import { IssueBuiltinFieldId } from "../plugins";
+import { IssueBuiltinFieldID } from "../plugins";
import {
Activity,
ActivityIssueFieldUpdatePayload,
@@ -25,26 +25,26 @@ export function issueActivityActionSentence(activity: Activity): string {
let oldValue = undefined;
let newValue = undefined;
- switch (update.fieldId) {
- case IssueBuiltinFieldId.ASSIGNEE: {
+ switch (update.fieldID) {
+ case IssueBuiltinFieldID.ASSIGNEE: {
if (update.oldValue && update.newValue) {
- const oldName = store.getters["principal/principalById"](
+ const oldName = store.getters["principal/principalByID"](
update.oldValue
).name;
- const newName = store.getters["principal/principalById"](
+ const newName = store.getters["principal/principalByID"](
update.newValue
).name;
return `reassigned issue from ${oldName} to ${newName}`;
} else if (!update.oldValue && update.newValue) {
- const newName = store.getters["principal/principalById"](
+ const newName = store.getters["principal/principalByID"](
update.newValue
).name;
return `assigned issue to ${newName}`;
} else if (update.oldValue && !update.newValue) {
- const oldName = store.getters["principal/principalById"](
+ const oldName = store.getters["principal/principalByID"](
update.oldValue
).name;
@@ -54,20 +54,20 @@ export function issueActivityActionSentence(activity: Activity): string {
}
}
// We don't display subscriber change for now
- case IssueBuiltinFieldId.SUBSCRIBER_LIST:
+ case IssueBuiltinFieldID.SUBSCRIBER_LIST:
break;
- case IssueBuiltinFieldId.DESCRIPTION:
+ case IssueBuiltinFieldID.DESCRIPTION:
// Description could be very long, so we don't display it.
return "changed description";
- case IssueBuiltinFieldId.NAME:
- case IssueBuiltinFieldId.PROJECT:
- case IssueBuiltinFieldId.SQL:
- case IssueBuiltinFieldId.ROLLBACK_SQL: {
- if (update.fieldId == IssueBuiltinFieldId.NAME) {
+ case IssueBuiltinFieldID.NAME:
+ case IssueBuiltinFieldID.PROJECT:
+ case IssueBuiltinFieldID.SQL:
+ case IssueBuiltinFieldID.ROLLBACK_SQL: {
+ if (update.fieldID == IssueBuiltinFieldID.NAME) {
name = "name";
- } else if (update.fieldId == IssueBuiltinFieldId.SQL) {
+ } else if (update.fieldID == IssueBuiltinFieldID.SQL) {
name = "SQL";
- } else if (update.fieldId == IssueBuiltinFieldId.ROLLBACK_SQL) {
+ } else if (update.fieldID == IssueBuiltinFieldID.ROLLBACK_SQL) {
name = "Rollback SQL";
}
diff --git a/frontend/src/utils/issue.ts b/frontend/src/utils/issue.ts
index 4ef6982541..3aeeb963cf 100644
--- a/frontend/src/utils/issue.ts
+++ b/frontend/src/utils/issue.ts
@@ -1,8 +1,8 @@
-import { Issue, StageId } from "../types";
+import { Issue, StageID } from "../types";
-export function stageName(issue: Issue, stageId: StageId): string {
+export function stageName(issue: Issue, stageID: StageID): string {
for (const stage of issue.pipeline.stageList) {
- if (stage.id == stageId) {
+ if (stage.id == stageID) {
return stage.name;
}
}
diff --git a/frontend/src/utils/pipeline.ts b/frontend/src/utils/pipeline.ts
index ddfead7dc9..f495d58c50 100644
--- a/frontend/src/utils/pipeline.ts
+++ b/frontend/src/utils/pipeline.ts
@@ -7,7 +7,7 @@ import {
PipelineCreate,
Stage,
Task,
- TaskId,
+ TaskID,
TaskStatus,
unknown,
UNKNOWN_ID,
@@ -59,10 +59,10 @@ export function lastTask(pipeline: Pipeline): Task {
return empty("TASK") as Task;
}
-export function findTaskById(pipeline: Pipeline, taskId: TaskId): Task {
+export function findTaskByID(pipeline: Pipeline, taskID: TaskID): Task {
for (const stage of pipeline.stageList) {
for (const task of stage.taskList) {
- if (task.id == taskId) {
+ if (task.id == taskID) {
return task;
}
}
diff --git a/frontend/src/utils/slug.ts b/frontend/src/utils/slug.ts
index 667f630666..771cb5ccee 100644
--- a/frontend/src/utils/slug.ts
+++ b/frontend/src/utils/slug.ts
@@ -4,16 +4,16 @@ import {
DataSource,
Environment,
Instance,
- IssueId,
- MigrationHistoryId,
+ IssueID,
+ MigrationHistoryID,
Project,
ProjectWebhook,
Task,
VCS,
} from "../types";
-import { IdType } from "../types/id";
+import { IDType } from "../types/id";
-export function idFromSlug(slug: string): IdType {
+export function idFromSlug(slug: string): IDType {
const parts = slug.split("-");
return parseInt(parts[parts.length - 1]);
}
@@ -23,8 +23,8 @@ export function indexFromSlug(slug: string): number {
return parseInt(parts[parts.length - 1]) - 1;
}
-export function issueSlug(issueName: string, issueId: IssueId): string {
- return [slug(issueName), issueId].join("-");
+export function issueSlug(issueName: string, issueID: IssueID): string {
+ return [slug(issueName), issueID].join("-");
}
// On the other hand, it's not possible to de-slug due to slug's one-way algorithm
@@ -65,10 +65,10 @@ export function dataSourceSlug(dataSource: DataSource): string {
}
export function migrationHistorySlug(
- migrationHistoryId: MigrationHistoryId,
+ migrationHistoryID: MigrationHistoryID,
version: string
): string {
- return [slug(version), migrationHistoryId].join("-");
+ return [slug(version), migrationHistoryID].join("-");
}
export function fullDatabasePath(database: Database): string {
diff --git a/frontend/src/views/AnomalyCenterDashboard.vue b/frontend/src/views/AnomalyCenterDashboard.vue
index 2edafb0f17..c11788ed46 100644
--- a/frontend/src/views/AnomalyCenterDashboard.vue
+++ b/frontend/src/views/AnomalyCenterDashboard.vue
@@ -137,7 +137,7 @@
import { computed, reactive, watchEffect } from "vue-demi";
import { useStore } from "vuex";
import AnomalyTable from "../components/AnomalyTable.vue";
-import { Anomaly, Database, EnvironmentId } from "../types";
+import { Anomaly, Database, EnvironmentID } from "../types";
import {
databaseSlug,
instanceSlug,
@@ -190,7 +190,7 @@ export default {
watchEffect(prepareDatabaseList);
const databaseList = computed((): Database[] => {
- return store.getters["database/databaseListByPrincipalId"](
+ return store.getters["database/databaseListByPrincipalID"](
currentUser.value.id
);
});
@@ -276,7 +276,7 @@ export default {
);
const databaseAnomalySummaryList = computed((): Summary[] => {
- const envMap: Map<EnvironmentId, Summary> = new Map();
+ const envMap: Map<EnvironmentID, Summary> = new Map();
for (const database of databaseList.value) {
let criticalCount = 0;
let highCount = 0;
@@ -321,7 +321,7 @@ export default {
});
const instanceAnomalySummaryList = computed((): Summary[] => {
- const envMap: Map<EnvironmentId, Summary> = new Map();
+ const envMap: Map<EnvironmentID, Summary> = new Map();
for (const instance of instanceList.value) {
let criticalCount = 0;
let highCount = 0;
diff --git a/frontend/src/views/Archive.vue b/frontend/src/views/Archive.vue
index f59dee3064..5d0bcbf76f 100644
--- a/frontend/src/views/Archive.vue
+++ b/frontend/src/views/Archive.vue
@@ -82,7 +82,7 @@ export default {
// It will also be called when user logout
if (currentUser.value.id != UNKNOWN_ID) {
store.dispatch("project/fetchProjectListByUser", {
- userId: currentUser.value.id,
+ userID: currentUser.value.id,
rowStatusList: ["ARCHIVED"],
});
}
diff --git a/frontend/src/views/DataSourceDetail.vue b/frontend/src/views/DataSourceDetail.vue
index 0cc8ebd1cc..6c994682a6 100644
--- a/frontend/src/views/DataSourceDetail.vue
+++ b/frontend/src/views/DataSourceDetail.vue
@@ -222,7 +222,7 @@ export default {
const store = useStore();
const router = useRouter();
- const dataSourceId = idFromSlug(props.dataSourceSlug);
+ const dataSourceID = idFromSlug(props.dataSourceSlug);
const state = reactive<LocalState>({
editing: false,
@@ -234,7 +234,7 @@ export default {
);
const dataSource = computed((): DataSource => {
- return store.getters["dataSource/dataSourceById"](dataSourceId);
+ return store.getters["dataSource/dataSourceByID"](dataSourceID);
});
const isCurrentUserDBAOrOwner = computed((): boolean => {
@@ -272,7 +272,7 @@ export default {
};
store
.dispatch("dataSource/patchDataSource", {
- databaseId: dataSource.value.database.id,
+ databaseID: dataSource.value.database.id,
dataSourceid: dataSource.value.id,
dataSource: dataSourcePatch,
})
@@ -285,9 +285,9 @@ export default {
const doDelete = () => {
const name = dataSource.value.name;
store
- .dispatch("dataSource/deleteDataSourceById", {
- databaseId: dataSource.value.database.id,
- dataSourceId,
+ .dispatch("dataSource/deleteDataSourceByID", {
+ databaseID: dataSource.value.database.id,
+ dataSourceID,
})
.then(() => {
store.dispatch("notification/pushNotification", {
diff --git a/frontend/src/views/DatabaseDashboard.vue b/frontend/src/views/DatabaseDashboard.vue
index 75cde7233a..94969f1fd9 100644
--- a/frontend/src/views/DatabaseDashboard.vue
+++ b/frontend/src/views/DatabaseDashboard.vue
@@ -2,7 +2,7 @@
<div class="flex flex-col">
<div class="px-5 py-2 flex justify-between items-center">
<EnvironmentTabFilter
- :selectedId="state.selectedEnvironment?.id"
+ :selectedID="state.selectedEnvironment?.id"
@select-environment="selectEnvironment"
/>
<BBTableSearch
@@ -64,7 +64,7 @@ export default {
searchText: "",
databaseList: [],
selectedEnvironment: router.currentRoute.value.query.environment
- ? store.getters["environment/environmentById"](
+ ? store.getters["environment/environmentByID"](
router.currentRoute.value.query.environment
)
: undefined,
diff --git a/frontend/src/views/DatabaseDetail.vue b/frontend/src/views/DatabaseDetail.vue
index 590dd5b663..ad4e49c529 100644
--- a/frontend/src/views/DatabaseDetail.vue
+++ b/frontend/src/views/DatabaseDetail.vue
@@ -76,7 +76,7 @@
<dd class="flex items-center text-sm md:mr-4 tooltip-wrapper">
<span class="textlabel">Restored&nbsp;from&nbsp;</span>
<router-link
- :to="`/db/${database.sourceBackup.databaseId}`"
+ :to="`/db/${database.sourceBackup.databaseID}`"
class="normal-link"
>
<!-- Do not display the name of the backup's database because that requires a fetch -->
@@ -181,10 +181,10 @@
name="project"
:allowedRoleList="['OWNER']"
:includeDefaultProject="true"
- :selectedId="state.editingProjectId"
+ :selectedID="state.editingProjectID"
@select-project-id="
- (projectId) => {
- state.editingProjectId = projectId;
+ (projectID) => {
+ state.editingProjectID = projectID;
}
"
/>
@@ -200,9 +200,9 @@
<button
type="button"
class="btn-primary ml-3 inline-flex justify-center py-2 px-4"
- :disabled="state.editingProjectId == database.project.id"
+ :disabled="state.editingProjectID == database.project.id"
@click.prevent="
- updateProject(state.editingProjectId);
+ updateProject(state.editingProjectID);
state.showModal = false;
"
>
@@ -254,7 +254,7 @@ import DatabaseOverviewPanel from "../components/DatabaseOverviewPanel.vue";
import InstanceEngineIcon from "../components/InstanceEngineIcon.vue";
import { consoleLink, idFromSlug, isDBAOrOwner } from "../utils";
import {
- ProjectId,
+ ProjectID,
UNKNOWN_ID,
DEFAULT_PROJECT_ID,
Repository,
@@ -280,7 +280,7 @@ const databaseTabItemList: DatabaseTabItem[] = [
interface LocalState {
showModal: boolean;
- editingProjectId: ProjectId;
+ editingProjectID: ProjectID;
selectedIndex: number;
}
@@ -306,14 +306,14 @@ export default {
const state = reactive<LocalState>({
showModal: false,
- editingProjectId: UNKNOWN_ID,
+ editingProjectID: UNKNOWN_ID,
selectedIndex: OVERVIEW_TAB,
});
const currentUser = computed(() => store.getters["auth/currentUser"]());
const database = computed(() => {
- return store.getters["database/databaseById"](
+ return store.getters["database/databaseByID"](
idFromSlug(props.databaseSlug)
);
});
@@ -412,7 +412,7 @@ export default {
});
const tryTransferProject = () => {
- state.editingProjectId = database.value.project.id;
+ state.editingProjectID = database.value.project.id;
state.showModal = true;
};
@@ -433,7 +433,7 @@ export default {
} else if (database.value.project.workflowType == "VCS") {
store
.dispatch(
- "repository/fetchRepositoryByProjectId",
+ "repository/fetchRepositoryByProjectID",
database.value.project.id
)
.then((repository: Repository) => {
@@ -442,11 +442,11 @@ export default {
}
};
- const updateProject = (newProjectId: ProjectId) => {
+ const updateProject = (newProjectID: ProjectID) => {
store
.dispatch("database/transferProject", {
- databaseId: database.value.id,
- projectId: newProjectId,
+ databaseID: database.value.id,
+ projectID: newProjectID,
})
.then((updatedDatabase) => {
store.dispatch("notification/pushNotification", {
diff --git a/frontend/src/views/DatabaseGrant.vue b/frontend/src/views/DatabaseGrant.vue
index fc3a8abfe3..5fd95858c6 100644
--- a/frontend/src/views/DatabaseGrant.vue
+++ b/frontend/src/views/DatabaseGrant.vue
@@ -15,8 +15,8 @@ input[type="number"] {
<template>
<DataSourceMemberForm
:dataSource="state.dataSource"
- :principalId="state.granteeId"
- :issueId="state.issueId"
+ :principalID="state.granteeID"
+ :issueID="state.issueID"
@submit="submit"
@cancel="cancel"
/>
@@ -27,13 +27,13 @@ import { reactive, onMounted, onUnmounted } from "vue";
import { useStore } from "vuex";
import { useRouter } from "vue-router";
import DataSourceMemberForm from "../components/DataSourceMemberForm.vue";
-import { IssueId, PrincipalId, DataSource } from "../types";
+import { IssueID, PrincipalID, DataSource } from "../types";
import { fullDataSourcePath } from "../utils";
interface LocalState {
dataSource?: DataSource;
- granteeId?: PrincipalId;
- issueId?: IssueId;
+ granteeID?: PrincipalID;
+ issueID?: IssueID;
}
export default {
@@ -61,16 +61,16 @@ export default {
const dataSource =
router.currentRoute.value.query.datasource &&
router.currentRoute.value.query.database
- ? await store.dispatch("dataSource/fetchDataSourceById", {
- dataSourceId: router.currentRoute.value.query.datasource,
- databaseId: router.currentRoute.value.query.database,
+ ? await store.dispatch("dataSource/fetchDataSourceByID", {
+ dataSourceID: router.currentRoute.value.query.datasource,
+ databaseID: router.currentRoute.value.query.database,
})
: undefined;
const state = reactive<LocalState>({
dataSource,
- granteeId: router.currentRoute.value.query.grantee as PrincipalId,
- issueId: router.currentRoute.value.query.issue as IssueId,
+ granteeID: router.currentRoute.value.query.grantee as PrincipalID,
+ issueID: router.currentRoute.value.query.issue as IssueID,
});
const cancel = () => {
diff --git a/frontend/src/views/EnvironmentDashboard.vue b/frontend/src/views/EnvironmentDashboard.vue
index 311338cf49..34b40f0c00 100644
--- a/frontend/src/views/EnvironmentDashboard.vue
+++ b/frontend/src/views/EnvironmentDashboard.vue
@@ -162,14 +162,14 @@ export default {
onMounted(() => {
store.dispatch("command/registerCommand", {
id: "bb.environment.create",
- registerId: "environment.dashboard",
+ registerID: "environment.dashboard",
run: () => {
createEnvironment();
},
});
store.dispatch("command/registerCommand", {
id: "bb.environment.reorder",
- registerId: "environment.dashboard",
+ registerID: "environment.dashboard",
run: () => {
startReorder();
},
@@ -191,11 +191,11 @@ export default {
onUnmounted(() => {
store.dispatch("command/unregisterCommand", {
id: "bb.environment.create",
- registerId: "environment.dashboard",
+ registerID: "environment.dashboard",
});
store.dispatch("command/unregisterCommand", {
id: "bb.environment.reorder",
- registerId: "environment.dashboard",
+ registerID: "environment.dashboard",
});
});
@@ -242,12 +242,12 @@ export default {
.then((environment: Environment) => {
Promise.all([
store.dispatch("policy/upsertPolicyByEnvironmentAndType", {
- environmentId: environment.id,
+ environmentID: environment.id,
type: "bb.policy.pipeline-approval",
policyUpsert: { payload: approvalPolicy.payload },
}),
store.dispatch("policy/upsertPolicyByEnvironmentAndType", {
- environmentId: environment.id,
+ environmentID: environment.id,
type: "bb.policy.backup-plan",
policyUpsert: { payload: backupPolicy.payload },
}),
diff --git a/frontend/src/views/EnvironmentDetail.vue b/frontend/src/views/EnvironmentDetail.vue
index 9234af4cfe..d4b68ee328 100644
--- a/frontend/src/views/EnvironmentDetail.vue
+++ b/frontend/src/views/EnvironmentDetail.vue
@@ -21,7 +21,7 @@ import ArchiveBanner from "../components/ArchiveBanner.vue";
import EnvironmentForm from "../components/EnvironmentForm.vue";
import {
Environment,
- EnvironmentId,
+ EnvironmentID,
EnvironmentPatch,
Policy,
PolicyType,
@@ -53,7 +53,7 @@ export default {
const store = useStore();
const state = reactive<LocalState>({
- environment: store.getters["environment/environmentById"](
+ environment: store.getters["environment/environmentByID"](
idFromSlug(props.environmentSlug)
),
showArchiveModal: false,
@@ -62,7 +62,7 @@ export default {
const preparePolicy = () => {
store
.dispatch("policy/fetchPolicyByEnvironmentAndType", {
- environmentId: (state.environment as Environment).id,
+ environmentID: (state.environment as Environment).id,
type: "bb.policy.pipeline-approval",
})
.then((policy: Policy) => {
@@ -71,7 +71,7 @@ export default {
store
.dispatch("policy/fetchPolicyByEnvironmentAndType", {
- environmentId: (state.environment as Environment).id,
+ environmentID: (state.environment as Environment).id,
type: "bb.policy.backup-plan",
})
.then((policy: Policy) => {
@@ -88,7 +88,7 @@ export default {
const doUpdate = (environmentPatch: EnvironmentPatch) => {
store
.dispatch("environment/patchEnvironment", {
- environmentId: idFromSlug(props.environmentSlug),
+ environmentID: idFromSlug(props.environmentSlug),
environmentPatch,
})
.then((environment) => {
@@ -99,7 +99,7 @@ export default {
const doArchive = (environment: Environment) => {
store
.dispatch("environment/patchEnvironment", {
- environmentId: environment.id,
+ environmentID: environment.id,
environmentPatch: {
rowStatus: "ARCHIVED",
},
@@ -113,7 +113,7 @@ export default {
const doRestore = (environment: Environment) => {
store
.dispatch("environment/patchEnvironment", {
- environmentId: environment.id,
+ environmentID: environment.id,
environmentPatch: {
rowStatus: "NORMAL",
},
@@ -124,13 +124,13 @@ export default {
};
const updatePolicy = (
- environmentId: EnvironmentId,
+ environmentID: EnvironmentID,
type: PolicyType,
policy: Policy
) => {
store
.dispatch("policy/upsertPolicyByEnvironmentAndType", {
- environmentId,
+ environmentID,
type: type,
policyUpsert: {
payload: policy.payload,
diff --git a/frontend/src/views/Home.vue b/frontend/src/views/Home.vue
index e3375664c1..9f4846e3cb 100644
--- a/frontend/src/views/Home.vue
+++ b/frontend/src/views/Home.vue
@@ -2,7 +2,7 @@
<div class="flex flex-col">
<div class="px-5 py-2 flex justify-between items-center">
<EnvironmentTabFilter
- :selectedId="state.selectedEnvironment?.id"
+ :selectedID="state.selectedEnvironment?.id"
@select-environment="selectEnvironment"
/>
<BBTableSearch
@@ -87,7 +87,7 @@ export default {
closedList: [],
searchText: "",
selectedEnvironment: router.currentRoute.value.query.environment
- ? store.getters["environment/environmentById"](
+ ? store.getters["environment/environmentByID"](
router.currentRoute.value.query.environment
)
: undefined,
@@ -106,7 +106,7 @@ export default {
store
.dispatch("issue/fetchIssueList", {
issueStatusList: ["OPEN"],
- userId: currentUser.value.id,
+ userID: currentUser.value.id,
})
.then((issueList: Issue[]) => {
state.assignedList = [];
@@ -118,7 +118,7 @@ export default {
} else if (issue.creator.id === currentUser.value.id) {
state.createdList.push(issue);
} else if (
- issue.subscriberIdList.includes(currentUser.value.id)
+ issue.subscriberIDList.includes(currentUser.value.id)
) {
state.subscribeList.push(issue);
}
@@ -128,7 +128,7 @@ export default {
store
.dispatch("issue/fetchIssueList", {
issueStatusList: ["DONE", "CANCELED"],
- userId: currentUser.value.id,
+ userID: currentUser.value.id,
limit: MAX_CLOSED_ISSUE_COUNT,
})
.then((issueList: Issue[]) => {
@@ -137,7 +137,7 @@ export default {
if (
issue.creator.id === currentUser.value.id ||
issue.assignee?.id === currentUser.value.id ||
- issue.subscriberIdList.includes(currentUser.value.id)
+ issue.subscriberIDList.includes(currentUser.value.id)
) {
state.closedList.push(issue);
}
diff --git a/frontend/src/views/Inbox.vue b/frontend/src/views/Inbox.vue
index 0de0e36f7f..e0fa35e2ef 100644
--- a/frontend/src/views/Inbox.vue
+++ b/frontend/src/views/Inbox.vue
@@ -95,7 +95,7 @@ export default {
if (currentUser.value.id != UNKNOWN_ID) {
store
.dispatch("inbox/fetchInboxListByUser", {
- userId: currentUser.value.id,
+ userID: currentUser.value.id,
readCreatedAfterTs: state.readCreatedAfterTs,
})
.then((list: Inbox[]) => {
@@ -122,7 +122,7 @@ export default {
inboxList.forEach((item: Inbox) => {
store
.dispatch("inbox/patchInbox", {
- inboxId: item.id,
+ inboxID: item.id,
inboxPatch: {
status: "READ",
},
diff --git a/frontend/src/views/InstanceDashboard.vue b/frontend/src/views/InstanceDashboard.vue
index 7247c4c83f..69922d7b7f 100644
--- a/frontend/src/views/InstanceDashboard.vue
+++ b/frontend/src/views/InstanceDashboard.vue
@@ -2,7 +2,7 @@
<div class="flex flex-col">
<div class="px-5 py-2 flex justify-between items-center">
<EnvironmentTabFilter
- :selectedId="state.selectedEnvironment?.id"
+ :selectedID="state.selectedEnvironment?.id"
@select-environment="selectEnvironment"
/>
<BBTableSearch
@@ -66,7 +66,7 @@ export default {
const state = reactive<LocalState>({
searchText: "",
selectedEnvironment: router.currentRoute.value.query.environment
- ? store.getters["environment/environmentById"](
+ ? store.getters["environment/environmentByID"](
router.currentRoute.value.query.environment
)
: undefined,
diff --git a/frontend/src/views/InstanceDetail.vue b/frontend/src/views/InstanceDetail.vue
index dfabe33033..a9d0287c21 100644
--- a/frontend/src/views/InstanceDetail.vue
+++ b/frontend/src/views/InstanceDetail.vue
@@ -109,8 +109,8 @@
@close="state.showCreateDatabaseModal = false"
>
<CreateDatabasePrepForm
- :environmentId="instance.environment.id"
- :instanceId="instance.id"
+ :environmentID="instance.environment.id"
+ :instanceID="instance.id"
@dismiss="state.showCreateDatabaseModal = false"
/>
</BBModal>
@@ -179,7 +179,7 @@ export default {
});
const instance = computed((): Instance => {
- return store.getters["instance/instanceById"](
+ return store.getters["instance/instanceByID"](
idFromSlug(props.instanceSlug)
);
});
@@ -241,7 +241,7 @@ export default {
);
const databaseList = computed(() => {
- const list = store.getters["database/databaseListByInstanceId"](
+ const list = store.getters["database/databaseListByInstanceID"](
instance.value.id
);
if (isDBAOrOwner(currentUser.value.role)) {
@@ -264,7 +264,7 @@ export default {
});
const instanceUserList = computed(() => {
- return store.getters["instance/instanceUserListById"](instance.value.id);
+ return store.getters["instance/instanceUserListByID"](instance.value.id);
});
const allowEdit = computed(() => {
@@ -290,7 +290,7 @@ export default {
const doArchive = () => {
store
.dispatch("instance/patchInstance", {
- instanceId: instance.value.id,
+ instanceID: instance.value.id,
instancePatch: {
rowStatus: "ARCHIVED",
},
@@ -307,7 +307,7 @@ export default {
const doRestore = () => {
store
.dispatch("instance/patchInstance", {
- instanceId: instance.value.id,
+ instanceID: instance.value.id,
instancePatch: {
rowStatus: "NORMAL",
},
diff --git a/frontend/src/views/IssueDashboard.vue b/frontend/src/views/IssueDashboard.vue
index 5ec6c1d4da..7e0c26d254 100644
--- a/frontend/src/views/IssueDashboard.vue
+++ b/frontend/src/views/IssueDashboard.vue
@@ -3,7 +3,7 @@
<div class="flex flex-col">
<div class="px-4 py-2 flex justify-between items-center">
<EnvironmentTabFilter
- :selectedId="state.selectedEnvironment?.id"
+ :selectedID="state.selectedEnvironment?.id"
@select-environment="selectEnvironment"
/>
<div class="flex flex-row space-x-4">
@@ -24,7 +24,7 @@
</button>
<MemberSelect
v-if="scopeByPrincipal"
- :selectedId="state.selectedPrincipalId"
+ :selectedID="state.selectedPrincipalID"
@select-principal-id="selectPrincipal"
/>
<BBTableSearch
@@ -51,7 +51,7 @@ import { useStore } from "vuex";
import EnvironmentTabFilter from "../components/EnvironmentTabFilter.vue";
import IssueTable from "../components/IssueTable.vue";
import MemberSelect from "../components/MemberSelect.vue";
-import { Environment, Issue, PrincipalId, ProjectId } from "../types";
+import { Environment, Issue, PrincipalID, ProjectID } from "../types";
import { computed, onMounted, watchEffect } from "@vue/runtime-core";
import { activeEnvironment, projectSlug } from "../utils";
import { BBTableSectionDataSource } from "../bbkit/types";
@@ -62,9 +62,9 @@ interface LocalState {
openList: Issue[];
closedList: Issue[];
searchText: string;
- selectedPrincipalId: PrincipalId;
+ selectedPrincipalID: PrincipalID;
selectedEnvironment?: Environment;
- selectedProjectId?: ProjectId;
+ selectedProjectID?: ProjectID;
}
export default {
@@ -98,13 +98,13 @@ export default {
openList: [],
closedList: [],
searchText: "",
- selectedPrincipalId: currentUser.value.id,
+ selectedPrincipalID: currentUser.value.id,
selectedEnvironment: router.currentRoute.value.query.environment
- ? store.getters["environment/environmentById"](
+ ? store.getters["environment/environmentByID"](
router.currentRoute.value.query.environment
)
: undefined,
- selectedProjectId: router.currentRoute.value.query.project
+ selectedProjectID: router.currentRoute.value.query.project
? parseInt(router.currentRoute.value.query.project as string)
: undefined,
});
@@ -115,8 +115,8 @@ export default {
});
const project = computed(() => {
- if (state.selectedProjectId) {
- return store.getters["project/projectById"](state.selectedProjectId);
+ if (state.selectedProjectID) {
+ return store.getters["project/projectByID"](state.selectedProjectID);
}
return undefined;
});
@@ -128,8 +128,8 @@ export default {
store
.dispatch("issue/fetchIssueList", {
issueStatusList: ["OPEN"],
- userId: scopeByPrincipal ? state.selectedPrincipalId : undefined,
- projectId: state.selectedProjectId,
+ userID: scopeByPrincipal ? state.selectedPrincipalID : undefined,
+ projectID: state.selectedProjectID,
})
.then((issueList: Issue[]) => {
state.openList = issueList;
@@ -140,8 +140,8 @@ export default {
store
.dispatch("issue/fetchIssueList", {
issueStatusList: ["DONE", "CANCELED"],
- userId: scopeByPrincipal ? state.selectedPrincipalId : undefined,
- projectId: state.selectedProjectId,
+ userID: scopeByPrincipal ? state.selectedPrincipalID : undefined,
+ projectID: state.selectedProjectID,
})
.then((issueList: Issue[]) => {
state.closedList = issueList;
@@ -209,13 +209,13 @@ export default {
}
};
- const selectPrincipal = (principalId: PrincipalId) => {
- state.selectedPrincipalId = principalId;
+ const selectPrincipal = (principalID: PrincipalID) => {
+ state.selectedPrincipalID = principalID;
router.replace({
name: "workspace.issue",
query: {
...router.currentRoute.value.query,
- user: principalId,
+ user: principalID,
},
});
};
diff --git a/frontend/src/views/IssueDetail.vue b/frontend/src/views/IssueDetail.vue
index 9770481308..76089d1e55 100644
--- a/frontend/src/views/IssueDetail.vue
+++ b/frontend/src/views/IssueDetail.vue
@@ -79,7 +79,7 @@
:create="state.create"
:pipeline="issue.pipeline"
:selectedStage="selectedStage"
- @select-stage-id="selectStageId"
+ @select-stage-id="selectStageID"
/>
<div v-if="!state.create" class="px-4 py-4 md:flex md:flex-col border-b">
<IssueStagePanel :stage="selectedStage" />
@@ -129,11 +129,11 @@
:selectedStage="selectedStage"
:inputFieldList="issueTemplate.inputFieldList"
:allowEdit="allowEditSidebar"
- @update-assignee-id="updateAssigneeId"
- @add-subscriber-id="addSubscriberId"
- @remove-subscriber-id="removeSubscriberId"
+ @update-assignee-id="updateAssigneeID"
+ @add-subscriber-id="addSubscriberID"
+ @remove-subscriber-id="removeSubscriberID"
@update-custom-field="updateCustomField"
- @select-stage-id="selectStageId"
+ @select-stage-id="selectStageID"
/>
</div>
<div class="lg:hidden border-t border-block-border" />
@@ -230,7 +230,7 @@
<IssueActivityPanel
:issue="issue"
:issueTemplate="issueTemplate"
- @add-subscriber-id="addSubscriberId"
+ @add-subscriber-id="addSubscriberID"
/>
</section>
</div>
@@ -264,7 +264,7 @@ import {
activeStage,
stageSlug,
activeTask,
- findTaskById,
+ findTaskByID,
} from "../utils";
import IssueHighlightPanel from "../components/IssueHighlightPanel.vue";
import IssueStagePanel from "../components/IssueStagePanel.vue";
@@ -282,14 +282,14 @@ import {
IssueCreate,
IssueType,
IssuePatch,
- PrincipalId,
+ PrincipalID,
Database,
Instance,
Environment,
Stage,
- StageId,
+ StageID,
IssueStatus,
- TaskId,
+ TaskID,
TaskStatusPatch,
TaskStatus,
IssueStatusPatch,
@@ -303,7 +303,7 @@ import {
POLL_JITTER,
POST_CHANGE_POLL_INTERVAL,
Project,
- IssueId,
+ IssueID,
MigrationType,
TaskPatch,
Policy,
@@ -393,7 +393,7 @@ export default {
// Create rollback issue
if (router.currentRoute.value.query.rollbackIssue) {
- const rollbackIssue: Issue = store.getters["issue/issueById"](
+ const rollbackIssue: Issue = store.getters["issue/issueByID"](
parseInt(router.currentRoute.value.query.rollbackIssue as string)
);
@@ -466,7 +466,7 @@ export default {
) {
environmentList.push(stage.environment);
approvalPolicyList.push(
- store.getters["policy/policyByEnvironmentIdAndType"](
+ store.getters["policy/policyByEnvironmentIDAndType"](
stage.environment.id,
"bb.policy.pipeline-approval"
)
@@ -492,7 +492,7 @@ export default {
currentUser: currentUser.value,
}),
name: "INVALID STATE, no applicable update schema task to rollback.",
- projectId: UNKNOWN_ID,
+ projectID: UNKNOWN_ID,
};
} else {
newIssue = {
@@ -504,12 +504,12 @@ export default {
rollbackStatementList,
currentUser: currentUser.value,
}),
- projectId: rollbackIssue.project.id,
+ projectID: rollbackIssue.project.id,
name: `[Rollback] issue/${rollbackIssue.id} - ${rollbackIssue.name}`,
description: rollbackIssue.description
? `====Original issue description BEGIN====\n\n${rollbackIssue.description}\n\n====Original issue description END====\n\n`
: "",
- assigneeId: rollbackIssue.assignee.id,
+ assigneeID: rollbackIssue.assignee.id,
};
}
} else {
@@ -521,20 +521,20 @@ export default {
currentUser: currentUser.value,
}),
name: title,
- projectId: UNKNOWN_ID,
+ projectID: UNKNOWN_ID,
};
}
- newIssue.rollbackIssueId = rollbackIssue.id;
+ newIssue.rollbackIssueID = rollbackIssue.id;
}
// Create issue from normal query parameter
else {
const databaseList: Database[] = [];
if (router.currentRoute.value.query.databaseList) {
- for (const databaseId of (
+ for (const databaseID of (
router.currentRoute.value.query.databaseList as string
).split(","))
databaseList.push(
- store.getters["database/databaseById"](databaseId)
+ store.getters["database/databaseByID"](databaseID)
);
}
@@ -542,7 +542,7 @@ export default {
const approvalPolicyList: Policy[] = [];
if (router.currentRoute.value.query.environment) {
environmentList.push(
- store.getters["environment/environmentById"](
+ store.getters["environment/environmentByID"](
router.currentRoute.value.query.environment
)
);
@@ -558,7 +558,7 @@ export default {
for (const environment of environmentList) {
approvalPolicyList.push(
- store.getters["policy/policyByEnvironmentIdAndType"](
+ store.getters["policy/policyByEnvironmentIDAndType"](
environment.id,
"bb.policy.pipeline-approval"
)
@@ -572,14 +572,14 @@ export default {
databaseList,
currentUser: currentUser.value,
}),
- projectId: router.currentRoute.value.query.project
+ projectID: router.currentRoute.value.query.project
? parseInt(router.currentRoute.value.query.project as string)
: UNKNOWN_ID,
};
// For demo mode, we assign the issue to the current user, so it can also experience the assignee user flow.
if (store.getters["actuator/isDemo"]()) {
- newIssue.assigneeId = currentUser.value.id;
+ newIssue.assigneeID = currentUser.value.id;
}
if (router.currentRoute.value.query.name) {
@@ -590,7 +590,7 @@ export default {
.description as string;
}
if (router.currentRoute.value.query.assignee) {
- newIssue.assigneeId = parseInt(
+ newIssue.assigneeID = parseInt(
router.currentRoute.value.query.assignee as string
);
}
@@ -623,7 +623,7 @@ export default {
}
state.pollIssueTimer = setTimeout(() => {
- store.dispatch("issue/fetchIssueById", idFromSlug(props.issueSlug));
+ store.dispatch("issue/fetchIssueByID", idFromSlug(props.issueSlug));
pollIssue(Math.min(interval * 2, NORMAL_POLL_INTERVAL));
}, Math.max(1000, Math.min(interval, NORMAL_POLL_INTERVAL) + (Math.random() * 2 - 1) * POLL_JITTER));
};
@@ -677,7 +677,7 @@ export default {
const issue = computed((): Issue | IssueCreate => {
return state.create
? state.newIssue
- : store.getters["issue/issueById"](idFromSlug(props.issueSlug));
+ : store.getters["issue/issueByID"](idFromSlug(props.issueSlug));
});
const issueTemplate = computed(
@@ -686,8 +686,8 @@ export default {
const project = computed((): Project => {
if (state.create) {
- return store.getters["project/projectById"](
- (issue.value as IssueCreate).projectId
+ return store.getters["project/projectByID"](
+ (issue.value as IssueCreate).projectID
);
}
return (issue.value as Issue).project;
@@ -772,27 +772,27 @@ export default {
}
};
- const updateAssigneeId = (newAssigneeId: PrincipalId) => {
+ const updateAssigneeID = (newAssigneeID: PrincipalID) => {
if (state.create) {
- state.newIssue!.assigneeId = newAssigneeId;
+ state.newIssue!.assigneeID = newAssigneeID;
} else {
patchIssue({
- assigneeId: newAssigneeId,
+ assigneeID: newAssigneeID,
});
}
};
- const addSubscriberId = (subscriberId: PrincipalId) => {
+ const addSubscriberID = (subscriberID: PrincipalID) => {
store.dispatch("issueSubscriber/createSubscriber", {
- issueId: (issue.value as Issue).id,
- subscriberId,
+ issueID: (issue.value as Issue).id,
+ subscriberID,
});
};
- const removeSubscriberId = (subscriberId: PrincipalId) => {
+ const removeSubscriberID = (subscriberID: PrincipalID) => {
store.dispatch("issueSubscriber/deleteSubscriber", {
- issueId: (issue.value as Issue).id,
- subscriberId,
+ issueID: (issue.value as Issue).id,
+ subscriberID,
});
};
@@ -842,7 +842,7 @@ export default {
store
.dispatch("issue/updateIssueStatus", {
- issueId: (issue.value as Issue).id,
+ issueID: (issue.value as Issue).id,
issueStatusPatch,
})
.then(() => {
@@ -856,7 +856,7 @@ export default {
comment: string
) => {
// Switch to the stage view containing this task
- selectStageId(task.stage.id);
+ selectStageID(task.stage.id);
const taskStatusPatch: TaskStatusPatch = {
status: newStatus,
@@ -865,9 +865,9 @@ export default {
store
.dispatch("task/updateStatus", {
- issueId: (issue.value as Issue).id,
- pipelineId: (issue.value as Issue).pipeline.id,
- taskId: task.id,
+ issueID: (issue.value as Issue).id,
+ pipelineID: (issue.value as Issue).pipeline.id,
+ taskID: task.id,
taskStatusPatch,
})
.then(() => {
@@ -878,9 +878,9 @@ export default {
const runTaskChecks = (task: Task) => {
store
.dispatch("task/runChecks", {
- issueId: (issue.value as Issue).id,
- pipelineId: (issue.value as Issue).pipeline.id,
- taskId: task.id,
+ issueID: (issue.value as Issue).id,
+ pipelineID: (issue.value as Issue).pipeline.id,
+ taskID: task.id,
})
.then(() => {
pollIssue(POST_CHANGE_POLL_INTERVAL);
@@ -893,7 +893,7 @@ export default {
) => {
store
.dispatch("issue/patchIssue", {
- issueId: (issue.value as Issue).id,
+ issueID: (issue.value as Issue).id,
issuePatch,
})
.then((updatedIssue) => {
@@ -907,15 +907,15 @@ export default {
};
const patchTask = (
- taskId: TaskId,
+ taskID: TaskID,
taskPatch: TaskPatch,
postUpdated?: (updatedTask: Task) => void
) => {
store
.dispatch("task/patchTask", {
- issueId: (issue.value as Issue).id,
- pipelineId: (issue.value as Issue).pipeline.id,
- taskId,
+ issueID: (issue.value as Issue).id,
+ pipelineID: (issue.value as Issue).pipeline.id,
+ taskID,
taskPatch,
})
.then((updatedTask) => {
@@ -937,25 +937,25 @@ export default {
const taskSlug = router.currentRoute.value.query.task as string;
// For stage slug, we support both index based and id based.
// Index based is used when creating the new task and is the one used when clicking the UI.
- // Id based is used when the context only has access to the stage id (e.g. Task only contains StageId)
+ // Id based is used when the context only has access to the stage id (e.g. Task only contains StageID)
if (stageSlug) {
const index = indexFromSlug(stageSlug);
if (index < issue.value.pipeline.stageList.length) {
return issue.value.pipeline.stageList[index];
}
- const stageId = idFromSlug(stageSlug);
+ const stageID = idFromSlug(stageSlug);
const stageList = (issue.value as Issue).pipeline.stageList;
for (const stage of stageList) {
- if (stage.id == stageId) {
+ if (stage.id == stageID) {
return stage;
}
}
} else if (!state.create && taskSlug) {
- const taskId = idFromSlug(taskSlug);
+ const taskID = idFromSlug(taskSlug);
const stageList = (issue.value as Issue).pipeline.stageList;
for (const stage of stageList) {
for (const task of stage.taskList) {
- if (task.id == taskId) {
+ if (task.id == taskID) {
return stage;
}
}
@@ -968,13 +968,13 @@ export default {
return activeStage((issue.value as Issue).pipeline);
});
- const selectStageId = (stageId: StageId) => {
+ const selectStageID = (stageID: StageID) => {
const stageList = issue.value.pipeline.stageList;
const index = stageList.findIndex((item, index) => {
if (state.create) {
- return index == stageId;
+ return index == stageID;
}
- return (item as Stage).id == stageId;
+ return (item as Stage).id == stageID;
});
router.replace({
name: "workspace.issue.detail",
@@ -1179,9 +1179,9 @@ export default {
const temp = selectedStage as unknown;
if (create) {
const stage = temp as ComputedRef<StageCreate>;
- const databaseId = stage.value.taskList[0].databaseId;
- if (databaseId) {
- return store.getters["database/databaseById"](databaseId);
+ const databaseID = stage.value.taskList[0].databaseID;
+ if (databaseID) {
+ return store.getters["database/databaseByID"](databaseID);
}
return undefined;
@@ -1194,13 +1194,13 @@ export default {
const temp = selectedStage as unknown;
if (create) {
// If database is available, then we derive the instance from database because we always fetch database's instance.
- // On the other hand, instance for stage.taskList[0].instanceId might not be loaded (e.g. when creating an update schema issue)
+ // On the other hand, instance for stage.taskList[0].instanceID might not be loaded (e.g. when creating an update schema issue)
if (database.value) {
return database.value.instance;
}
const stage = temp as ComputedRef<StageCreate>;
- return store.getters["instance/instanceById"](
- stage.value.taskList[0].instanceId
+ return store.getters["instance/instanceByID"](
+ stage.value.taskList[0].instanceID
);
}
const stage = temp as ComputedRef<Stage>;
@@ -1229,9 +1229,9 @@ export default {
applyStatementToOtherStages,
updateRollbackStatement,
applyRollbackStatementToOtherStages,
- updateAssigneeId,
- addSubscriberId,
- removeSubscriberId,
+ updateAssigneeID,
+ addSubscriberID,
+ removeSubscriberID,
updateCustomField,
doCreate,
doRollback,
@@ -1243,7 +1243,7 @@ export default {
issueTemplate,
selectedStage,
selectedTask,
- selectStageId,
+ selectStageID,
statement,
rollbackStatement,
selectedStatement,
diff --git a/frontend/src/views/MigrationHistoryDetail.vue b/frontend/src/views/MigrationHistoryDetail.vue
index 6e5a00f848..f6419ae29b 100644
--- a/frontend/src/views/MigrationHistoryDetail.vue
+++ b/frontend/src/views/MigrationHistoryDetail.vue
@@ -33,10 +33,10 @@
<dd class="flex items-center text-sm md:mr-4">
<span class="textlabel">Issue&nbsp;-&nbsp;</span>
<router-link
- :to="`/issue/${migrationHistory.issueId}`"
+ :to="`/issue/${migrationHistory.issueID}`"
class="normal-link"
>
- {{ migrationHistory.issueId }}
+ {{ migrationHistory.issueID }}
</router-link>
</dd>
<dt class="sr-only">Duration</dt>
@@ -228,7 +228,7 @@ export default {
const store = useStore();
const migrationHistory = computed((): MigrationHistory => {
- return store.getters["instance/migrationHistoryById"](
+ return store.getters["instance/migrationHistoryByID"](
idFromSlug(props.migrationHistorySlug)
);
});
@@ -239,7 +239,7 @@ export default {
});
const database = computed(() => {
- return store.getters["database/databaseById"](
+ return store.getters["database/databaseByID"](
idFromSlug(props.databaseSlug)
);
});
diff --git a/frontend/src/views/PipelineSimpleFlow.vue b/frontend/src/views/PipelineSimpleFlow.vue
index d0c9b5eb20..c1bbd1317c 100644
--- a/frontend/src/views/PipelineSimpleFlow.vue
+++ b/frontend/src/views/PipelineSimpleFlow.vue
@@ -31,7 +31,7 @@
>
<template v-if="item.taskStatus === 'PENDING'">
<span
- v-if="activeTask(pipeline).id === item.taskId"
+ v-if="activeTask(pipeline).id === item.taskID"
class="h-2 w-2 bg-info rounded-full"
aria-hidden="true"
></span>
@@ -176,9 +176,9 @@ import { useRouter } from "vue-router";
import {
Pipeline,
TaskStatus,
- TaskId,
+ TaskID,
Stage,
- StageId,
+ StageID,
StageCreate,
PipelineCreate,
Task,
@@ -188,9 +188,9 @@ import { activeTask, activeTaskInStage } from "../utils";
import isEmpty from "lodash-es/isEmpty";
interface FlowItem {
- stageId: StageId;
+ stageID: StageID;
stageName: string;
- taskId: TaskId;
+ taskID: TaskID;
taskName: string;
taskStatus: TaskStatus;
valid: boolean;
@@ -249,9 +249,9 @@ export default {
}
return {
- stageId: props.create ? index : (stage as Stage).id,
+ stageID: props.create ? index : (stage as Stage).id,
stageName: stage.name,
- taskId: props.create ? index : (activeTask as Task).id,
+ taskID: props.create ? index : (activeTask as Task).id,
taskName: taskName,
taskStatus: activeTask.status,
valid,
@@ -264,7 +264,7 @@ export default {
case "PENDING":
if (
!props.create &&
- activeTask(props.pipeline as Pipeline).id === item.taskId
+ activeTask(props.pipeline as Pipeline).id === item.taskID
) {
return "bg-white border-2 border-info text-info ";
}
@@ -272,7 +272,7 @@ export default {
case "PENDING_APPROVAL":
if (
!props.create &&
- activeTask(props.pipeline as Pipeline).id === item.taskId
+ activeTask(props.pipeline as Pipeline).id === item.taskID
) {
return "bg-white border-2 border-info text-info";
}
@@ -289,7 +289,7 @@ export default {
const flowItemTextClass = (item: FlowItem) => {
let textClass =
!props.create &&
- activeTask(props.pipeline as Pipeline).id === item.taskId
+ activeTask(props.pipeline as Pipeline).id === item.taskID
? "font-bold "
: "font-normal ";
// For create, since we don't have stage id yet, we just compare name instead.
@@ -297,7 +297,7 @@ export default {
if (
(props.create &&
item.stageName == (props.selectedStage as StageCreate).name) ||
- (!props.create && item.stageId == (props.selectedStage as Stage).id)
+ (!props.create && item.stageID == (props.selectedStage as Stage).id)
) {
textClass += "underline ";
}
@@ -308,7 +308,7 @@ export default {
case "PENDING_APPROVAL":
if (
!props.create &&
- activeTask(props.pipeline as Pipeline).id === item.taskId
+ activeTask(props.pipeline as Pipeline).id === item.taskID
) {
return textClass + "text-info";
}
@@ -321,7 +321,7 @@ export default {
};
const clickItem = (item: FlowItem) => {
- emit("select-stage-id", item.stageId);
+ emit("select-stage-id", item.stageID);
};
return {
diff --git a/frontend/src/views/ProfileDashboard.vue b/frontend/src/views/ProfileDashboard.vue
index 01dfbe6989..ba66bc7d25 100644
--- a/frontend/src/views/ProfileDashboard.vue
+++ b/frontend/src/views/ProfileDashboard.vue
@@ -207,7 +207,7 @@ interface LocalState {
export default {
name: "ProfileDashboard",
props: {
- principalId: {
+ principalID: {
type: String,
},
},
@@ -250,9 +250,9 @@ export default {
);
const principal = computed(() => {
- if (props.principalId) {
- return store.getters["principal/principalById"](
- parseInt(props.principalId)
+ if (props.principalID) {
+ return store.getters["principal/principalByID"](
+ parseInt(props.principalID)
);
}
return currentUser.value;
@@ -304,7 +304,7 @@ export default {
const saveEdit = () => {
store
.dispatch("principal/patchPrincipal", {
- principalId: principal.value.id,
+ principalID: principal.value.id,
principalPatch: state.editingPrincipal,
})
.then(() => {
diff --git a/frontend/src/views/ProjectDashboard.vue b/frontend/src/views/ProjectDashboard.vue
index 0e2e23356b..24fbdea09a 100644
--- a/frontend/src/views/ProjectDashboard.vue
+++ b/frontend/src/views/ProjectDashboard.vue
@@ -78,7 +78,7 @@ export default {
if (currentUser.value.id != UNKNOWN_ID) {
store
.dispatch("project/fetchProjectListByUser", {
- userId: currentUser.value.id,
+ userID: currentUser.value.id,
})
.then((projectList: Project[]) => {
state.projectList = projectList;
diff --git a/frontend/src/views/ProjectDetail.vue b/frontend/src/views/ProjectDetail.vue
index 1b1f742150..1d18fd5413 100644
--- a/frontend/src/views/ProjectDetail.vue
+++ b/frontend/src/views/ProjectDetail.vue
@@ -86,7 +86,7 @@ export default {
const store = useStore();
const project = computed(() => {
- return store.getters["project/projectById"](
+ return store.getters["project/projectByID"](
idFromSlug(props.projectSlug)
);
});
@@ -96,14 +96,14 @@ export default {
});
const prepareDatabaseList = () => {
- store.dispatch("database/fetchDatabaseListByProjectId", project.value.id);
+ store.dispatch("database/fetchDatabaseListByProjectID", project.value.id);
};
watchEffect(prepareDatabaseList);
const databaseList = computed(() => {
const list = cloneDeep(
- store.getters["database/databaseListByProjectId"](project.value.id)
+ store.getters["database/databaseListByProjectID"](project.value.id)
);
return sortDatabaseList(list, environmentList.value);
});
diff --git a/frontend/src/views/ProjectWebhookCreate.vue b/frontend/src/views/ProjectWebhookCreate.vue
index f6d1908bbb..8c16db6d00 100644
--- a/frontend/src/views/ProjectWebhookCreate.vue
+++ b/frontend/src/views/ProjectWebhookCreate.vue
@@ -37,7 +37,7 @@ export default {
const store = useStore();
const project = computed(() => {
- return store.getters["project/projectById"](
+ return store.getters["project/projectByID"](
idFromSlug(props.projectSlug)
);
});
diff --git a/frontend/src/views/ProjectWebhookDetail.vue b/frontend/src/views/ProjectWebhookDetail.vue
index 9a7490f0ed..36f0c3bbdc 100644
--- a/frontend/src/views/ProjectWebhookDetail.vue
+++ b/frontend/src/views/ProjectWebhookDetail.vue
@@ -79,13 +79,13 @@ export default {
const store = useStore();
const project = computed(() => {
- return store.getters["project/projectById"](
+ return store.getters["project/projectByID"](
idFromSlug(props.projectSlug)
);
});
const projectWebhook = computed(() => {
- return store.getters["projectWebhook/projectWebhookById"](
+ return store.getters["projectWebhook/projectWebhookByID"](
idFromSlug(props.projectSlug),
idFromSlug(props.projectWebhookSlug)
);
@@ -93,9 +93,9 @@ export default {
const testWebhook = () => {
store
- .dispatch("projectWebhook/testProjectWebhookById", {
- projectId: idFromSlug(props.projectSlug),
- projectWebhookId: idFromSlug(props.projectWebhookSlug),
+ .dispatch("projectWebhook/testProjectWebhookByID", {
+ projectID: idFromSlug(props.projectSlug),
+ projectWebhookID: idFromSlug(props.projectWebhookSlug),
})
.then((testResult: ProjectWebhookTestResult) => {
if (testResult.error) {
diff --git a/frontend/src/views/SettingWorkspaceVCSDetail.vue b/frontend/src/views/SettingWorkspaceVCSDetail.vue
index b93c0fd757..8c0164089f 100644
--- a/frontend/src/views/SettingWorkspaceVCSDetail.vue
+++ b/frontend/src/views/SettingWorkspaceVCSDetail.vue
@@ -60,7 +60,7 @@
name="applicationid"
type="text"
class="textfield mt-1 w-full"
- v-model="state.applicationId"
+ v-model="state.applicationID"
/>
</div>
@@ -147,7 +147,7 @@ import {
interface LocalState {
name: string;
- applicationId: string;
+ applicationID: string;
secret: string;
oAuthResultCallback?: (token: OAuthToken | undefined) => void;
}
@@ -166,12 +166,12 @@ export default {
const router = useRouter();
const vcs = computed((): VCS => {
- return store.getters["vcs/vcsById"](idFromSlug(props.vcsSlug));
+ return store.getters["vcs/vcsByID"](idFromSlug(props.vcsSlug));
});
const state = reactive<LocalState>({
name: vcs.value.name,
- applicationId: vcs.value.applicationId,
+ applicationID: vcs.value.applicationID,
secret: "",
});
@@ -181,7 +181,7 @@ export default {
if (vcs.value.type == "GITLAB_SELF_HOST") {
const oAuthConfig: OAuthConfig = {
endpoint: `${vcs.value.instanceURL}/oauth/token`,
- applicationId: state.applicationId,
+ applicationID: state.applicationID,
secret: state.secret,
redirectURL: redirectURL(),
};
@@ -205,7 +205,7 @@ export default {
};
const prepareRepositoryList = () => {
- store.dispatch("repository/fetchRepositoryListByVCSId", vcs.value.id);
+ store.dispatch("repository/fetchRepositoryListByVCSID", vcs.value.id);
};
watchEffect(prepareRepositoryList);
@@ -218,25 +218,25 @@ export default {
});
const repositoryList = computed(() =>
- store.getters["repository/repositoryListByVCSId"](vcs.value.id)
+ store.getters["repository/repositoryListByVCSID"](vcs.value.id)
);
const allowUpdate = computed(() => {
return (
state.name != vcs.value.name ||
- state.applicationId != vcs.value.applicationId ||
+ state.applicationID != vcs.value.applicationID ||
!isEmpty(state.secret)
);
});
const doUpdate = () => {
if (
- state.applicationId != vcs.value.applicationId ||
+ state.applicationID != vcs.value.applicationID ||
!isEmpty(state.secret)
) {
const newWindow = openWindowForOAuth(
`${vcs.value.instanceURL}/oauth/authorize`,
- vcs.value.applicationId
+ vcs.value.applicationID
);
if (newWindow) {
state.oAuthResultCallback = (token: OAuthToken | undefined) => {
@@ -245,15 +245,15 @@ export default {
if (state.name != vcs.value.name) {
vcsPatch.name = state.name;
}
- if (state.applicationId != vcs.value.applicationId) {
- vcsPatch.applicationId = state.applicationId;
+ if (state.applicationID != vcs.value.applicationID) {
+ vcsPatch.applicationID = state.applicationID;
}
if (!isEmpty(state.secret)) {
vcsPatch.secret = state.secret;
}
store
.dispatch("vcs/patchVCS", {
- vcsId: vcs.value.id,
+ vcsID: vcs.value.id,
vcsPatch,
})
.then((vcs: VCS) => {
@@ -288,7 +288,7 @@ export default {
};
store
.dispatch("vcs/patchVCS", {
- vcsId: vcs.value.id,
+ vcsID: vcs.value.id,
vcsPatch,
})
.then((updatedVCS: VCS) => {
@@ -309,7 +309,7 @@ export default {
const deleteVCS = () => {
const name = vcs.value.name;
- store.dispatch("vcs/deleteVCSById", vcs.value.id).then(() => {
+ store.dispatch("vcs/deleteVCSByID", vcs.value.id).then(() => {
store.dispatch("notification/pushNotification", {
module: "bytebase",
style: "SUCCESS",
diff --git a/frontend/src/views/TableDetail.vue b/frontend/src/views/TableDetail.vue
index 2c2cabc7d8..8504d4f5c7 100644
--- a/frontend/src/views/TableDetail.vue
+++ b/frontend/src/views/TableDetail.vue
@@ -243,7 +243,7 @@ export default {
const store = useStore();
const table = computed(() => {
- return store.getters["table/tableListByDatabaseIdAndTableName"](
+ return store.getters["table/tableListByDatabaseIDAndTableName"](
idFromSlug(props.databaseSlug),
props.tableName
);
diff --git a/plugin/db/driver.go b/plugin/db/driver.go
index 1a35614205..7f76ced4f6 100644
--- a/plugin/db/driver.go
+++ b/plugin/db/driver.go
@@ -182,7 +182,7 @@ type MigrationInfo struct {
Status MigrationStatus
Description string
Creator string
- IssueId string
+ IssueID string
Payload string
CreateDatabase bool
}
@@ -282,7 +282,7 @@ type MigrationHistory struct {
Schema string
SchemaPrev string
ExecutionDuration int
- IssueId string
+ IssueID string
Payload string
}
diff --git a/plugin/db/util/driverutil.go b/plugin/db/util/driverutil.go
index a3d777f8e7..88ae6156e4 100644
--- a/plugin/db/util/driverutil.go
+++ b/plugin/db/util/driverutil.go
@@ -119,7 +119,7 @@ type MigrationExecutionArgs struct {
// ExecuteMigration will execute the database migration.
// Returns the created migraiton history id and the updated schema on success.
-func ExecuteMigration(ctx context.Context, l *zap.Logger, dbType db.Type, driver db.Driver, m *db.MigrationInfo, statement string, args MigrationExecutionArgs) (migrationHistoryId int64, updatedSchema string, resErr error) {
+func ExecuteMigration(ctx context.Context, l *zap.Logger, dbType db.Type, driver db.Driver, m *db.MigrationInfo, statement string, args MigrationExecutionArgs) (migrationHistoryID int64, updatedSchema string, resErr error) {
var prevSchemaBuf bytes.Buffer
// Don't record schema if the database hasn't exist yet.
if !m.CreateDatabase {
@@ -197,7 +197,7 @@ func ExecuteMigration(ctx context.Context, l *zap.Logger, dbType db.Type, driver
statement,
prevSchemaBuf.String(),
prevSchemaBuf.String(),
- m.IssueId,
+ m.IssueID,
m.Payload,
).Scan(&insertedID)
} else if dbType == db.ClickHouse {
@@ -237,7 +237,7 @@ func ExecuteMigration(ctx context.Context, l *zap.Logger, dbType db.Type, driver
prevSchemaBuf.String(),
prevSchemaBuf.String(),
0,
- m.IssueId,
+ m.IssueID,
m.Payload,
)
if err != nil {
@@ -280,7 +280,7 @@ func ExecuteMigration(ctx context.Context, l *zap.Logger, dbType db.Type, driver
statement,
prevSchemaBuf.String(),
prevSchemaBuf.String(),
- m.IssueId,
+ m.IssueID,
m.Payload,
)
if err != nil {
@@ -300,7 +300,7 @@ func ExecuteMigration(ctx context.Context, l *zap.Logger, dbType db.Type, driver
statement,
prevSchemaBuf.String(),
prevSchemaBuf.String(),
- m.IssueId,
+ m.IssueID,
m.Payload,
)
@@ -564,7 +564,7 @@ func FindMigrationHistoryList(ctx context.Context, dbType db.Type, driver db.Dri
&history.Schema,
&history.SchemaPrev,
&history.ExecutionDuration,
- &history.IssueId,
+ &history.IssueID,
&history.Payload,
); err != nil {
return nil, err
diff --git a/scripts/build_bb.sh b/scripts/build_bb.sh
old mode 100755
new mode 100644
diff --git a/scripts/build_docker.sh b/scripts/build_docker.sh
old mode 100755
new mode 100644
diff --git a/scripts/build_docker_bb.sh b/scripts/build_docker_bb.sh
old mode 100755
new mode 100644
diff --git a/server/acl.go b/server/acl.go
index 55256e700e..72e4ad9227 100644
--- a/server/acl.go
+++ b/server/acl.go
@@ -37,15 +37,15 @@ func ACLMiddleware(l *zap.Logger, s *Server, ce *casbin.Enforcer, next echo.Hand
}
// Gets principal id from the context.
- principalId := c.Get(GetPrincipalIdContextKey()).(int)
+ principalID := c.Get(GetPrincipalIDContextKey()).(int)
memberFind := &api.MemberFind{
- PrincipalId: &principalId,
+ PrincipalID: &principalID,
}
member, err := s.MemberService.FindMember(ctx, memberFind)
if err != nil {
if common.ErrorCode(err) == common.NotFound {
- return echo.NewHTTPError(http.StatusUnauthorized, fmt.Sprintf("User ID is not a member: %d", principalId))
+ return echo.NewHTTPError(http.StatusUnauthorized, fmt.Sprintf("User ID is not a member: %d", principalID))
}
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to process authorize request.").SetInternal(err)
}
@@ -57,72 +57,72 @@ func ACLMiddleware(l *zap.Logger, s *Server, ce *casbin.Enforcer, next echo.Hand
// XXX_SELF so that the policy can differentiate between XXX and XXX_SELF
if method == "PATCH" || method == "DELETE" {
if strings.HasPrefix(c.Path(), "/api/principal") {
- pathPrincipalId := c.Param("principalId")
- if pathPrincipalId != "" {
- if pathPrincipalId == strconv.Itoa(principalId) {
+ pathPrincipalID := c.Param("principalID")
+ if pathPrincipalID != "" {
+ if pathPrincipalID == strconv.Itoa(principalID) {
method = method + "_SELF"
}
}
} else if strings.HasPrefix(c.Path(), "/api/activity") {
- activityIdStr := c.Param("activityId")
- if activityIdStr != "" {
- activityId, err := strconv.Atoi(activityIdStr)
+ activityIDStr := c.Param("activityID")
+ if activityIDStr != "" {
+ activityID, err := strconv.Atoi(activityIDStr)
if err != nil {
- return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Activity ID is not a number: %s", activityIdStr))
+ return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Activity ID is not a number: %s", activityIDStr))
}
activityFind := &api.ActivityFind{
- ID: &activityId,
+ ID: &activityID,
}
activity, err := s.ActivityService.FindActivity(ctx, activityFind)
if err != nil {
if common.ErrorCode(err) == common.NotFound {
- return echo.NewHTTPError(http.StatusUnauthorized, fmt.Sprintf("Activity ID not found: %d", activityId))
+ return echo.NewHTTPError(http.StatusUnauthorized, fmt.Sprintf("Activity ID not found: %d", activityID))
}
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to process authorize request.").SetInternal(err)
}
- if activity.CreatorId == principalId {
+ if activity.CreatorID == principalID {
method = method + "_SELF"
}
}
} else if strings.HasPrefix(c.Path(), "/api/bookmark") {
- bookmarkIdStr := c.Param("bookmarkId")
- if bookmarkIdStr != "" {
- bookmarkId, err := strconv.Atoi(bookmarkIdStr)
+ bookmarkIDStr := c.Param("bookmarkID")
+ if bookmarkIDStr != "" {
+ bookmarkID, err := strconv.Atoi(bookmarkIDStr)
if err != nil {
- return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Bookmark ID is not a number: %s", bookmarkIdStr))
+ return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Bookmark ID is not a number: %s", bookmarkIDStr))
}
bookmarkFind := &api.BookmarkFind{
- ID: &bookmarkId,
+ ID: &bookmarkID,
}
bookmark, err := s.BookmarkService.FindBookmark(ctx, bookmarkFind)
if err != nil {
if common.ErrorCode(err) == common.NotFound {
- return echo.NewHTTPError(http.StatusUnauthorized, fmt.Sprintf("Bookmark ID not found: %d", bookmarkId))
+ return echo.NewHTTPError(http.StatusUnauthorized, fmt.Sprintf("Bookmark ID not found: %d", bookmarkID))
}
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to process authorize request.").SetInternal(err)
}
- if bookmark.CreatorId == principalId {
+ if bookmark.CreatorID == principalID {
method = method + "_SELF"
}
}
} else if strings.HasPrefix(c.Path(), "/api/inbox") {
- inboxIdStr := c.Param("inboxId")
- if inboxIdStr != "" {
- inboxId, err := strconv.Atoi(inboxIdStr)
+ inboxIDStr := c.Param("inboxID")
+ if inboxIDStr != "" {
+ inboxID, err := strconv.Atoi(inboxIDStr)
if err != nil {
- return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Inbox ID is not a number: %s", inboxIdStr))
+ return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Inbox ID is not a number: %s", inboxIDStr))
}
inboxFind := &api.InboxFind{
- ID: &inboxId,
+ ID: &inboxID,
}
inbox, err := s.InboxService.FindInbox(ctx, inboxFind)
if err != nil {
if common.ErrorCode(err) == common.NotFound {
- return echo.NewHTTPError(http.StatusUnauthorized, fmt.Sprintf("Inbox ID not found: %d", inboxId))
+ return echo.NewHTTPError(http.StatusUnauthorized, fmt.Sprintf("Inbox ID not found: %d", inboxID))
}
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to process authorize request.").SetInternal(err)
}
- if inbox.ReceiverId == principalId {
+ if inbox.ReceiverID == principalID {
method = method + "_SELF"
}
}
@@ -145,7 +145,7 @@ func ACLMiddleware(l *zap.Logger, s *Server, ce *casbin.Enforcer, next echo.Hand
if !pass {
return echo.NewHTTPError(http.StatusUnauthorized).SetInternal(
- fmt.Errorf("rejected by the ACL policy; %s %s u%d/%s", method, path, principalId, role))
+ fmt.Errorf("rejected by the ACL policy; %s %s u%d/%s", method, path, principalID, role))
}
// Stores role into context.
diff --git a/server/acl_casbin_policy_dba.csv b/server/acl_casbin_policy_dba.csv
index 8f72d7394b..eeb09107b3 100644
--- a/server/acl_casbin_policy_dba.csv
+++ b/server/acl_casbin_policy_dba.csv
@@ -10,19 +10,19 @@ p, DBA, /project/{id}/repository, GET
p, DBA, /project/{id}/repository, POST
p, DBA, /project/{id}/repository, PATCH
p, DBA, /project/{id}/repository, DELETE
-p, DBA, /project/{projectId}/member, POST
-p, DBA, /project/{projectId}/member/{memberId}, PATCH
-p, DBA, /project/{projectId}/member/{memberId}, DELETE
-p, DBA, /project/{projectId}/webhook, GET
-p, DBA, /project/{projectId}/webhook, POST
-p, DBA, /project/{projectId}/webhook/{webhookId}, GET
-p, DBA, /project/{projectId}/webhook/{webhookId}, PATCH
-p, DBA, /project/{projectId}/webhook/{webhookId}, DELETE
-p, DBA, /project/{projectId}/webhook/{webhookId}/test, GET
+p, DBA, /project/{projectID}/member, POST
+p, DBA, /project/{projectID}/member/{memberID}, PATCH
+p, DBA, /project/{projectID}/member/{memberID}, DELETE
+p, DBA, /project/{projectID}/webhook, GET
+p, DBA, /project/{projectID}/webhook, POST
+p, DBA, /project/{projectID}/webhook/{webhookID}, GET
+p, DBA, /project/{projectID}/webhook/{webhookID}, PATCH
+p, DBA, /project/{projectID}/webhook/{webhookID}, DELETE
+p, DBA, /project/{projectID}/webhook/{webhookID}/test, GET
p, DBA, /environment, POST
p, DBA, /environment, GET
p, DBA, /environment/{id}, PATCH
-p, DBA, /policy/environment/{environmentId}, GET
+p, DBA, /policy/environment/{environmentID}, GET
p, DBA, /instance, POST
p, DBA, /instance, GET
p, DBA, /instance/{id}, GET
@@ -31,7 +31,7 @@ p, DBA, /instance/{id}/user, GET
p, DBA, /instance/{id}/migration, POST
p, DBA, /instance/{id}/migration/status, GET
p, DBA, /instance/{id}/migration/history, GET
-p, DBA, /instance/{id}/migration/history/{historyId}, GET
+p, DBA, /instance/{id}/migration/history/{historyID}, GET
p, DBA, /database, POST
p, DBA, /database, GET
p, DBA, /database/{id}, GET
@@ -50,7 +50,7 @@ p, DBA, /issue/{id}, PATCH
p, DBA, /issue/{id}/status, PATCH
p, DBA, /issue/{id}/subscriber, GET
p, DBA, /issue/{id}/subscriber, POST
-p, DBA, /issue/{id}/subscriber/{subscriberId}, DELETE
+p, DBA, /issue/{id}/subscriber/{subscriberID}, DELETE
p, DBA, /activity, POST
p, DBA, /activity, GET
p, DBA, /activity/{id}, PATCH_SELF
@@ -61,9 +61,9 @@ p, DBA, /inbox/{id}, PATCH_SELF
p, DBA, /bookmark, POST
p, DBA, /bookmark, GET
p, DBA, /bookmark/{id}, DELETE_SELF
-p, DBA, /pipeline/{pipelineId}/task/{taskId}, PATCH
-p, DBA, /pipeline/{pipelineId}/task/{taskId}/status, PATCH
-p, DBA, /pipeline/{pipelineId}/task/{taskId}/check, POST
+p, DBA, /pipeline/{pipelineID}/task/{taskID}, PATCH
+p, DBA, /pipeline/{pipelineID}/task/{taskID}/status, PATCH
+p, DBA, /pipeline/{pipelineID}/task/{taskID}/check, POST
p, DBA, /sql/ping, POST
p, DBA, /sql/syncschema, POST
p, DBA, /vcs, POST
diff --git a/server/acl_casbin_policy_developer.csv b/server/acl_casbin_policy_developer.csv
index 92a99a2c4a..df1bdf7dcb 100644
--- a/server/acl_casbin_policy_developer.csv
+++ b/server/acl_casbin_policy_developer.csv
@@ -10,23 +10,23 @@ p, DEVELOPER, /project/{id}/repository, GET
p, DEVELOPER, /project/{id}/repository, POST
p, DEVELOPER, /project/{id}/repository, PATCH
p, DEVELOPER, /project/{id}/repository, DELETE
-p, DEVELOPER, /project/{projectId}/member, POST
-p, DEVELOPER, /project/{projectId}/member/{memberId}, PATCH
-p, DEVELOPER, /project/{projectId}/member/{memberId}, DELETE
-p, DEVELOPER, /project/{projectId}/webhook, GET
-p, DEVELOPER, /project/{projectId}/webhook, POST
-p, DEVELOPER, /project/{projectId}/webhook/{webhookId}, GET
-p, DEVELOPER, /project/{projectId}/webhook/{webhookId}, PATCH
-p, DEVELOPER, /project/{projectId}/webhook/{webhookId}, DELETE
-p, DEVELOPER, /project/{projectId}/webhook/{webhookId}/test, GET
+p, DEVELOPER, /project/{projectID}/member, POST
+p, DEVELOPER, /project/{projectID}/member/{memberID}, PATCH
+p, DEVELOPER, /project/{projectID}/member/{memberID}, DELETE
+p, DEVELOPER, /project/{projectID}/webhook, GET
+p, DEVELOPER, /project/{projectID}/webhook, POST
+p, DEVELOPER, /project/{projectID}/webhook/{webhookID}, GET
+p, DEVELOPER, /project/{projectID}/webhook/{webhookID}, PATCH
+p, DEVELOPER, /project/{projectID}/webhook/{webhookID}, DELETE
+p, DEVELOPER, /project/{projectID}/webhook/{webhookID}/test, GET
p, DEVELOPER, /environment, GET
-p, DEVELOPER, /policy/environment/{environmentId}, GET
+p, DEVELOPER, /policy/environment/{environmentID}, GET
p, DEVELOPER, /instance, GET
p, DEVELOPER, /instance/{id}, GET
p, DEVELOPER, /instance/{id}/user, GET
p, DEVELOPER, /instance/{id}/migration/status, GET
p, DEVELOPER, /instance/{id}/migration/history, GET
-p, DEVELOPER, /instance/{id}/migration/history/{historyId}, GET
+p, DEVELOPER, /instance/{id}/migration/history/{historyID}, GET
p, DEVELOPER, /instance/{id}, GET
p, DEVELOPER, /database, POST
p, DEVELOPER, /database, GET
@@ -46,7 +46,7 @@ p, DEVELOPER, /issue/{id}, PATCH
p, DEVELOPER, /issue/{id}/status, PATCH
p, DEVELOPER, /issue/{id}/subscriber, GET
p, DEVELOPER, /issue/{id}/subscriber, POST
-p, DEVELOPER, /issue/{id}/subscriber/{subscriberId}, DELETE
+p, DEVELOPER, /issue/{id}/subscriber/{subscriberID}, DELETE
p, DEVELOPER, /activity, POST
p, DEVELOPER, /activity, GET
p, DEVELOPER, /activity/{id}, PATCH_SELF
@@ -57,9 +57,9 @@ p, DEVELOPER, /inbox/{id}, PATCH_SELF
p, DEVELOPER, /bookmark, POST
p, DEVELOPER, /bookmark, GET
p, DEVELOPER, /bookmark/{id}, DELETE_SELF
-p, DEVELOPER, /pipeline/{pipelineId}/task/{taskId}, PATCH
-p, DEVELOPER, /pipeline/{pipelineId}/task/{taskId}/status, PATCH
-p, DEVELOPER, /pipeline/{pipelineId}/task/{taskId}/check, POST
+p, DEVELOPER, /pipeline/{pipelineID}/task/{taskID}, PATCH
+p, DEVELOPER, /pipeline/{pipelineID}/task/{taskID}/status, PATCH
+p, DEVELOPER, /pipeline/{pipelineID}/task/{taskID}/check, POST
p, DEVELOPER, /sql/ping, POST
p, DEVELOPER, /vcs, GET
p, DEVELOPER, /vcs/{id}, GET
diff --git a/server/acl_casbin_policy_owner.csv b/server/acl_casbin_policy_owner.csv
index c726219ab9..a98819aac0 100644
--- a/server/acl_casbin_policy_owner.csv
+++ b/server/acl_casbin_policy_owner.csv
@@ -14,20 +14,20 @@ p, OWNER, /project/{id}/repository, GET
p, OWNER, /project/{id}/repository, POST
p, OWNER, /project/{id}/repository, PATCH
p, OWNER, /project/{id}/repository, DELETE
-p, OWNER, /project/{projectId}/member, POST
-p, OWNER, /project/{projectId}/member/{memberId}, PATCH
-p, OWNER, /project/{projectId}/member/{memberId}, DELETE
-p, OWNER, /project/{projectId}/webhook, GET
-p, OWNER, /project/{projectId}/webhook, POST
-p, OWNER, /project/{projectId}/webhook/{webhookId}, GET
-p, OWNER, /project/{projectId}/webhook/{webhookId}, PATCH
-p, OWNER, /project/{projectId}/webhook/{webhookId}, DELETE
-p, OWNER, /project/{projectId}/webhook/{webhookId}/test, GET
+p, OWNER, /project/{projectID}/member, POST
+p, OWNER, /project/{projectID}/member/{memberID}, PATCH
+p, OWNER, /project/{projectID}/member/{memberID}, DELETE
+p, OWNER, /project/{projectID}/webhook, GET
+p, OWNER, /project/{projectID}/webhook, POST
+p, OWNER, /project/{projectID}/webhook/{webhookID}, GET
+p, OWNER, /project/{projectID}/webhook/{webhookID}, PATCH
+p, OWNER, /project/{projectID}/webhook/{webhookID}, DELETE
+p, OWNER, /project/{projectID}/webhook/{webhookID}/test, GET
p, OWNER, /environment, POST
p, OWNER, /environment, GET
p, OWNER, /environment/{id}, PATCH
-p, OWNER, /policy/environment/{environmentId}, GET
-p, OWNER, /policy/environment/{environmentId}, PATCH
+p, OWNER, /policy/environment/{environmentID}, GET
+p, OWNER, /policy/environment/{environmentID}, PATCH
p, OWNER, /instance, POST
p, OWNER, /instance, GET
p, OWNER, /instance/{id}, GET
@@ -36,7 +36,7 @@ p, OWNER, /instance/{id}/user, GET
p, OWNER, /instance/{id}/migration, POST
p, OWNER, /instance/{id}/migration/status, GET
p, OWNER, /instance/{id}/migration/history, GET
-p, OWNER, /instance/{id}/migration/history/{historyId}, GET
+p, OWNER, /instance/{id}/migration/history/{historyID}, GET
p, OWNER, /database, POST
p, OWNER, /database, GET
p, OWNER, /database/{id}, GET
@@ -55,7 +55,7 @@ p, OWNER, /issue/{id}, PATCH
p, OWNER, /issue/{id}/status, PATCH
p, OWNER, /issue/{id}/subscriber, GET
p, OWNER, /issue/{id}/subscriber, POST
-p, OWNER, /issue/{id}/subscriber/{subscriberId}, DELETE
+p, OWNER, /issue/{id}/subscriber/{subscriberID}, DELETE
p, OWNER, /activity, POST
p, OWNER, /activity, GET
p, OWNER, /activity/{id}, PATCH_SELF
@@ -66,9 +66,9 @@ p, OWNER, /inbox/{id}, PATCH_SELF
p, OWNER, /bookmark, POST
p, OWNER, /bookmark, GET
p, OWNER, /bookmark/{id}, DELETE_SELF
-p, OWNER, /pipeline/{pipelineId}/task/{taskId}, PATCH
-p, OWNER, /pipeline/{pipelineId}/task/{taskId}/status, PATCH
-p, OWNER, /pipeline/{pipelineId}/task/{taskId}/check, POST
+p, OWNER, /pipeline/{pipelineID}/task/{taskID}, PATCH
+p, OWNER, /pipeline/{pipelineID}/task/{taskID}/status, PATCH
+p, OWNER, /pipeline/{pipelineID}/task/{taskID}/check, POST
p, OWNER, /sql/ping, POST
p, OWNER, /sql/syncschema, POST
p, OWNER, /vcs, POST
diff --git a/server/activity.go b/server/activity.go
index 2a7ac6a068..38f64a3d84 100644
--- a/server/activity.go
+++ b/server/activity.go
@@ -22,18 +22,18 @@ func (s *Server) registerActivityRoutes(g *echo.Group) {
}
activityCreate.Level = api.ACTIVITY_INFO
- activityCreate.CreatorId = c.Get(GetPrincipalIdContextKey()).(int)
+ activityCreate.CreatorID = c.Get(GetPrincipalIDContextKey()).(int)
var foundIssue *api.Issue
if activityCreate.Type == api.ActivityIssueCommentCreate {
issueFind := &api.IssueFind{
- ID: &activityCreate.ContainerId,
+ ID: &activityCreate.ContainerID,
}
issue, err := s.IssueService.FindIssue(ctx, issueFind)
if err != nil {
if common.ErrorCode(err) == common.NotFound {
- return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Unable to find issue ID for creating the comment: %d", activityCreate.ContainerId))
+ return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Unable to find issue ID for creating the comment: %d", activityCreate.ContainerID))
}
- return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to fetch issue ID when creating the comment: %d", activityCreate.ContainerId)).SetInternal(err)
+ return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to fetch issue ID when creating the comment: %d", activityCreate.ContainerID)).SetInternal(err)
}
bytes, err := json.Marshal(api.ActivityIssueCommentCreatePayload{
@@ -67,12 +67,12 @@ func (s *Server) registerActivityRoutes(g *echo.Group) {
g.GET("/activity", func(c echo.Context) error {
ctx := context.Background()
activityFind := &api.ActivityFind{}
- if containerIdStr := c.QueryParams().Get("container"); containerIdStr != "" {
- containerId, err := strconv.Atoi(containerIdStr)
+ if containerIDStr := c.QueryParams().Get("container"); containerIDStr != "" {
+ containerID, err := strconv.Atoi(containerIDStr)
if err != nil {
- return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Query parameter container is not a number: %s", containerIdStr)).SetInternal(err)
+ return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Query parameter container is not a number: %s", containerIDStr)).SetInternal(err)
}
- activityFind.ContainerId = &containerId
+ activityFind.ContainerID = &containerID
}
if limitStr := c.QueryParam("limit"); limitStr != "" {
limit, err := strconv.Atoi(limitStr)
@@ -99,16 +99,16 @@ func (s *Server) registerActivityRoutes(g *echo.Group) {
return nil
})
- g.PATCH("/activity/:activityId", func(c echo.Context) error {
+ g.PATCH("/activity/:activityID", func(c echo.Context) error {
ctx := context.Background()
- id, err := strconv.Atoi(c.Param("activityId"))
+ id, err := strconv.Atoi(c.Param("activityID"))
if err != nil {
- return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("activityId"))).SetInternal(err)
+ return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("activityID"))).SetInternal(err)
}
activityPatch := &api.ActivityPatch{
ID: id,
- UpdaterId: c.Get(GetPrincipalIdContextKey()).(int),
+ UpdaterID: c.Get(GetPrincipalIDContextKey()).(int),
}
if err := jsonapi.UnmarshalPayload(c.Request().Body, activityPatch); err != nil {
return echo.NewHTTPError(http.StatusBadRequest, "Malformatted patch activity request").SetInternal(err)
@@ -133,16 +133,16 @@ func (s *Server) registerActivityRoutes(g *echo.Group) {
return nil
})
- g.DELETE("/activity/:activityId", func(c echo.Context) error {
+ g.DELETE("/activity/:activityID", func(c echo.Context) error {
ctx := context.Background()
- id, err := strconv.Atoi(c.Param("activityId"))
+ id, err := strconv.Atoi(c.Param("activityID"))
if err != nil {
- return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("activityId"))).SetInternal(err)
+ return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("activityID"))).SetInternal(err)
}
activityDelete := &api.ActivityDelete{
ID: id,
- DeleterId: c.Get(GetPrincipalIdContextKey()).(int),
+ DeleterID: c.Get(GetPrincipalIDContextKey()).(int),
}
err = s.ActivityService.DeleteActivity(ctx, activityDelete)
if err != nil {
@@ -161,12 +161,12 @@ func (s *Server) registerActivityRoutes(g *echo.Group) {
func (s *Server) ComposeActivityRelationship(ctx context.Context, activity *api.Activity) error {
var err error
- activity.Creator, err = s.ComposePrincipalById(ctx, activity.CreatorId)
+ activity.Creator, err = s.ComposePrincipalByID(ctx, activity.CreatorID)
if err != nil {
return err
}
- activity.Updater, err = s.ComposePrincipalById(ctx, activity.UpdaterId)
+ activity.Updater, err = s.ComposePrincipalByID(ctx, activity.UpdaterID)
if err != nil {
return err
}
diff --git a/server/activity_manager.go b/server/activity_manager.go
index 6c43888fee..d2e39ab607 100644
--- a/server/activity_manager.go
+++ b/server/activity_manager.go
@@ -63,7 +63,7 @@ func (m *ActivityManager) CreateActivity(ctx context.Context, create *api.Activi
}
hookFind := &api.ProjectWebhookFind{
- ProjectId: &meta.issue.ProjectId,
+ ProjectID: &meta.issue.ProjectID,
ActivityType: &create.Type,
}
hookList, err := m.s.ProjectWebhookService.FindProjectWebhookList(ctx, hookFind)
@@ -76,7 +76,7 @@ func (m *ActivityManager) CreateActivity(ctx context.Context, create *api.Activi
if len(hookList) > 0 {
if meta.issue.Project == nil {
projectFind := &api.ProjectFind{
- ID: &meta.issue.ProjectId,
+ ID: &meta.issue.ProjectID,
}
meta.issue.Project, err = m.s.ProjectService.FindProject(ctx, projectFind)
if err != nil {
@@ -85,7 +85,7 @@ func (m *ActivityManager) CreateActivity(ctx context.Context, create *api.Activi
}
principalFind := &api.PrincipalFind{
- ID: &create.CreatorId,
+ ID: &create.CreatorID,
}
updater, err := m.s.PrincipalService.FindPrincipal(ctx, principalFind)
if err != nil {
@@ -123,12 +123,12 @@ func (m *ActivityManager) CreateActivity(ctx context.Context, create *api.Activi
zap.Error(err))
return
}
- switch update.FieldId {
+ switch update.FieldID {
case api.IssueFieldAssignee:
{
var oldAssignee, newAssignee *api.Principal
if update.OldValue != "" {
- oldId, err := strconv.Atoi(update.OldValue)
+ oldID, err := strconv.Atoi(update.OldValue)
if err != nil {
m.s.l.Warn("Failed to post webhook event after changing the issue assignee, old assignee id is not number",
zap.String("issue_name", meta.issue.Name),
@@ -137,7 +137,7 @@ func (m *ActivityManager) CreateActivity(ctx context.Context, create *api.Activi
return
}
principalFind := &api.PrincipalFind{
- ID: &oldId,
+ ID: &oldID,
}
oldAssignee, err = m.s.PrincipalService.FindPrincipal(ctx, principalFind)
if err != nil {
@@ -150,7 +150,7 @@ func (m *ActivityManager) CreateActivity(ctx context.Context, create *api.Activi
}
if update.NewValue != "" {
- newId, err := strconv.Atoi(update.NewValue)
+ newID, err := strconv.Atoi(update.NewValue)
if err != nil {
m.s.l.Warn("Failed to post webhook event after changing the issue assignee, new assignee id is not number",
zap.String("issue_name", meta.issue.Name),
@@ -159,7 +159,7 @@ func (m *ActivityManager) CreateActivity(ctx context.Context, create *api.Activi
return
}
principalFind := &api.PrincipalFind{
- ID: &newId,
+ ID: &newID,
}
newAssignee, err = m.s.PrincipalService.FindPrincipal(ctx, principalFind)
if err != nil {
@@ -196,13 +196,13 @@ func (m *ActivityManager) CreateActivity(ctx context.Context, create *api.Activi
}
taskFind := &api.TaskFind{
- ID: &update.TaskId,
+ ID: &update.TaskID,
}
task, err := m.s.TaskService.FindTask(ctx, taskFind)
if err != nil {
m.s.l.Warn("Failed to post webhook event after changing the issue task status, failed to find task",
zap.String("issue_name", meta.issue.Name),
- zap.Int("task_id", update.TaskId),
+ zap.Int("task_id", update.TaskID),
zap.Error(err))
return
}
diff --git a/server/anomaly_scanner.go b/server/anomaly_scanner.go
index 253fcbb837..1645cfc885 100644
--- a/server/anomaly_scanner.go
+++ b/server/anomaly_scanner.go
@@ -82,7 +82,7 @@ func (s *AnomalyScanner) Run() error {
for _, instance := range instanceList {
for _, env := range environmentList {
- if env.ID == instance.EnvironmentId {
+ if env.ID == instance.EnvironmentID {
if env.RowStatus == api.Normal {
instance.Environment = env
}
@@ -121,7 +121,7 @@ func (s *AnomalyScanner) Run() error {
s.checkInstanceAnomaly(ctx, instance)
databaseFind := &api.DatabaseFind{
- InstanceId: &instance.ID,
+ InstanceID: &instance.ID,
}
dbList, err := s.server.DatabaseService.FindDatabaseList(ctx, databaseFind)
if err != nil {
@@ -164,8 +164,8 @@ func (s *AnomalyScanner) checkInstanceAnomaly(ctx context.Context, instance *api
zap.Error(err))
} else {
_, err = s.server.AnomalyService.UpsertActiveAnomaly(ctx, &api.AnomalyUpsert{
- CreatorId: api.SYSTEM_BOT_ID,
- InstanceId: instance.ID,
+ CreatorID: api.SYSTEM_BOT_ID,
+ InstanceID: instance.ID,
Type: api.AnomalyInstanceConnection,
Payload: string(payload),
})
@@ -180,7 +180,7 @@ func (s *AnomalyScanner) checkInstanceAnomaly(ctx context.Context, instance *api
} else {
defer driver.Close(ctx)
err := s.server.AnomalyService.ArchiveAnomaly(ctx, &api.AnomalyArchive{
- InstanceId: &instance.ID,
+ InstanceID: &instance.ID,
Type: api.AnomalyInstanceConnection,
})
if err != nil && common.ErrorCode(err) != common.NotFound {
@@ -202,8 +202,8 @@ func (s *AnomalyScanner) checkInstanceAnomaly(ctx context.Context, instance *api
} else {
if setup {
_, err = s.server.AnomalyService.UpsertActiveAnomaly(ctx, &api.AnomalyUpsert{
- CreatorId: api.SYSTEM_BOT_ID,
- InstanceId: instance.ID,
+ CreatorID: api.SYSTEM_BOT_ID,
+ InstanceID: instance.ID,
Type: api.AnomalyInstanceMigrationSchema,
})
if err != nil {
@@ -214,7 +214,7 @@ func (s *AnomalyScanner) checkInstanceAnomaly(ctx context.Context, instance *api
}
} else {
err := s.server.AnomalyService.ArchiveAnomaly(ctx, &api.AnomalyArchive{
- InstanceId: &instance.ID,
+ InstanceID: &instance.ID,
Type: api.AnomalyInstanceMigrationSchema,
})
if err != nil && common.ErrorCode(err) != common.NotFound {
@@ -245,9 +245,9 @@ func (s *AnomalyScanner) checkDatabaseAnomaly(ctx context.Context, instance *api
zap.Error(err))
} else {
_, err = s.server.AnomalyService.UpsertActiveAnomaly(ctx, &api.AnomalyUpsert{
- CreatorId: api.SYSTEM_BOT_ID,
- InstanceId: instance.ID,
- DatabaseId: &database.ID,
+ CreatorID: api.SYSTEM_BOT_ID,
+ InstanceID: instance.ID,
+ DatabaseID: &database.ID,
Type: api.AnomalyDatabaseConnection,
Payload: string(payload),
})
@@ -263,7 +263,7 @@ func (s *AnomalyScanner) checkDatabaseAnomaly(ctx context.Context, instance *api
} else {
defer driver.Close(ctx)
err := s.server.AnomalyService.ArchiveAnomaly(ctx, &api.AnomalyArchive{
- DatabaseId: &database.ID,
+ DatabaseID: &database.ID,
Type: api.AnomalyDatabaseConnection,
})
if err != nil && common.ErrorCode(err) != common.NotFound {
@@ -336,9 +336,9 @@ func (s *AnomalyScanner) checkDatabaseAnomaly(ctx context.Context, instance *api
zap.Error(err))
} else {
_, err = s.server.AnomalyService.UpsertActiveAnomaly(ctx, &api.AnomalyUpsert{
- CreatorId: api.SYSTEM_BOT_ID,
- InstanceId: instance.ID,
- DatabaseId: &database.ID,
+ CreatorID: api.SYSTEM_BOT_ID,
+ InstanceID: instance.ID,
+ DatabaseID: &database.ID,
Type: api.AnomalyDatabaseSchemaDrift,
Payload: string(payload),
})
@@ -352,7 +352,7 @@ func (s *AnomalyScanner) checkDatabaseAnomaly(ctx context.Context, instance *api
}
} else {
err := s.server.AnomalyService.ArchiveAnomaly(ctx, &api.AnomalyArchive{
- DatabaseId: &database.ID,
+ DatabaseID: &database.ID,
Type: api.AnomalyDatabaseConnection,
})
if err != nil && common.ErrorCode(err) != common.NotFound {
@@ -371,7 +371,7 @@ SchemaDriftEnd:
func (s *AnomalyScanner) checkBackupAnomaly(ctx context.Context, instance *api.Instance, database *api.Database, policyMap map[int]*api.BackupPlanPolicy) {
schedule := api.BackupPlanPolicyScheduleUnset
backupSettingFind := &api.BackupSettingFind{
- DatabaseId: &database.ID,
+ DatabaseID: &database.ID,
}
backupSetting, err := s.server.BackupService.FindBackupSetting(ctx, backupSettingFind)
if err != nil {
@@ -395,19 +395,19 @@ func (s *AnomalyScanner) checkBackupAnomaly(ctx context.Context, instance *api.I
// Check backup policy violation
{
var backupPolicyAnomalyPayload *api.AnomalyDatabaseBackupPolicyViolationPayload
- if policyMap[instance.EnvironmentId].Schedule != api.BackupPlanPolicyScheduleUnset {
- if policyMap[instance.EnvironmentId].Schedule == api.BackupPlanPolicyScheduleDaily &&
+ if policyMap[instance.EnvironmentID].Schedule != api.BackupPlanPolicyScheduleUnset {
+ if policyMap[instance.EnvironmentID].Schedule == api.BackupPlanPolicyScheduleDaily &&
schedule != api.BackupPlanPolicyScheduleDaily {
backupPolicyAnomalyPayload = &api.AnomalyDatabaseBackupPolicyViolationPayload{
- EnvironmentId: instance.EnvironmentId,
- ExpectedBackupSchedule: policyMap[instance.EnvironmentId].Schedule,
+ EnvironmentID: instance.EnvironmentID,
+ ExpectedBackupSchedule: policyMap[instance.EnvironmentID].Schedule,
ActualBackupSchedule: schedule,
}
- } else if policyMap[instance.EnvironmentId].Schedule == api.BackupPlanPolicyScheduleWeekly &&
+ } else if policyMap[instance.EnvironmentID].Schedule == api.BackupPlanPolicyScheduleWeekly &&
schedule == api.BackupPlanPolicyScheduleUnset {
backupPolicyAnomalyPayload = &api.AnomalyDatabaseBackupPolicyViolationPayload{
- EnvironmentId: instance.EnvironmentId,
- ExpectedBackupSchedule: policyMap[instance.EnvironmentId].Schedule,
+ EnvironmentID: instance.EnvironmentID,
+ ExpectedBackupSchedule: policyMap[instance.EnvironmentID].Schedule,
ActualBackupSchedule: schedule,
}
}
@@ -423,9 +423,9 @@ func (s *AnomalyScanner) checkBackupAnomaly(ctx context.Context, instance *api.I
zap.Error(err))
} else {
_, err = s.server.AnomalyService.UpsertActiveAnomaly(ctx, &api.AnomalyUpsert{
- CreatorId: api.SYSTEM_BOT_ID,
- InstanceId: instance.ID,
- DatabaseId: &database.ID,
+ CreatorID: api.SYSTEM_BOT_ID,
+ InstanceID: instance.ID,
+ DatabaseID: &database.ID,
Type: api.AnomalyDatabaseBackupPolicyViolation,
Payload: string(payload),
})
@@ -439,7 +439,7 @@ func (s *AnomalyScanner) checkBackupAnomaly(ctx context.Context, instance *api.I
}
} else {
err := s.server.AnomalyService.ArchiveAnomaly(ctx, &api.AnomalyArchive{
- DatabaseId: &database.ID,
+ DatabaseID: &database.ID,
Type: api.AnomalyDatabaseBackupPolicyViolation,
})
if err != nil && common.ErrorCode(err) != common.NotFound {
@@ -468,7 +468,7 @@ func (s *AnomalyScanner) checkBackupAnomaly(ctx context.Context, instance *api.I
if backupSetting.UpdatedTs < time.Now().Add(-backupMaxAge).Unix() {
status := api.BackupStatusDone
backupFind := &api.BackupFind{
- DatabaseId: &database.ID,
+ DatabaseID: &database.ID,
Status: &status,
}
backupList, err := s.server.BackupService.FindBackupList(ctx, backupFind)
@@ -507,9 +507,9 @@ func (s *AnomalyScanner) checkBackupAnomaly(ctx context.Context, instance *api.I
zap.Error(err))
} else {
_, err = s.server.AnomalyService.UpsertActiveAnomaly(ctx, &api.AnomalyUpsert{
- CreatorId: api.SYSTEM_BOT_ID,
- InstanceId: instance.ID,
- DatabaseId: &database.ID,
+ CreatorID: api.SYSTEM_BOT_ID,
+ InstanceID: instance.ID,
+ DatabaseID: &database.ID,
Type: api.AnomalyDatabaseBackupMissing,
Payload: string(payload),
})
@@ -523,7 +523,7 @@ func (s *AnomalyScanner) checkBackupAnomaly(ctx context.Context, instance *api.I
}
} else {
err := s.server.AnomalyService.ArchiveAnomaly(ctx, &api.AnomalyArchive{
- DatabaseId: &database.ID,
+ DatabaseID: &database.ID,
Type: api.AnomalyDatabaseBackupMissing,
})
if err != nil && common.ErrorCode(err) != common.NotFound {
diff --git a/server/auth.go b/server/auth.go
index 240d78db55..a4045fefcb 100644
--- a/server/auth.go
+++ b/server/auth.go
@@ -33,7 +33,7 @@ func (s *Server) registerAuthRoutes(g *echo.Group) {
}
memberFind := &api.MemberFind{
- PrincipalId: &user.ID,
+ PrincipalID: &user.ID,
}
member, err := s.MemberService.FindMember(ctx, memberFind)
if err != nil {
@@ -87,7 +87,7 @@ func (s *Server) registerAuthRoutes(g *echo.Group) {
}
principalCreate := &api.PrincipalCreate{
- CreatorId: api.SYSTEM_BOT_ID,
+ CreatorID: api.SYSTEM_BOT_ID,
Type: api.EndUser,
Name: signup.Name,
Email: signup.Email,
@@ -117,10 +117,10 @@ func (s *Server) registerAuthRoutes(g *echo.Group) {
role = api.Owner
}
memberCreate := &api.MemberCreate{
- CreatorId: user.ID,
+ CreatorID: user.ID,
Status: api.Active,
Role: role,
- PrincipalId: user.ID,
+ PrincipalID: user.ID,
}
member, err := s.MemberService.CreateMember(ctx, memberCreate)
@@ -133,7 +133,7 @@ func (s *Server) registerAuthRoutes(g *echo.Group) {
{
bytes, err := json.Marshal(api.ActivityMemberCreatePayload{
- PrincipalId: member.PrincipalId,
+ PrincipalID: member.PrincipalID,
PrincipalName: user.Name,
PrincipalEmail: user.Email,
MemberStatus: member.Status,
@@ -143,8 +143,8 @@ func (s *Server) registerAuthRoutes(g *echo.Group) {
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to construct activity payload").SetInternal(err)
}
activityCreate := &api.ActivityCreate{
- CreatorId: user.ID,
- ContainerId: member.ID,
+ CreatorID: user.ID,
+ ContainerID: member.ID,
Type: api.ActivityMemberCreate,
Level: api.ACTIVITY_INFO,
Payload: string(bytes),
diff --git a/server/backup_runner.go b/server/backup_runner.go
index 3c71322759..dd1c261828 100644
--- a/server/backup_runner.go
+++ b/server/backup_runner.go
@@ -71,27 +71,27 @@ func (s *BackupRunner) Run() error {
mu.Unlock()
databaseFind := &api.DatabaseFind{
- ID: &backupSetting.DatabaseId,
+ ID: &backupSetting.DatabaseID,
}
database, err := s.server.ComposeDatabaseByFind(ctx, databaseFind)
if err != nil {
s.l.Error("Failed to get database for backup setting",
zap.Int("id", backupSetting.ID),
- zap.String("databaseID", fmt.Sprintf("%v", backupSetting.DatabaseId)),
+ zap.String("databaseID", fmt.Sprintf("%v", backupSetting.DatabaseID)),
zap.String("error", err.Error()))
continue
}
backupSetting.Database = database
backupName := fmt.Sprintf("%s-%s-%s-autobackup", api.ProjectShortSlug(database.Project), api.EnvSlug(database.Instance.Environment), t.Format("20060102T030405"))
- go func(database *api.Database, backupSettingId int, backupName string) {
+ go func(database *api.Database, backupSettingID int, backupName string) {
s.l.Debug("Schedule auto backup",
zap.String("database", database.Name),
zap.String("backup", backupName),
)
defer func() {
mu.Lock()
- delete(runningTasks, backupSettingId)
+ delete(runningTasks, backupSettingID)
mu.Unlock()
}()
if err := s.scheduleBackupTask(ctx, database, backupName); err != nil {
@@ -123,8 +123,8 @@ func (s *BackupRunner) scheduleBackupTask(ctx context.Context, database *api.Dat
}
backupCreate := &api.BackupCreate{
- CreatorId: api.SYSTEM_BOT_ID,
- DatabaseId: database.ID,
+ CreatorID: api.SYSTEM_BOT_ID,
+ DatabaseID: database.ID,
Name: backupName,
Status: api.BackupStatusPendingCreate,
Type: api.BackupTypeAutomatic,
@@ -142,7 +142,7 @@ func (s *BackupRunner) scheduleBackupTask(ctx context.Context, database *api.Dat
}
payload := api.TaskDatabaseBackupPayload{
- BackupId: backup.ID,
+ BackupID: backup.ID,
}
bytes, err := json.Marshal(payload)
if err != nil {
@@ -151,7 +151,7 @@ func (s *BackupRunner) scheduleBackupTask(ctx context.Context, database *api.Dat
createdPipeline, err := s.server.PipelineService.CreatePipeline(ctx, &api.PipelineCreate{
Name: backupName,
- CreatorId: backupCreate.CreatorId,
+ CreatorID: backupCreate.CreatorID,
})
if err != nil {
return fmt.Errorf("failed to create pipeline: %w", err)
@@ -159,9 +159,9 @@ func (s *BackupRunner) scheduleBackupTask(ctx context.Context, database *api.Dat
createdStage, err := s.server.StageService.CreateStage(ctx, &api.StageCreate{
Name: backupName,
- EnvironmentId: database.Instance.EnvironmentId,
- PipelineId: createdPipeline.ID,
- CreatorId: backupCreate.CreatorId,
+ EnvironmentID: database.Instance.EnvironmentID,
+ PipelineID: createdPipeline.ID,
+ CreatorID: backupCreate.CreatorID,
})
if err != nil {
return fmt.Errorf("failed to create stage: %w", err)
@@ -169,14 +169,14 @@ func (s *BackupRunner) scheduleBackupTask(ctx context.Context, database *api.Dat
_, err = s.server.TaskService.CreateTask(ctx, &api.TaskCreate{
Name: backupName,
- PipelineId: createdPipeline.ID,
- StageId: createdStage.ID,
- InstanceId: database.InstanceId,
- DatabaseId: &database.ID,
+ PipelineID: createdPipeline.ID,
+ StageID: createdStage.ID,
+ InstanceID: database.InstanceID,
+ DatabaseID: &database.ID,
Status: api.TaskPending,
Type: api.TaskDatabaseBackup,
Payload: string(bytes),
- CreatorId: backupCreate.CreatorId,
+ CreatorID: backupCreate.CreatorID,
})
if err != nil {
return fmt.Errorf("failed to create task: %w", err)
diff --git a/server/bookmark.go b/server/bookmark.go
index b17e0f8937..3c0d7c5621 100644
--- a/server/bookmark.go
+++ b/server/bookmark.go
@@ -20,7 +20,7 @@ func (s *Server) registerBookmarkRoutes(g *echo.Group) {
return echo.NewHTTPError(http.StatusBadRequest, "Malformatted create bookmark request").SetInternal(err)
}
- bookmarkCreate.CreatorId = c.Get(GetPrincipalIdContextKey()).(int)
+ bookmarkCreate.CreatorID = c.Get(GetPrincipalIDContextKey()).(int)
bookmark, err := s.BookmarkService.CreateBookmark(ctx, bookmarkCreate)
if err != nil {
@@ -43,9 +43,9 @@ func (s *Server) registerBookmarkRoutes(g *echo.Group) {
g.GET("/bookmark", func(c echo.Context) error {
ctx := context.Background()
- creatorId := c.Get(GetPrincipalIdContextKey()).(int)
+ creatorID := c.Get(GetPrincipalIDContextKey()).(int)
bookmarkFind := &api.BookmarkFind{
- CreatorId: &creatorId,
+ CreatorID: &creatorID,
}
list, err := s.BookmarkService.FindBookmarkList(ctx, bookmarkFind)
if err != nil {
@@ -65,16 +65,16 @@ func (s *Server) registerBookmarkRoutes(g *echo.Group) {
return nil
})
- g.DELETE("/bookmark/:bookmarkId", func(c echo.Context) error {
+ g.DELETE("/bookmark/:bookmarkID", func(c echo.Context) error {
ctx := context.Background()
- id, err := strconv.Atoi(c.Param("bookmarkId"))
+ id, err := strconv.Atoi(c.Param("bookmarkID"))
if err != nil {
- return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("bookmarkId"))).SetInternal(err)
+ return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("bookmarkID"))).SetInternal(err)
}
bookmarkDelete := &api.BookmarkDelete{
ID: id,
- DeleterId: c.Get(GetPrincipalIdContextKey()).(int),
+ DeleterID: c.Get(GetPrincipalIDContextKey()).(int),
}
err = s.BookmarkService.DeleteBookmark(ctx, bookmarkDelete)
if err != nil {
@@ -93,12 +93,12 @@ func (s *Server) registerBookmarkRoutes(g *echo.Group) {
func (s *Server) ComposeBookmarkRelationship(ctx context.Context, bookmark *api.Bookmark) error {
var err error
- bookmark.Creator, err = s.ComposePrincipalById(ctx, bookmark.CreatorId)
+ bookmark.Creator, err = s.ComposePrincipalByID(ctx, bookmark.CreatorID)
if err != nil {
return err
}
- bookmark.Updater, err = s.ComposePrincipalById(ctx, bookmark.UpdaterId)
+ bookmark.Updater, err = s.ComposePrincipalByID(ctx, bookmark.UpdaterID)
if err != nil {
return err
}
diff --git a/server/database.go b/server/database.go
index 8385c4b391..caf1c0855e 100644
--- a/server/database.go
+++ b/server/database.go
@@ -23,12 +23,12 @@ func (s *Server) registerDatabaseRoutes(g *echo.Group) {
return echo.NewHTTPError(http.StatusBadRequest, "Malformatted create database request").SetInternal(err)
}
- databaseCreate.CreatorId = c.Get(GetPrincipalIdContextKey()).(int)
- instance, err := s.InstanceService.FindInstance(ctx, &api.InstanceFind{ID: &databaseCreate.InstanceId})
+ databaseCreate.CreatorID = c.Get(GetPrincipalIDContextKey()).(int)
+ instance, err := s.InstanceService.FindInstance(ctx, &api.InstanceFind{ID: &databaseCreate.InstanceID})
if err != nil {
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to find instance").SetInternal(err)
}
- databaseCreate.EnvironmentId = instance.EnvironmentId
+ databaseCreate.EnvironmentID = instance.EnvironmentID
database, err := s.DatabaseService.CreateDatabase(ctx, databaseCreate)
if err != nil {
@@ -52,20 +52,20 @@ func (s *Server) registerDatabaseRoutes(g *echo.Group) {
g.GET("/database", func(c echo.Context) error {
ctx := context.Background()
databaseFind := &api.DatabaseFind{}
- if instanceIdStr := c.QueryParam("instance"); instanceIdStr != "" {
- instanceId, err := strconv.Atoi(instanceIdStr)
+ if instanceIDStr := c.QueryParam("instance"); instanceIDStr != "" {
+ instanceID, err := strconv.Atoi(instanceIDStr)
if err != nil {
- return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Query parameter instance is not a number: %s", instanceIdStr)).SetInternal(err)
+ return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Query parameter instance is not a number: %s", instanceIDStr)).SetInternal(err)
}
- databaseFind.InstanceId = &instanceId
+ databaseFind.InstanceID = &instanceID
}
- projectIdStr := c.QueryParams().Get("project")
- if projectIdStr != "" {
- projectId, err := strconv.Atoi(projectIdStr)
+ projectIDStr := c.QueryParams().Get("project")
+ if projectIDStr != "" {
+ projectID, err := strconv.Atoi(projectIDStr)
if err != nil {
- return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("project query parameter is not a number: %s", projectIdStr)).SetInternal(err)
+ return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("project query parameter is not a number: %s", projectIDStr)).SetInternal(err)
}
- databaseFind.ProjectId = &projectId
+ databaseFind.ProjectID = &projectID
}
list, err := s.ComposeDatabaseListByFind(ctx, databaseFind)
if err != nil {
@@ -81,11 +81,11 @@ func (s *Server) registerDatabaseRoutes(g *echo.Group) {
// - The database list left sidebar will only return databases related to the caller regardless of the caller's role.
// - The database list on the instance page will return all databases if the caller is Owner or DBA, but will only return
// related databases if the caller is Developer.
- if projectIdStr == "" && (databaseFind.InstanceId == nil || role == api.Developer) {
- principalId := c.Get(GetPrincipalIdContextKey()).(int)
+ if projectIDStr == "" && (databaseFind.InstanceID == nil || role == api.Developer) {
+ principalID := c.Get(GetPrincipalIDContextKey()).(int)
for _, database := range list {
for _, projectMember := range database.Project.ProjectMemberList {
- if projectMember.PrincipalId == principalId {
+ if projectMember.PrincipalID == principalID {
filteredList = append(filteredList, database)
break
}
@@ -136,7 +136,7 @@ func (s *Server) registerDatabaseRoutes(g *echo.Group) {
databasePatch := &api.DatabasePatch{
ID: id,
- UpdaterId: c.Get(GetPrincipalIdContextKey()).(int),
+ UpdaterID: c.Get(GetPrincipalIDContextKey()).(int),
}
if err := jsonapi.UnmarshalPayload(c.Request().Body, databasePatch); err != nil {
return echo.NewHTTPError(http.StatusBadRequest, "Malformatted patch database request").SetInternal(err)
@@ -145,7 +145,7 @@ func (s *Server) registerDatabaseRoutes(g *echo.Group) {
// If we are transferring the database to a different project, then we create a project activity in both
// the old project and new project.
var existingDatabase *api.Database
- if databasePatch.ProjectId != nil {
+ if databasePatch.ProjectID != nil {
existingDatabase, err = s.DatabaseService.FindDatabase(ctx, &api.DatabaseFind{
ID: &databasePatch.ID,
})
@@ -170,17 +170,17 @@ func (s *Server) registerDatabaseRoutes(g *echo.Group) {
}
// Create transferring database project activity.
- if databasePatch.ProjectId != nil {
+ if databasePatch.ProjectID != nil {
bytes, err := json.Marshal(api.ActivityProjectDatabaseTransferPayload{
- DatabaseId: database.ID,
+ DatabaseID: database.ID,
DatabaseName: database.Name,
})
if err == nil {
- existingDatabase.Project, err = s.ComposeProjectlById(ctx, existingDatabase.ProjectId)
+ existingDatabase.Project, err = s.ComposeProjectlByID(ctx, existingDatabase.ProjectID)
if err == nil {
activityCreate := &api.ActivityCreate{
- CreatorId: c.Get(GetPrincipalIdContextKey()).(int),
- ContainerId: existingDatabase.ProjectId,
+ CreatorID: c.Get(GetPrincipalIDContextKey()).(int),
+ ContainerID: existingDatabase.ProjectID,
Type: api.ActivityProjectDatabaseTransfer,
Level: api.ACTIVITY_INFO,
Comment: fmt.Sprintf("Transferred out database %q to project %q.",
@@ -194,15 +194,15 @@ func (s *Server) registerDatabaseRoutes(g *echo.Group) {
s.l.Warn("Failed to create project activity after transferring database",
zap.Int("database_id", database.ID),
zap.String("database_name", database.Name),
- zap.Int("old_project_id", existingDatabase.ProjectId),
- zap.Int("new_project_id", database.ProjectId),
+ zap.Int("old_project_id", existingDatabase.ProjectID),
+ zap.Int("new_project_id", database.ProjectID),
zap.Error(err))
}
{
activityCreate := &api.ActivityCreate{
- CreatorId: c.Get(GetPrincipalIdContextKey()).(int),
- ContainerId: database.ProjectId,
+ CreatorID: c.Get(GetPrincipalIDContextKey()).(int),
+ ContainerID: database.ProjectID,
Type: api.ActivityProjectDatabaseTransfer,
Level: api.ACTIVITY_INFO,
Comment: fmt.Sprintf("Transferred in database %q from project %q.",
@@ -214,8 +214,8 @@ func (s *Server) registerDatabaseRoutes(g *echo.Group) {
s.l.Warn("Failed to create project activity after transferring database",
zap.Int("database_id", database.ID),
zap.String("database_name", database.Name),
- zap.Int("old_project_id", existingDatabase.ProjectId),
- zap.Int("new_project_id", database.ProjectId),
+ zap.Int("old_project_id", existingDatabase.ProjectID),
+ zap.Int("new_project_id", database.ProjectID),
zap.Error(err))
}
}
@@ -248,7 +248,7 @@ func (s *Server) registerDatabaseRoutes(g *echo.Group) {
}
tableFind := &api.TableFind{
- DatabaseId: &id,
+ DatabaseID: &id,
}
tableList, err := s.TableService.FindTableList(ctx, tableFind)
if err != nil {
@@ -258,8 +258,8 @@ func (s *Server) registerDatabaseRoutes(g *echo.Group) {
for _, table := range tableList {
table.Database = database
columnFind := &api.ColumnFind{
- DatabaseId: &id,
- TableId: &table.ID,
+ DatabaseID: &id,
+ TableID: &table.ID,
}
table.ColumnList, err = s.ColumnService.FindColumnList(ctx, columnFind)
if err != nil {
@@ -267,8 +267,8 @@ func (s *Server) registerDatabaseRoutes(g *echo.Group) {
}
indexFind := &api.IndexFind{
- DatabaseId: &id,
- TableId: &table.ID,
+ DatabaseID: &id,
+ TableID: &table.ID,
}
table.IndexList, err = s.IndexService.FindIndexList(ctx, indexFind)
if err != nil {
@@ -307,7 +307,7 @@ func (s *Server) registerDatabaseRoutes(g *echo.Group) {
tableName := c.Param("tableName")
tableFind := &api.TableFind{
- DatabaseId: &id,
+ DatabaseID: &id,
Name: &tableName,
}
table, err := s.TableService.FindTable(ctx, tableFind)
@@ -318,8 +318,8 @@ func (s *Server) registerDatabaseRoutes(g *echo.Group) {
table.Database = database
columnFind := &api.ColumnFind{
- DatabaseId: &id,
- TableId: &table.ID,
+ DatabaseID: &id,
+ TableID: &table.ID,
}
table.ColumnList, err = s.ColumnService.FindColumnList(ctx, columnFind)
if err != nil {
@@ -327,8 +327,8 @@ func (s *Server) registerDatabaseRoutes(g *echo.Group) {
}
indexFind := &api.IndexFind{
- DatabaseId: &id,
- TableId: &table.ID,
+ DatabaseID: &id,
+ TableID: &table.ID,
}
table.IndexList, err = s.IndexService.FindIndexList(ctx, indexFind)
if err != nil {
@@ -365,7 +365,7 @@ func (s *Server) registerDatabaseRoutes(g *echo.Group) {
}
viewFind := &api.ViewFind{
- DatabaseId: &id,
+ DatabaseID: &id,
}
viewList, err := s.ViewService.FindViewList(ctx, viewFind)
if err != nil {
@@ -398,7 +398,7 @@ func (s *Server) registerDatabaseRoutes(g *echo.Group) {
if err := jsonapi.UnmarshalPayload(c.Request().Body, backupCreate); err != nil {
return echo.NewHTTPError(http.StatusBadRequest, "Malformatted create backup request").SetInternal(err)
}
- backupCreate.CreatorId = c.Get(GetPrincipalIdContextKey()).(int)
+ backupCreate.CreatorID = c.Get(GetPrincipalIDContextKey()).(int)
databaseFind := &api.DatabaseFind{
ID: &id,
@@ -434,7 +434,7 @@ func (s *Server) registerDatabaseRoutes(g *echo.Group) {
}
payload := api.TaskDatabaseBackupPayload{
- BackupId: backup.ID,
+ BackupID: backup.ID,
}
bytes, err := json.Marshal(payload)
if err != nil {
@@ -443,7 +443,7 @@ func (s *Server) registerDatabaseRoutes(g *echo.Group) {
createdPipeline, err := s.PipelineService.CreatePipeline(ctx, &api.PipelineCreate{
Name: fmt.Sprintf("backup-pipeline-%s", backup.Name),
- CreatorId: backupCreate.CreatorId,
+ CreatorID: backupCreate.CreatorID,
})
if err != nil {
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to create backup pipeline").SetInternal(err)
@@ -451,9 +451,9 @@ func (s *Server) registerDatabaseRoutes(g *echo.Group) {
createdStage, err := s.StageService.CreateStage(ctx, &api.StageCreate{
Name: fmt.Sprintf("backup-stage-%s", backup.Name),
- EnvironmentId: database.Instance.EnvironmentId,
- PipelineId: createdPipeline.ID,
- CreatorId: backupCreate.CreatorId,
+ EnvironmentID: database.Instance.EnvironmentID,
+ PipelineID: createdPipeline.ID,
+ CreatorID: backupCreate.CreatorID,
})
if err != nil {
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to create backup stage").SetInternal(err)
@@ -461,14 +461,14 @@ func (s *Server) registerDatabaseRoutes(g *echo.Group) {
_, err = s.TaskService.CreateTask(ctx, &api.TaskCreate{
Name: fmt.Sprintf("backup-task-%s", backup.Name),
- PipelineId: createdPipeline.ID,
- StageId: createdStage.ID,
- InstanceId: database.InstanceId,
- DatabaseId: &database.ID,
+ PipelineID: createdPipeline.ID,
+ StageID: createdStage.ID,
+ InstanceID: database.InstanceID,
+ DatabaseID: &database.ID,
Status: api.TaskPending,
Type: api.TaskDatabaseBackup,
Payload: string(bytes),
- CreatorId: backupCreate.CreatorId,
+ CreatorID: backupCreate.CreatorID,
})
if err != nil {
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to create backup task").SetInternal(err)
@@ -500,7 +500,7 @@ func (s *Server) registerDatabaseRoutes(g *echo.Group) {
}
backupFind := &api.BackupFind{
- DatabaseId: &id,
+ DatabaseID: &id,
}
backupList, err := s.BackupService.FindBackupList(ctx, backupFind)
if err != nil {
@@ -531,7 +531,7 @@ func (s *Server) registerDatabaseRoutes(g *echo.Group) {
if err := jsonapi.UnmarshalPayload(c.Request().Body, backupSettingUpsert); err != nil {
return echo.NewHTTPError(http.StatusBadRequest, "Malformatted set backup setting request").SetInternal(err)
}
- backupSettingUpsert.UpdaterId = c.Get(GetPrincipalIdContextKey()).(int)
+ backupSettingUpsert.UpdaterID = c.Get(GetPrincipalIDContextKey()).(int)
databaseFind := &api.DatabaseFind{
ID: &id,
@@ -543,7 +543,7 @@ func (s *Server) registerDatabaseRoutes(g *echo.Group) {
}
return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to fetch database ID: %v", id)).SetInternal(err)
}
- backupSettingUpsert.EnvironmentId = db.Instance.Environment.ID
+ backupSettingUpsert.EnvironmentID = db.Instance.Environment.ID
backupSetting, err := s.BackupService.UpsertBackupSetting(ctx, backupSettingUpsert)
if err != nil {
@@ -576,7 +576,7 @@ func (s *Server) registerDatabaseRoutes(g *echo.Group) {
}
backupSettingFind := &api.BackupSettingFind{
- DatabaseId: &id,
+ DatabaseID: &id,
}
backupSetting, err := s.BackupService.FindBackupSetting(ctx, backupSettingFind)
if err != nil {
@@ -629,28 +629,28 @@ func (s *Server) ComposeDatabaseListByFind(ctx context.Context, find *api.Databa
func (s *Server) ComposeDatabaseRelationship(ctx context.Context, database *api.Database) error {
var err error
- database.Creator, err = s.ComposePrincipalById(ctx, database.CreatorId)
+ database.Creator, err = s.ComposePrincipalByID(ctx, database.CreatorID)
if err != nil {
return err
}
- database.Updater, err = s.ComposePrincipalById(ctx, database.UpdaterId)
+ database.Updater, err = s.ComposePrincipalByID(ctx, database.UpdaterID)
if err != nil {
return err
}
- database.Project, err = s.ComposeProjectlById(ctx, database.ProjectId)
+ database.Project, err = s.ComposeProjectlByID(ctx, database.ProjectID)
if err != nil {
return err
}
- database.Instance, err = s.ComposeInstanceById(ctx, database.InstanceId)
+ database.Instance, err = s.ComposeInstanceByID(ctx, database.InstanceID)
if err != nil {
return err
}
- if database.SourceBackupId != 0 {
- database.SourceBackup, err = s.ComposeBackupByID(ctx, database.SourceBackupId)
+ if database.SourceBackupID != 0 {
+ database.SourceBackup, err = s.ComposeBackupByID(ctx, database.SourceBackupID)
if err != nil {
return err
}
@@ -661,17 +661,17 @@ func (s *Server) ComposeDatabaseRelationship(ctx context.Context, database *api.
rowStatus := api.Normal
database.AnomalyList, err = s.AnomalyService.FindAnomalyList(ctx, &api.AnomalyFind{
RowStatus: &rowStatus,
- DatabaseId: &database.ID,
+ DatabaseID: &database.ID,
})
if err != nil {
return err
}
for _, anomaly := range database.AnomalyList {
- anomaly.Creator, err = s.ComposePrincipalById(ctx, anomaly.CreatorId)
+ anomaly.Creator, err = s.ComposePrincipalByID(ctx, anomaly.CreatorID)
if err != nil {
return err
}
- anomaly.Updater, err = s.ComposePrincipalById(ctx, anomaly.UpdaterId)
+ anomaly.Updater, err = s.ComposePrincipalByID(ctx, anomaly.UpdaterID)
if err != nil {
return err
}
@@ -683,12 +683,12 @@ func (s *Server) ComposeDatabaseRelationship(ctx context.Context, database *api.
func (s *Server) ComposeTableRelationship(ctx context.Context, table *api.Table) error {
var err error
- table.Creator, err = s.ComposePrincipalById(ctx, table.CreatorId)
+ table.Creator, err = s.ComposePrincipalByID(ctx, table.CreatorID)
if err != nil {
return err
}
- table.Updater, err = s.ComposePrincipalById(ctx, table.UpdaterId)
+ table.Updater, err = s.ComposePrincipalByID(ctx, table.UpdaterID)
if err != nil {
return err
}
@@ -698,12 +698,12 @@ func (s *Server) ComposeTableRelationship(ctx context.Context, table *api.Table)
func (s *Server) ComposeViewRelationship(ctx context.Context, view *api.View) error {
var err error
- view.Creator, err = s.ComposePrincipalById(ctx, view.CreatorId)
+ view.Creator, err = s.ComposePrincipalByID(ctx, view.CreatorID)
if err != nil {
return err
}
- view.Updater, err = s.ComposePrincipalById(ctx, view.UpdaterId)
+ view.Updater, err = s.ComposePrincipalByID(ctx, view.UpdaterID)
if err != nil {
return err
}
@@ -730,11 +730,11 @@ func (s *Server) ComposeBackupByID(ctx context.Context, id int) (*api.Backup, er
// ComposeBackupRelationship will compose the relationship of a backup.
func (s *Server) ComposeBackupRelationship(ctx context.Context, backup *api.Backup) error {
var err error
- backup.Creator, err = s.ComposePrincipalById(ctx, backup.CreatorId)
+ backup.Creator, err = s.ComposePrincipalByID(ctx, backup.CreatorID)
if err != nil {
return err
}
- backup.Updater, err = s.ComposePrincipalById(ctx, backup.UpdaterId)
+ backup.Updater, err = s.ComposePrincipalByID(ctx, backup.UpdaterID)
if err != nil {
return err
}
diff --git a/server/environment.go b/server/environment.go
index afe39b6ff8..e99a6d21ca 100644
--- a/server/environment.go
+++ b/server/environment.go
@@ -21,7 +21,7 @@ func (s *Server) registerEnvironmentRoutes(g *echo.Group) {
return echo.NewHTTPError(http.StatusBadRequest, "Malformatted create environment request").SetInternal(err)
}
- environmentCreate.CreatorId = c.Get(GetPrincipalIdContextKey()).(int)
+ environmentCreate.CreatorID = c.Get(GetPrincipalIDContextKey()).(int)
environment, err := s.EnvironmentService.CreateEnvironment(ctx, environmentCreate)
if err != nil {
@@ -76,7 +76,7 @@ func (s *Server) registerEnvironmentRoutes(g *echo.Group) {
environmentPatch := &api.EnvironmentPatch{
ID: id,
- UpdaterId: c.Get(GetPrincipalIdContextKey()).(int),
+ UpdaterID: c.Get(GetPrincipalIDContextKey()).(int),
}
if err := jsonapi.UnmarshalPayload(c.Request().Body, environmentPatch); err != nil {
return echo.NewHTTPError(http.StatusBadRequest, "Malformatted patch environment request").SetInternal(err)
@@ -110,7 +110,7 @@ func (s *Server) registerEnvironmentRoutes(g *echo.Group) {
for _, item := range patchList {
environmentPatch, _ := item.(*api.EnvironmentPatch)
- environmentPatch.UpdaterId = c.Get(GetPrincipalIdContextKey()).(int)
+ environmentPatch.UpdaterID = c.Get(GetPrincipalIDContextKey()).(int)
_, err = s.EnvironmentService.PatchEnvironment(ctx, environmentPatch)
if err != nil {
if common.ErrorCode(err) == common.NotFound {
@@ -140,7 +140,7 @@ func (s *Server) registerEnvironmentRoutes(g *echo.Group) {
})
}
-func (s *Server) ComposeEnvironmentById(ctx context.Context, id int) (*api.Environment, error) {
+func (s *Server) ComposeEnvironmentByID(ctx context.Context, id int) (*api.Environment, error) {
environmentFind := &api.EnvironmentFind{
ID: &id,
}
@@ -159,12 +159,12 @@ func (s *Server) ComposeEnvironmentById(ctx context.Context, id int) (*api.Envir
func (s *Server) ComposeEnvironmentRelationship(ctx context.Context, environment *api.Environment) error {
var err error
- environment.Creator, err = s.ComposePrincipalById(ctx, environment.CreatorId)
+ environment.Creator, err = s.ComposePrincipalByID(ctx, environment.CreatorID)
if err != nil {
return err
}
- environment.Updater, err = s.ComposePrincipalById(ctx, environment.UpdaterId)
+ environment.Updater, err = s.ComposePrincipalByID(ctx, environment.UpdaterID)
if err != nil {
return err
}
diff --git a/server/inbox.go b/server/inbox.go
index ea971af1b4..4a768b9412 100644
--- a/server/inbox.go
+++ b/server/inbox.go
@@ -16,13 +16,13 @@ func (s *Server) registerInboxRoutes(g *echo.Group) {
g.GET("/inbox", func(c echo.Context) error {
ctx := context.Background()
inboxFind := &api.InboxFind{}
- userIdStr := c.QueryParams().Get("user")
- if userIdStr != "" {
- userId, err := strconv.Atoi(userIdStr)
+ userIDStr := c.QueryParams().Get("user")
+ if userIDStr != "" {
+ userID, err := strconv.Atoi(userIDStr)
if err != nil {
- return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Query parameter user is not a number: %s", userIdStr)).SetInternal(err)
+ return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Query parameter user is not a number: %s", userIDStr)).SetInternal(err)
}
- inboxFind.ReceiverId = &userId
+ inboxFind.ReceiverID = &userID
}
createdAfterStr := c.QueryParams().Get("created")
if createdAfterStr != "" {
@@ -52,28 +52,28 @@ func (s *Server) registerInboxRoutes(g *echo.Group) {
g.GET("/inbox/summary", func(c echo.Context) error {
ctx := context.Background()
- userIdStr := c.QueryParams().Get("user")
- if userIdStr == "" {
+ userIDStr := c.QueryParams().Get("user")
+ if userIDStr == "" {
return echo.NewHTTPError(http.StatusBadRequest, "Missing query parameter user")
}
- userId, err := strconv.Atoi(userIdStr)
+ userID, err := strconv.Atoi(userIDStr)
if err != nil {
- return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Query parameter user is not a number: %s", userIdStr)).SetInternal(err)
+ return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Query parameter user is not a number: %s", userIDStr)).SetInternal(err)
}
- summary, err := s.InboxService.FindInboxSummary(ctx, userId)
+ summary, err := s.InboxService.FindInboxSummary(ctx, userID)
if err != nil {
- return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to fetch inbox summary for user ID: %d", userId)).SetInternal(err)
+ return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to fetch inbox summary for user ID: %d", userID)).SetInternal(err)
}
return c.JSON(http.StatusOK, summary)
})
- g.PATCH("/inbox/:inboxId", func(c echo.Context) error {
+ g.PATCH("/inbox/:inboxID", func(c echo.Context) error {
ctx := context.Background()
- id, err := strconv.Atoi(c.Param("inboxId"))
+ id, err := strconv.Atoi(c.Param("inboxID"))
if err != nil {
- return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("inboxId"))).SetInternal(err)
+ return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("inboxID"))).SetInternal(err)
}
inboxPatch := &api.InboxPatch{
diff --git a/server/instance.go b/server/instance.go
index 0f8255290b..ac187adb9c 100644
--- a/server/instance.go
+++ b/server/instance.go
@@ -22,7 +22,7 @@ func (s *Server) registerInstanceRoutes(g *echo.Group) {
return echo.NewHTTPError(http.StatusBadRequest, "Malformatted create instance request").SetInternal(err)
}
- instanceCreate.CreatorId = c.Get(GetPrincipalIdContextKey()).(int)
+ instanceCreate.CreatorID = c.Get(GetPrincipalIDContextKey()).(int)
instance, err := s.InstanceService.CreateInstance(ctx, instanceCreate)
if err != nil {
@@ -79,14 +79,14 @@ func (s *Server) registerInstanceRoutes(g *echo.Group) {
return nil
})
- g.GET("/instance/:instanceId", func(c echo.Context) error {
+ g.GET("/instance/:instanceID", func(c echo.Context) error {
ctx := context.Background()
- id, err := strconv.Atoi(c.Param("instanceId"))
+ id, err := strconv.Atoi(c.Param("instanceID"))
if err != nil {
- return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("instanceId"))).SetInternal(err)
+ return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("instanceID"))).SetInternal(err)
}
- instance, err := s.ComposeInstanceById(ctx, id)
+ instance, err := s.ComposeInstanceByID(ctx, id)
if err != nil {
if common.ErrorCode(err) == common.NotFound {
return echo.NewHTTPError(http.StatusNotFound, fmt.Sprintf("Instance ID not found: %d", id))
@@ -101,16 +101,16 @@ func (s *Server) registerInstanceRoutes(g *echo.Group) {
return nil
})
- g.PATCH("/instance/:instanceId", func(c echo.Context) error {
+ g.PATCH("/instance/:instanceID", func(c echo.Context) error {
ctx := context.Background()
- id, err := strconv.Atoi(c.Param("instanceId"))
+ id, err := strconv.Atoi(c.Param("instanceID"))
if err != nil {
- return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("instanceId"))).SetInternal(err)
+ return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("instanceID"))).SetInternal(err)
}
instancePatch := &api.InstancePatch{
ID: id,
- UpdaterId: c.Get(GetPrincipalIdContextKey()).(int),
+ UpdaterID: c.Get(GetPrincipalIDContextKey()).(int),
}
if err := jsonapi.UnmarshalPayload(c.Request().Body, instancePatch); err != nil {
return echo.NewHTTPError(http.StatusBadRequest, "Malformatted patch instance request").SetInternal(err)
@@ -141,7 +141,7 @@ func (s *Server) registerInstanceRoutes(g *echo.Group) {
dataSourceType := api.Admin
dataSourceFind := &api.DataSourceFind{
- InstanceId: &instance.ID,
+ InstanceID: &instance.ID,
Type: &dataSourceType,
}
adminDataSource, err := s.DataSourceService.FindDataSource(ctx, dataSourceFind)
@@ -151,7 +151,7 @@ func (s *Server) registerInstanceRoutes(g *echo.Group) {
dataSourcePatch := &api.DataSourcePatch{
ID: adminDataSource.ID,
- UpdaterId: c.Get(GetPrincipalIdContextKey()).(int),
+ UpdaterID: c.Get(GetPrincipalIDContextKey()).(int),
Username: instancePatch.Username,
}
if instancePatch.Password != nil {
@@ -187,15 +187,15 @@ func (s *Server) registerInstanceRoutes(g *echo.Group) {
return nil
})
- g.GET("/instance/:instanceId/user", func(c echo.Context) error {
+ g.GET("/instance/:instanceID/user", func(c echo.Context) error {
ctx := context.Background()
- id, err := strconv.Atoi(c.Param("instanceId"))
+ id, err := strconv.Atoi(c.Param("instanceID"))
if err != nil {
- return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("instanceId"))).SetInternal(err)
+ return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("instanceID"))).SetInternal(err)
}
instanceUserFind := &api.InstanceUserFind{
- InstanceId: id,
+ InstanceID: id,
}
list, err := s.InstanceUserService.FindInstanceUserList(ctx, instanceUserFind)
if err != nil {
@@ -209,14 +209,14 @@ func (s *Server) registerInstanceRoutes(g *echo.Group) {
return nil
})
- g.POST("/instance/:instanceId/migration", func(c echo.Context) error {
+ g.POST("/instance/:instanceID/migration", func(c echo.Context) error {
ctx := context.Background()
- id, err := strconv.Atoi(c.Param("instanceId"))
+ id, err := strconv.Atoi(c.Param("instanceID"))
if err != nil {
- return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("instanceId"))).SetInternal(err)
+ return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("instanceID"))).SetInternal(err)
}
- instance, err := s.ComposeInstanceById(ctx, id)
+ instance, err := s.ComposeInstanceByID(ctx, id)
if err != nil {
if common.ErrorCode(err) == common.NotFound {
return echo.NewHTTPError(http.StatusNotFound, fmt.Sprintf("Instance ID not found: %d", id))
@@ -256,14 +256,14 @@ func (s *Server) registerInstanceRoutes(g *echo.Group) {
return nil
})
- g.GET("/instance/:instanceId/migration/status", func(c echo.Context) error {
+ g.GET("/instance/:instanceID/migration/status", func(c echo.Context) error {
ctx := context.Background()
- id, err := strconv.Atoi(c.Param("instanceId"))
+ id, err := strconv.Atoi(c.Param("instanceID"))
if err != nil {
- return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("instanceId"))).SetInternal(err)
+ return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("instanceID"))).SetInternal(err)
}
- instance, err := s.ComposeInstanceById(ctx, id)
+ instance, err := s.ComposeInstanceByID(ctx, id)
if err != nil {
if common.ErrorCode(err) == common.NotFound {
return echo.NewHTTPError(http.StatusNotFound, fmt.Sprintf("Instance ID not found: %d", id))
@@ -296,19 +296,19 @@ func (s *Server) registerInstanceRoutes(g *echo.Group) {
return nil
})
- g.GET("/instance/:instanceId/migration/history/:historyId", func(c echo.Context) error {
+ g.GET("/instance/:instanceID/migration/history/:historyID", func(c echo.Context) error {
ctx := context.Background()
- id, err := strconv.Atoi(c.Param("instanceId"))
+ id, err := strconv.Atoi(c.Param("instanceID"))
if err != nil {
- return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Intance ID is not a number: %s", c.Param("instanceId"))).SetInternal(err)
+ return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Intance ID is not a number: %s", c.Param("instanceID"))).SetInternal(err)
}
- historyId, err := strconv.Atoi(c.Param("historyId"))
+ historyID, err := strconv.Atoi(c.Param("historyID"))
if err != nil {
- return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("History ID is not a number: %s", c.Param("historyId"))).SetInternal(err)
+ return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("History ID is not a number: %s", c.Param("historyID"))).SetInternal(err)
}
- instance, err := s.ComposeInstanceById(ctx, id)
+ instance, err := s.ComposeInstanceByID(ctx, id)
if err != nil {
if common.ErrorCode(err) == common.NotFound {
return echo.NewHTTPError(http.StatusNotFound, fmt.Sprintf("Instance ID not found: %d", id))
@@ -316,7 +316,7 @@ func (s *Server) registerInstanceRoutes(g *echo.Group) {
return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to fetch instance ID: %v", id)).SetInternal(err)
}
- find := &db.MigrationHistoryFind{ID: &historyId}
+ find := &db.MigrationHistoryFind{ID: &historyID}
driver, err := GetDatabaseDriver(ctx, instance, "", s.l)
if err != nil {
return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to fetch migration history ID %d for instance %q", id, instance.Name)).SetInternal(err)
@@ -327,7 +327,7 @@ func (s *Server) registerInstanceRoutes(g *echo.Group) {
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to fetch migration history list").SetInternal(err)
}
if len(list) == 0 {
- return echo.NewHTTPError(http.StatusNotFound, fmt.Sprintf("Migration history ID %d not found for instance %q", historyId, instance.Name))
+ return echo.NewHTTPError(http.StatusNotFound, fmt.Sprintf("Migration history ID %d not found for instance %q", historyID, instance.Name))
}
entry := list[0]
@@ -349,7 +349,7 @@ func (s *Server) registerInstanceRoutes(g *echo.Group) {
Schema: entry.Schema,
SchemaPrev: entry.SchemaPrev,
ExecutionDuration: entry.ExecutionDuration,
- IssueId: entry.IssueId,
+ IssueID: entry.IssueID,
Payload: entry.Payload,
}); err != nil {
return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to marshal migration history response for instance: %v", instance.Name)).SetInternal(err)
@@ -357,14 +357,14 @@ func (s *Server) registerInstanceRoutes(g *echo.Group) {
return nil
})
- g.GET("/instance/:instanceId/migration/history", func(c echo.Context) error {
+ g.GET("/instance/:instanceID/migration/history", func(c echo.Context) error {
ctx := context.Background()
- id, err := strconv.Atoi(c.Param("instanceId"))
+ id, err := strconv.Atoi(c.Param("instanceID"))
if err != nil {
- return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("instanceId"))).SetInternal(err)
+ return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("instanceID"))).SetInternal(err)
}
- instance, err := s.ComposeInstanceById(ctx, id)
+ instance, err := s.ComposeInstanceByID(ctx, id)
if err != nil {
if common.ErrorCode(err) == common.NotFound {
return echo.NewHTTPError(http.StatusNotFound, fmt.Sprintf("Instance ID not found: %d", id))
@@ -418,7 +418,7 @@ func (s *Server) registerInstanceRoutes(g *echo.Group) {
Schema: entry.Schema,
SchemaPrev: entry.SchemaPrev,
ExecutionDuration: entry.ExecutionDuration,
- IssueId: entry.IssueId,
+ IssueID: entry.IssueID,
Payload: entry.Payload,
})
}
@@ -431,7 +431,7 @@ func (s *Server) registerInstanceRoutes(g *echo.Group) {
})
}
-func (s *Server) ComposeInstanceById(ctx context.Context, id int) (*api.Instance, error) {
+func (s *Server) ComposeInstanceByID(ctx context.Context, id int) (*api.Instance, error) {
instanceFind := &api.InstanceFind{
ID: &id,
}
@@ -450,17 +450,17 @@ func (s *Server) ComposeInstanceById(ctx context.Context, id int) (*api.Instance
func (s *Server) ComposeInstanceRelationship(ctx context.Context, instance *api.Instance) error {
var err error
- instance.Creator, err = s.ComposePrincipalById(ctx, instance.CreatorId)
+ instance.Creator, err = s.ComposePrincipalByID(ctx, instance.CreatorID)
if err != nil {
return err
}
- instance.Updater, err = s.ComposePrincipalById(ctx, instance.UpdaterId)
+ instance.Updater, err = s.ComposePrincipalByID(ctx, instance.UpdaterID)
if err != nil {
return err
}
- instance.Environment, err = s.ComposeEnvironmentById(ctx, instance.EnvironmentId)
+ instance.Environment, err = s.ComposeEnvironmentByID(ctx, instance.EnvironmentID)
if err != nil {
return err
}
@@ -468,18 +468,18 @@ func (s *Server) ComposeInstanceRelationship(ctx context.Context, instance *api.
rowStatus := api.Normal
instance.AnomalyList, err = s.AnomalyService.FindAnomalyList(ctx, &api.AnomalyFind{
RowStatus: &rowStatus,
- InstanceId: &instance.ID,
+ InstanceID: &instance.ID,
InstanceOnly: true,
})
if err != nil {
return err
}
for _, anomaly := range instance.AnomalyList {
- anomaly.Creator, err = s.ComposePrincipalById(ctx, anomaly.CreatorId)
+ anomaly.Creator, err = s.ComposePrincipalByID(ctx, anomaly.CreatorID)
if err != nil {
return err
}
- anomaly.Updater, err = s.ComposePrincipalById(ctx, anomaly.UpdaterId)
+ anomaly.Updater, err = s.ComposePrincipalByID(ctx, anomaly.UpdaterID)
if err != nil {
return err
}
@@ -490,7 +490,7 @@ func (s *Server) ComposeInstanceRelationship(ctx context.Context, instance *api.
func (s *Server) ComposeInstanceAdminDataSource(ctx context.Context, instance *api.Instance) error {
dataSourceFind := &api.DataSourceFind{
- InstanceId: &instance.ID,
+ InstanceID: &instance.ID,
}
dataSourceList, err := s.DataSourceService.FindDataSourceList(ctx, dataSourceFind)
if err != nil {
@@ -506,9 +506,9 @@ func (s *Server) ComposeInstanceAdminDataSource(ctx context.Context, instance *a
return nil
}
-func (s *Server) FindInstanceAdminPasswordById(ctx context.Context, instanceId int) (string, error) {
+func (s *Server) FindInstanceAdminPasswordByID(ctx context.Context, instanceID int) (string, error) {
dataSourceFind := &api.DataSourceFind{
- InstanceId: &instanceId,
+ InstanceID: &instanceID,
}
dataSourceList, err := s.DataSourceService.FindDataSourceList(ctx, dataSourceFind)
if err != nil {
@@ -519,5 +519,5 @@ func (s *Server) FindInstanceAdminPasswordById(ctx context.Context, instanceId i
return dataSource.Password, nil
}
}
- return "", &common.Error{Code: common.NotFound, Err: fmt.Errorf("missing admin password for instance: %d", instanceId)}
+ return "", &common.Error{Code: common.NotFound, Err: fmt.Errorf("missing admin password for instance: %d", instanceID)}
}
diff --git a/server/issue.go b/server/issue.go
index 5558b43702..b227247704 100644
--- a/server/issue.go
+++ b/server/issue.go
@@ -27,7 +27,7 @@ func (s *Server) registerIssueRoutes(g *echo.Group) {
// since we are not creating pipeline/stage list/task list in a single transaction.
// We may still run into this issue when we actually create those pipeline/stage list/task list, however, that's
// quite unlikely so we will live with it for now.
- if issueCreate.AssigneeId == api.UNKNOWN_ID {
+ if issueCreate.AssigneeID == api.UNKNOWN_ID {
return echo.NewHTTPError(http.StatusBadRequest, "Failed to create issue, assignee missing")
}
@@ -41,7 +41,7 @@ func (s *Server) registerIssueRoutes(g *echo.Group) {
return echo.NewHTTPError(http.StatusBadRequest, "Failed to create issue, database name missing")
}
instanceFind := &api.InstanceFind{
- ID: &taskCreate.InstanceId,
+ ID: &taskCreate.InstanceID,
}
instance, err := s.InstanceService.FindInstance(ctx, instanceFind)
if err != nil {
@@ -93,26 +93,26 @@ func (s *Server) registerIssueRoutes(g *echo.Group) {
if taskCreate.DatabaseName == "" {
return echo.NewHTTPError(http.StatusBadRequest, "Failed to create issue, database name missing")
}
- if taskCreate.BackupId == nil {
+ if taskCreate.BackupID == nil {
return echo.NewHTTPError(http.StatusBadRequest, "Failed to create issue, backup missing")
}
}
}
}
- issue, err := s.CreateIssue(ctx, issueCreate, c.Get(GetPrincipalIdContextKey()).(int))
+ issue, err := s.CreateIssue(ctx, issueCreate, c.Get(GetPrincipalIDContextKey()).(int))
if err != nil {
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to create issue").SetInternal(err)
}
- for _, subscriberId := range issueCreate.SubscriberIdList {
+ for _, subscriberID := range issueCreate.SubscriberIDList {
subscriberCreate := &api.IssueSubscriberCreate{
- IssueId: issue.ID,
- SubscriberId: subscriberId,
+ IssueID: issue.ID,
+ SubscriberID: subscriberID,
}
_, err := s.IssueSubscriberService.CreateIssueSubscriber(ctx, subscriberCreate)
if err != nil {
- return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to add subscriber %d after creating issue %d", subscriberId, issue.ID)).SetInternal(err)
+ return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to add subscriber %d after creating issue %d", subscriberID, issue.ID)).SetInternal(err)
}
}
@@ -126,13 +126,13 @@ func (s *Server) registerIssueRoutes(g *echo.Group) {
g.GET("/issue", func(c echo.Context) error {
ctx := context.Background()
issueFind := &api.IssueFind{}
- projectIdStr := c.QueryParams().Get("project")
- if projectIdStr != "" {
- projectId, err := strconv.Atoi(projectIdStr)
+ projectIDStr := c.QueryParams().Get("project")
+ if projectIDStr != "" {
+ projectID, err := strconv.Atoi(projectIDStr)
if err != nil {
- return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("project query parameter is not a number: %s", projectIdStr)).SetInternal(err)
+ return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("project query parameter is not a number: %s", projectIDStr)).SetInternal(err)
}
- issueFind.ProjectId = &projectId
+ issueFind.ProjectID = &projectID
}
if issueStatusListStr := c.QueryParam("status"); issueStatusListStr != "" {
statusList := []api.IssueStatus{}
@@ -148,13 +148,13 @@ func (s *Server) registerIssueRoutes(g *echo.Group) {
}
issueFind.Limit = &limit
}
- userIdStr := c.QueryParams().Get("user")
- if userIdStr != "" {
- userId, err := strconv.Atoi(userIdStr)
+ userIDStr := c.QueryParams().Get("user")
+ if userIDStr != "" {
+ userID, err := strconv.Atoi(userIDStr)
if err != nil {
- return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("user query parameter is not a number: %s", userIdStr)).SetInternal(err)
+ return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("user query parameter is not a number: %s", userIDStr)).SetInternal(err)
}
- issueFind.PrincipalId = &userId
+ issueFind.PrincipalID = &userID
}
list, err := s.IssueService.FindIssueList(ctx, issueFind)
if err != nil {
@@ -174,14 +174,14 @@ func (s *Server) registerIssueRoutes(g *echo.Group) {
return nil
})
- g.GET("/issue/:issueId", func(c echo.Context) error {
+ g.GET("/issue/:issueID", func(c echo.Context) error {
ctx := context.Background()
- id, err := strconv.Atoi(c.Param("issueId"))
+ id, err := strconv.Atoi(c.Param("issueID"))
if err != nil {
- return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("issueId"))).SetInternal(err)
+ return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("issueID"))).SetInternal(err)
}
- issue, err := s.ComposeIssueById(ctx, id)
+ issue, err := s.ComposeIssueByID(ctx, id)
if err != nil {
if common.ErrorCode(err) == common.NotFound {
return echo.NewHTTPError(http.StatusNotFound, fmt.Sprintf("Issue ID not found: %d", id))
@@ -196,16 +196,16 @@ func (s *Server) registerIssueRoutes(g *echo.Group) {
return nil
})
- g.PATCH("/issue/:issueId", func(c echo.Context) error {
+ g.PATCH("/issue/:issueID", func(c echo.Context) error {
ctx := context.Background()
- id, err := strconv.Atoi(c.Param("issueId"))
+ id, err := strconv.Atoi(c.Param("issueID"))
if err != nil {
- return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("issueId"))).SetInternal(err)
+ return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("issueID"))).SetInternal(err)
}
issuePatch := &api.IssuePatch{
ID: id,
- UpdaterId: c.Get(GetPrincipalIdContextKey()).(int),
+ UpdaterID: c.Get(GetPrincipalIDContextKey()).(int),
}
if err := jsonapi.UnmarshalPayload(c.Request().Body, issuePatch); err != nil {
return echo.NewHTTPError(http.StatusBadRequest, "Malformatted update issue request").SetInternal(err)
@@ -230,7 +230,7 @@ func (s *Server) registerIssueRoutes(g *echo.Group) {
payloadList := [][]byte{}
if issuePatch.Name != nil && *issuePatch.Name != issue.Name {
payload, err := json.Marshal(api.ActivityIssueFieldUpdatePayload{
- FieldId: api.IssueFieldName,
+ FieldID: api.IssueFieldName,
OldValue: issue.Name,
NewValue: *issuePatch.Name,
IssueName: issue.Name,
@@ -242,7 +242,7 @@ func (s *Server) registerIssueRoutes(g *echo.Group) {
}
if issuePatch.Description != nil && *issuePatch.Description != issue.Description {
payload, err := json.Marshal(api.ActivityIssueFieldUpdatePayload{
- FieldId: api.IssueFieldDescription,
+ FieldID: api.IssueFieldDescription,
OldValue: issue.Description,
NewValue: *issuePatch.Description,
IssueName: issue.Name,
@@ -252,11 +252,11 @@ func (s *Server) registerIssueRoutes(g *echo.Group) {
}
payloadList = append(payloadList, payload)
}
- if issuePatch.AssigneeId != nil && *issuePatch.AssigneeId != issue.AssigneeId {
+ if issuePatch.AssigneeID != nil && *issuePatch.AssigneeID != issue.AssigneeID {
payload, err := json.Marshal(api.ActivityIssueFieldUpdatePayload{
- FieldId: api.IssueFieldAssignee,
- OldValue: strconv.Itoa(issue.AssigneeId),
- NewValue: strconv.Itoa(*issuePatch.AssigneeId),
+ FieldID: api.IssueFieldAssignee,
+ OldValue: strconv.Itoa(issue.AssigneeID),
+ NewValue: strconv.Itoa(*issuePatch.AssigneeID),
IssueName: issue.Name,
})
if err != nil {
@@ -267,8 +267,8 @@ func (s *Server) registerIssueRoutes(g *echo.Group) {
for _, payload := range payloadList {
activityCreate := &api.ActivityCreate{
- CreatorId: c.Get(GetPrincipalIdContextKey()).(int),
- ContainerId: issue.ID,
+ CreatorID: c.Get(GetPrincipalIDContextKey()).(int),
+ ContainerID: issue.ID,
Type: api.ActivityIssueFieldUpdate,
Level: api.ACTIVITY_INFO,
Payload: string(payload),
@@ -292,22 +292,22 @@ func (s *Server) registerIssueRoutes(g *echo.Group) {
return nil
})
- g.PATCH("/issue/:issueId/status", func(c echo.Context) error {
+ g.PATCH("/issue/:issueID/status", func(c echo.Context) error {
ctx := context.Background()
- id, err := strconv.Atoi(c.Param("issueId"))
+ id, err := strconv.Atoi(c.Param("issueID"))
if err != nil {
- return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("issueId"))).SetInternal(err)
+ return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("issueID"))).SetInternal(err)
}
issueStatusPatch := &api.IssueStatusPatch{
ID: id,
- UpdaterId: c.Get(GetPrincipalIdContextKey()).(int),
+ UpdaterID: c.Get(GetPrincipalIDContextKey()).(int),
}
if err := jsonapi.UnmarshalPayload(c.Request().Body, issueStatusPatch); err != nil {
return echo.NewHTTPError(http.StatusBadRequest, "Malformatted update issue status request").SetInternal(err)
}
- issue, err := s.ComposeIssueById(ctx, id)
+ issue, err := s.ComposeIssueByID(ctx, id)
if err != nil {
if common.ErrorCode(err) == common.NotFound {
return echo.NewHTTPError(http.StatusNotFound, fmt.Sprintf("Issue ID not found: %d", id))
@@ -315,7 +315,7 @@ func (s *Server) registerIssueRoutes(g *echo.Group) {
return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to fetch issue ID: %v", id)).SetInternal(err)
}
- updatedIssue, err := s.ChangeIssueStatus(ctx, issue, issueStatusPatch.Status, issueStatusPatch.UpdaterId, issueStatusPatch.Comment)
+ updatedIssue, err := s.ChangeIssueStatus(ctx, issue, issueStatusPatch.Status, issueStatusPatch.UpdaterID, issueStatusPatch.Comment)
if err != nil {
if common.ErrorCode(err) == common.NotFound {
return echo.NewHTTPError(http.StatusNotFound).SetInternal(err)
@@ -337,7 +337,7 @@ func (s *Server) registerIssueRoutes(g *echo.Group) {
})
}
-func (s *Server) ComposeIssueById(ctx context.Context, id int) (*api.Issue, error) {
+func (s *Server) ComposeIssueByID(ctx context.Context, id int) (*api.Issue, error) {
issueFind := &api.IssueFind{
ID: &id,
}
@@ -356,40 +356,40 @@ func (s *Server) ComposeIssueById(ctx context.Context, id int) (*api.Issue, erro
func (s *Server) ComposeIssueRelationship(ctx context.Context, issue *api.Issue) error {
var err error
- issue.Creator, err = s.ComposePrincipalById(ctx, issue.CreatorId)
+ issue.Creator, err = s.ComposePrincipalByID(ctx, issue.CreatorID)
if err != nil {
return err
}
- issue.Updater, err = s.ComposePrincipalById(ctx, issue.UpdaterId)
+ issue.Updater, err = s.ComposePrincipalByID(ctx, issue.UpdaterID)
if err != nil {
return err
}
- issue.Assignee, err = s.ComposePrincipalById(ctx, issue.AssigneeId)
+ issue.Assignee, err = s.ComposePrincipalByID(ctx, issue.AssigneeID)
if err != nil {
return err
}
issueSubscriberFind := &api.IssueSubscriberFind{
- IssueId: &issue.ID,
+ IssueID: &issue.ID,
}
list, 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)
}
- issue.SubscriberIdList = []int{}
+ issue.SubscriberIDList = []int{}
for _, subscriber := range list {
- issue.SubscriberIdList = append(issue.SubscriberIdList, subscriber.SubscriberId)
+ issue.SubscriberIDList = append(issue.SubscriberIDList, subscriber.SubscriberID)
}
- issue.Project, err = s.ComposeProjectlById(ctx, issue.ProjectId)
+ issue.Project, err = s.ComposeProjectlByID(ctx, issue.ProjectID)
if err != nil {
return err
}
- issue.Pipeline, err = s.ComposePipelineById(ctx, issue.PipelineId)
+ issue.Pipeline, err = s.ComposePipelineByID(ctx, issue.PipelineID)
if err != nil {
return err
}
@@ -397,27 +397,27 @@ func (s *Server) ComposeIssueRelationship(ctx context.Context, issue *api.Issue)
return nil
}
-func (s *Server) CreateIssue(ctx context.Context, issueCreate *api.IssueCreate, creatorId int) (*api.Issue, error) {
- issueCreate.Pipeline.CreatorId = creatorId
+func (s *Server) CreateIssue(ctx context.Context, issueCreate *api.IssueCreate, creatorID int) (*api.Issue, error) {
+ issueCreate.Pipeline.CreatorID = creatorID
createdPipeline, err := s.PipelineService.CreatePipeline(ctx, &issueCreate.Pipeline)
if err != nil {
return nil, fmt.Errorf("failed to create pipeline for issue. Error %w", err)
}
for _, stageCreate := range issueCreate.Pipeline.StageList {
- stageCreate.CreatorId = creatorId
- stageCreate.PipelineId = createdPipeline.ID
+ stageCreate.CreatorID = creatorID
+ stageCreate.PipelineID = createdPipeline.ID
createdStage, err := s.StageService.CreateStage(ctx, &stageCreate)
if err != nil {
return nil, fmt.Errorf("failed to create stage for issue. Error %w", err)
}
for _, taskCreate := range stageCreate.TaskList {
- taskCreate.CreatorId = creatorId
- taskCreate.PipelineId = createdPipeline.ID
- taskCreate.StageId = createdStage.ID
+ taskCreate.CreatorID = creatorID
+ taskCreate.PipelineID = createdPipeline.ID
+ taskCreate.StageID = createdStage.ID
instanceFind := &api.InstanceFind{
- ID: &taskCreate.InstanceId,
+ ID: &taskCreate.InstanceID,
}
instance, err := s.InstanceService.FindInstance(ctx, instanceFind)
if err != nil {
@@ -429,7 +429,7 @@ func (s *Server) CreateIssue(ctx context.Context, issueCreate *api.IssueCreate,
taskCreate.DatabaseName = strings.ToUpper(taskCreate.DatabaseName)
}
payload := api.TaskDatabaseCreatePayload{}
- payload.ProjectId = issueCreate.ProjectId
+ payload.ProjectID = issueCreate.ProjectID
payload.DatabaseName = taskCreate.DatabaseName
payload.CharacterSet = taskCreate.CharacterSet
payload.Collation = taskCreate.Collation
@@ -475,7 +475,7 @@ func (s *Server) CreateIssue(ctx context.Context, issueCreate *api.IssueCreate,
}
payload := api.TaskDatabaseRestorePayload{}
payload.DatabaseName = taskCreate.DatabaseName
- payload.BackupId = *taskCreate.BackupId
+ payload.BackupID = *taskCreate.BackupID
bytes, err := json.Marshal(payload)
if err != nil {
return nil, fmt.Errorf("failed to create restore database task, unable to marshal payload %w", err)
@@ -488,8 +488,8 @@ func (s *Server) CreateIssue(ctx context.Context, issueCreate *api.IssueCreate,
}
}
- issueCreate.CreatorId = creatorId
- issueCreate.PipelineId = createdPipeline.ID
+ issueCreate.CreatorID = creatorID
+ issueCreate.PipelineID = createdPipeline.ID
issue, err := s.IssueService.CreateIssue(ctx, issueCreate)
if err != nil {
return nil, fmt.Errorf("failed to create issue. Error %w", err)
@@ -498,8 +498,8 @@ func (s *Server) CreateIssue(ctx context.Context, issueCreate *api.IssueCreate,
createActivityPayload := api.ActivityIssueCreatePayload{
IssueName: issue.Name,
}
- if issueCreate.RollbackIssueId != nil {
- createActivityPayload.RollbackIssueId = *issueCreate.RollbackIssueId
+ if issueCreate.RollbackIssueID != nil {
+ createActivityPayload.RollbackIssueID = *issueCreate.RollbackIssueID
}
bytes, err := json.Marshal(createActivityPayload)
@@ -507,8 +507,8 @@ func (s *Server) CreateIssue(ctx context.Context, issueCreate *api.IssueCreate,
return nil, fmt.Errorf("failed to create activity after creating the issue: %v. Error %w", issue.Name, err)
}
activityCreate := &api.ActivityCreate{
- CreatorId: creatorId,
- ContainerId: issue.ID,
+ CreatorID: creatorID,
+ ContainerID: issue.ID,
Type: api.ActivityIssueCreate,
Level: api.ACTIVITY_INFO,
Payload: string(bytes),
@@ -521,9 +521,9 @@ func (s *Server) CreateIssue(ctx context.Context, issueCreate *api.IssueCreate,
}
// If we are creating a rollback issue, then we will also post a comment on the original issue
- if issueCreate.RollbackIssueId != nil {
+ if issueCreate.RollbackIssueID != nil {
issueFind := &api.IssueFind{
- ID: issueCreate.RollbackIssueId,
+ ID: issueCreate.RollbackIssueID,
}
rollbackIssue, err := s.IssueService.FindIssue(ctx, issueFind)
if err != nil {
@@ -536,8 +536,8 @@ func (s *Server) CreateIssue(ctx context.Context, issueCreate *api.IssueCreate,
return nil, fmt.Errorf("failed to create activity after creating the rollback issue: %v. Error %w", issue.Name, err)
}
activityCreate := &api.ActivityCreate{
- CreatorId: creatorId,
- ContainerId: *issueCreate.RollbackIssueId,
+ CreatorID: creatorID,
+ ContainerID: *issueCreate.RollbackIssueID,
Type: api.ActivityIssueCommentCreate,
Level: api.ACTIVITY_INFO,
Comment: fmt.Sprintf("Created rollback issue %q", issue.Name),
@@ -562,7 +562,7 @@ func (s *Server) CreateIssue(ctx context.Context, issueCreate *api.IssueCreate,
return issue, nil
}
-func (s *Server) ChangeIssueStatus(ctx context.Context, issue *api.Issue, newStatus api.IssueStatus, updaterId int, comment string) (*api.Issue, error) {
+func (s *Server) ChangeIssueStatus(ctx context.Context, issue *api.Issue, newStatus api.IssueStatus, updaterID int, comment string) (*api.Issue, error) {
var pipelineStatus api.PipelineStatus
switch newStatus {
case api.Issue_Open:
@@ -584,7 +584,7 @@ func (s *Server) ChangeIssueStatus(ctx context.Context, issue *api.Issue, newSta
for _, stage := range issue.Pipeline.StageList {
for _, task := range stage.TaskList {
if task.Status == api.TaskRunning {
- if _, err := s.ChangeTaskStatus(ctx, task, api.TaskCanceled, updaterId); err != nil {
+ if _, err := s.ChangeTaskStatus(ctx, task, api.TaskCanceled, updaterID); err != nil {
return nil, fmt.Errorf("failed to cancel issue: %v, failed to cancel task: %v, error: %w", issue.Name, task.Name, err)
}
}
@@ -594,8 +594,8 @@ func (s *Server) ChangeIssueStatus(ctx context.Context, issue *api.Issue, newSta
}
pipelinePatch := &api.PipelinePatch{
- ID: issue.PipelineId,
- UpdaterId: updaterId,
+ ID: issue.PipelineID,
+ UpdaterID: updaterID,
Status: &pipelineStatus,
}
if _, err := s.PipelineService.PatchPipeline(ctx, pipelinePatch); err != nil {
@@ -604,7 +604,7 @@ func (s *Server) ChangeIssueStatus(ctx context.Context, issue *api.Issue, newSta
issuePatch := &api.IssuePatch{
ID: issue.ID,
- UpdaterId: updaterId,
+ UpdaterID: updaterID,
Status: &newStatus,
}
updatedIssue, err := s.IssueService.PatchIssue(ctx, issuePatch)
@@ -625,8 +625,8 @@ func (s *Server) ChangeIssueStatus(ctx context.Context, issue *api.Issue, newSta
}
activityCreate := &api.ActivityCreate{
- CreatorId: updaterId,
- ContainerId: issue.ID,
+ CreatorID: updaterID,
+ ContainerID: issue.ID,
Type: api.ActivityIssueStatusUpdate,
Level: api.ACTIVITY_INFO,
Comment: comment,
@@ -644,37 +644,37 @@ func (s *Server) ChangeIssueStatus(ctx context.Context, issue *api.Issue, newSta
}
func (s *Server) PostInboxIssueActivity(ctx context.Context, issue *api.Issue, activity_id int) error {
- if issue.CreatorId != api.SYSTEM_BOT_ID {
+ if issue.CreatorID != api.SYSTEM_BOT_ID {
inboxCreate := &api.InboxCreate{
- ReceiverId: issue.CreatorId,
- ActivityId: activity_id,
+ ReceiverID: issue.CreatorID,
+ ActivityID: activity_id,
}
_, err := s.InboxService.CreateInbox(ctx, inboxCreate)
if err != nil {
- return fmt.Errorf("failed to post activity to creator inbox: %d, error: %w", issue.CreatorId, err)
+ return fmt.Errorf("failed to post activity to creator inbox: %d, error: %w", issue.CreatorID, err)
}
}
- if issue.AssigneeId != api.SYSTEM_BOT_ID && issue.AssigneeId != issue.CreatorId {
+ if issue.AssigneeID != api.SYSTEM_BOT_ID && issue.AssigneeID != issue.CreatorID {
inboxCreate := &api.InboxCreate{
- ReceiverId: issue.AssigneeId,
- ActivityId: activity_id,
+ ReceiverID: issue.AssigneeID,
+ ActivityID: activity_id,
}
_, err := s.InboxService.CreateInbox(ctx, inboxCreate)
if err != nil {
- return fmt.Errorf("failed to post activity to assignee inbox: %d, error: %w", issue.AssigneeId, err)
+ return fmt.Errorf("failed to post activity to assignee inbox: %d, error: %w", issue.AssigneeID, err)
}
}
- for _, subscriberId := range issue.SubscriberIdList {
- if subscriberId != api.SYSTEM_BOT_ID && subscriberId != issue.CreatorId && subscriberId != issue.AssigneeId {
+ for _, subscriberID := range issue.SubscriberIDList {
+ if subscriberID != api.SYSTEM_BOT_ID && subscriberID != issue.CreatorID && subscriberID != issue.AssigneeID {
inboxCreate := &api.InboxCreate{
- ReceiverId: subscriberId,
- ActivityId: activity_id,
+ ReceiverID: subscriberID,
+ ActivityID: activity_id,
}
_, err := s.InboxService.CreateInbox(ctx, inboxCreate)
if err != nil {
- return fmt.Errorf("failed to post activity to subscriber inbox: %d, error: %w", subscriberId, err)
+ return fmt.Errorf("failed to post activity to subscriber inbox: %d, error: %w", subscriberID, err)
}
}
}
diff --git a/server/issue_subscriber.go b/server/issue_subscriber.go
index 0c8e7e502e..bc75c424c5 100644
--- a/server/issue_subscriber.go
+++ b/server/issue_subscriber.go
@@ -13,11 +13,11 @@ import (
)
func (s *Server) registerIssueSubscriberRoutes(g *echo.Group) {
- g.POST("/issue/:issueId/subscriber", func(c echo.Context) error {
+ g.POST("/issue/:issueID/subscriber", func(c echo.Context) error {
ctx := context.Background()
- issueId, err := strconv.Atoi(c.Param("issueId"))
+ issueID, err := strconv.Atoi(c.Param("issueID"))
if err != nil {
- return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("issueId"))).SetInternal(err)
+ return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("issueID"))).SetInternal(err)
}
issueSubscriberCreate := &api.IssueSubscriberCreate{}
@@ -25,18 +25,18 @@ func (s *Server) registerIssueSubscriberRoutes(g *echo.Group) {
return echo.NewHTTPError(http.StatusBadRequest, "Malformatted create issueSubscriber request").SetInternal(err)
}
- issueSubscriberCreate.IssueId = issueId
+ issueSubscriberCreate.IssueID = issueID
issueSubscriber, err := s.IssueSubscriberService.CreateIssueSubscriber(ctx, issueSubscriberCreate)
if err != nil {
if common.ErrorCode(err) == common.Conflict {
- return echo.NewHTTPError(http.StatusConflict, fmt.Sprintf("Subscriber %d already exists in issue %d", issueSubscriberCreate.SubscriberId, issueSubscriberCreate.IssueId))
+ return echo.NewHTTPError(http.StatusConflict, fmt.Sprintf("Subscriber %d already exists in issue %d", issueSubscriberCreate.SubscriberID, issueSubscriberCreate.IssueID))
}
- return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to add subscriber %d to issue %d", issueSubscriberCreate.SubscriberId, issueSubscriberCreate.IssueId)).SetInternal(err)
+ return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to add subscriber %d to issue %d", issueSubscriberCreate.SubscriberID, issueSubscriberCreate.IssueID)).SetInternal(err)
}
if err := s.ComposeIssueSubscriberRelationship(ctx, issueSubscriber); err != nil {
- return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to fetch subscriber %d relationship for issue %d", issueSubscriberCreate.SubscriberId, issueSubscriberCreate.IssueId)).SetInternal(err)
+ return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to fetch subscriber %d relationship for issue %d", issueSubscriberCreate.SubscriberID, issueSubscriberCreate.IssueID)).SetInternal(err)
}
c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSONCharsetUTF8)
@@ -46,24 +46,24 @@ func (s *Server) registerIssueSubscriberRoutes(g *echo.Group) {
return nil
})
- g.GET("/issue/:issueId/subscriber", func(c echo.Context) error {
+ g.GET("/issue/:issueID/subscriber", func(c echo.Context) error {
ctx := context.Background()
- issueId, err := strconv.Atoi(c.Param("issueId"))
+ issueID, err := strconv.Atoi(c.Param("issueID"))
if err != nil {
- return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("issueId"))).SetInternal(err)
+ return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("issueID"))).SetInternal(err)
}
issueSubscriberFind := &api.IssueSubscriberFind{
- IssueId: &issueId,
+ IssueID: &issueID,
}
list, 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)
+ return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to fetch subscriber list for issue %d", issueID)).SetInternal(err)
}
for _, issueSubscriber := range list {
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)
+ return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to fetch subscriber %d relationship for issue %d", issueSubscriber.SubscriberID, issueSubscriber.IssueID)).SetInternal(err)
}
}
@@ -74,28 +74,28 @@ func (s *Server) registerIssueSubscriberRoutes(g *echo.Group) {
return nil
})
- g.DELETE("/issue/:issueId/subscriber/:subscriberId", func(c echo.Context) error {
+ g.DELETE("/issue/:issueID/subscriber/:subscriberID", func(c echo.Context) error {
ctx := context.Background()
- issueId, err := strconv.Atoi(c.Param("issueId"))
+ issueID, err := strconv.Atoi(c.Param("issueID"))
if err != nil {
- return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Issue ID is not a number: %s", c.Param("issueId"))).SetInternal(err)
+ return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Issue ID is not a number: %s", c.Param("issueID"))).SetInternal(err)
}
- subscriberId, err := strconv.Atoi(c.Param("subscriberId"))
+ subscriberID, err := strconv.Atoi(c.Param("subscriberID"))
if err != nil {
- return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Subscriber ID is not a number: %s", c.Param("subscriberId"))).SetInternal(err)
+ return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Subscriber ID is not a number: %s", c.Param("subscriberID"))).SetInternal(err)
}
issueSubscriberDelete := &api.IssueSubscriberDelete{
- IssueId: issueId,
- SubscriberId: subscriberId,
+ IssueID: issueID,
+ SubscriberID: subscriberID,
}
err = s.IssueSubscriberService.DeleteIssueSubscriber(ctx, issueSubscriberDelete)
if err != nil {
if common.ErrorCode(err) == common.NotFound {
- return echo.NewHTTPError(http.StatusNotFound, fmt.Sprintf("Subscriber %d not found in issue %d", subscriberId, issueId))
+ return echo.NewHTTPError(http.StatusNotFound, fmt.Sprintf("Subscriber %d not found in issue %d", subscriberID, issueID))
}
- return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to delete subscriber %d from issue %d", subscriberId, issueId)).SetInternal(err)
+ return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to delete subscriber %d from issue %d", subscriberID, issueID)).SetInternal(err)
}
c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSONCharsetUTF8)
@@ -107,7 +107,7 @@ func (s *Server) registerIssueSubscriberRoutes(g *echo.Group) {
func (s *Server) ComposeIssueSubscriberRelationship(ctx context.Context, issueSubscriber *api.IssueSubscriber) error {
var err error
- issueSubscriber.Subscriber, err = s.ComposePrincipalById(ctx, issueSubscriber.SubscriberId)
+ issueSubscriber.Subscriber, err = s.ComposePrincipalByID(ctx, issueSubscriber.SubscriberID)
if err != nil {
return err
}
diff --git a/server/jwt.go b/server/jwt.go
index 0d7f82a895..f6ebd2db65 100644
--- a/server/jwt.go
+++ b/server/jwt.go
@@ -27,7 +27,7 @@ const (
// Signing key section. For now, this is only used for signing, not for verifying since we only
// have 1 version. But it will be used to maintain backward compatibility if we change the signing mechanism.
- keyId = "v1"
+ keyID = "v1"
// Expiration section
refreshThresholdDuration = 1 * time.Hour
@@ -43,7 +43,7 @@ const (
// Context section
// The key name used to store principal id in the context
// principal id is extracted from the jwt token subject field.
- principalIdContextKey = "principal-id"
+ principalIDContextKey = "principal-id"
)
// Create a struct that will be encoded to a JWT.
@@ -53,8 +53,8 @@ type Claims struct {
jwt.StandardClaims
}
-func GetPrincipalIdContextKey() string {
- return principalIdContextKey
+func GetPrincipalIDContextKey() string {
+ return principalIDContextKey
}
// GenerateTokensAndSetCookies generates jwt token and saves it to the http-only cookie.
@@ -105,7 +105,7 @@ func generateToken(user *api.Principal, aud string, expirationTime time.Time, se
// Declare the token with the HS256 algorithm used for signing, and the claims.
token := jwt.NewWithClaims(jwt.SigningMethodHS256, claims)
- token.Header["kid"] = keyId
+ token.Header["kid"] = keyID
// Create the JWT string.
tokenString, err := token.SignedString(secret)
@@ -214,21 +214,21 @@ func JWTMiddleware(l *zap.Logger, p api.PrincipalService, next echo.HandlerFunc,
// We either have a valid access token or we will attempt to generate new access token and refresh token
if err == nil {
ctx := context.Background()
- principalId, err := strconv.Atoi(claims.Subject)
+ principalID, err := strconv.Atoi(claims.Subject)
if err != nil {
return echo.NewHTTPError(http.StatusUnauthorized, "Malformatted ID in the token.")
}
// Even if there is no error, we still need to make sure the user still exists.
principalFind := &api.PrincipalFind{
- ID: &principalId,
+ ID: &principalID,
}
user, err := p.FindPrincipal(ctx, principalFind)
if err != nil {
if common.ErrorCode(err) == common.NotFound {
- return echo.NewHTTPError(http.StatusUnauthorized, fmt.Sprintf("Failed to find user ID: %d", principalId))
+ return echo.NewHTTPError(http.StatusUnauthorized, fmt.Sprintf("Failed to find user ID: %d", principalID))
}
- return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Server error to find user ID: %d", principalId)).SetInternal(err)
+ return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Server error to find user ID: %d", principalID)).SetInternal(err)
}
if generateToken {
@@ -257,7 +257,7 @@ func JWTMiddleware(l *zap.Logger, p api.PrincipalService, next echo.HandlerFunc,
if err == jwt.ErrSignatureInvalid {
return echo.NewHTTPError(http.StatusUnauthorized, "Failed to generate access token. Invalid refresh token signature.")
}
- return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Server error to refresh expired token. User Id %d", principalId)).SetInternal(err)
+ return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Server error to refresh expired token. User Id %d", principalID)).SetInternal(err)
}
if refreshTokenClaims.Audience != fmt.Sprintf(refreshTokenAudienceFmt, mode) {
@@ -271,7 +271,7 @@ func JWTMiddleware(l *zap.Logger, p api.PrincipalService, next echo.HandlerFunc,
// If we have a valid refresh token, we will generate new access token and refresh token
if refreshToken != nil && refreshToken.Valid {
if err := GenerateTokensAndSetCookies(c, user, mode, secret); err != nil {
- return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Server error to refresh expired token. User Id %d", principalId)).SetInternal(err)
+ return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Server error to refresh expired token. User Id %d", principalID)).SetInternal(err)
}
}
@@ -285,8 +285,8 @@ func JWTMiddleware(l *zap.Logger, p api.PrincipalService, next echo.HandlerFunc,
}
}
- // Stores principalId into context.
- c.Set(GetPrincipalIdContextKey(), principalId)
+ // Stores principalID into context.
+ c.Set(GetPrincipalIDContextKey(), principalID)
return next(c)
}
diff --git a/server/member.go b/server/member.go
index 57a46d3f67..390179b9ed 100644
--- a/server/member.go
+++ b/server/member.go
@@ -21,12 +21,12 @@ func (s *Server) registerMemberRoutes(g *echo.Group) {
return echo.NewHTTPError(http.StatusBadRequest, "Malformatted create member request").SetInternal(err)
}
- memberCreate.CreatorId = c.Get(GetPrincipalIdContextKey()).(int)
+ memberCreate.CreatorID = c.Get(GetPrincipalIDContextKey()).(int)
member, err := s.MemberService.CreateMember(ctx, memberCreate)
if err != nil {
if common.ErrorCode(err) == common.Conflict {
- return echo.NewHTTPError(http.StatusConflict, fmt.Sprintf("Member for user ID already exists: %d", memberCreate.PrincipalId))
+ return echo.NewHTTPError(http.StatusConflict, fmt.Sprintf("Member for user ID already exists: %d", memberCreate.PrincipalID))
}
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to create member").SetInternal(err)
}
@@ -34,18 +34,18 @@ func (s *Server) registerMemberRoutes(g *echo.Group) {
// Record activity
{
principalFind := &api.PrincipalFind{
- ID: &member.PrincipalId,
+ ID: &member.PrincipalID,
}
user, err := s.PrincipalService.FindPrincipal(ctx, principalFind)
if err != nil {
if common.ErrorCode(err) == common.NotFound {
- return echo.NewHTTPError(http.StatusUnauthorized, fmt.Sprintf("Failed to find user ID: %d", member.PrincipalId))
+ return echo.NewHTTPError(http.StatusUnauthorized, fmt.Sprintf("Failed to find user ID: %d", member.PrincipalID))
}
- return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Server error to find user ID: %d", member.PrincipalId)).SetInternal(err)
+ return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Server error to find user ID: %d", member.PrincipalID)).SetInternal(err)
}
bytes, err := json.Marshal(api.ActivityMemberCreatePayload{
- PrincipalId: member.PrincipalId,
+ PrincipalID: member.PrincipalID,
PrincipalName: user.Name,
PrincipalEmail: user.Email,
MemberStatus: member.Status,
@@ -55,8 +55,8 @@ func (s *Server) registerMemberRoutes(g *echo.Group) {
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to construct activity payload").SetInternal(err)
}
activityCreate := &api.ActivityCreate{
- CreatorId: c.Get(GetPrincipalIdContextKey()).(int),
- ContainerId: member.ID,
+ CreatorID: c.Get(GetPrincipalIDContextKey()).(int),
+ ContainerID: member.ID,
Type: api.ActivityMemberCreate,
Level: api.ACTIVITY_INFO,
Payload: string(bytes),
@@ -119,7 +119,7 @@ func (s *Server) registerMemberRoutes(g *echo.Group) {
memberPatch := &api.MemberPatch{
ID: id,
- UpdaterId: c.Get(GetPrincipalIdContextKey()).(int),
+ UpdaterID: c.Get(GetPrincipalIDContextKey()).(int),
}
if err := jsonapi.UnmarshalPayload(c.Request().Body, memberPatch); err != nil {
return echo.NewHTTPError(http.StatusBadRequest, "Malformatted patch member request").SetInternal(err)
@@ -136,19 +136,19 @@ func (s *Server) registerMemberRoutes(g *echo.Group) {
// Record activity
{
principalFind := &api.PrincipalFind{
- ID: &updatedMember.PrincipalId,
+ ID: &updatedMember.PrincipalID,
}
user, err := s.PrincipalService.FindPrincipal(ctx, principalFind)
if err != nil {
if common.ErrorCode(err) == common.NotFound {
- return echo.NewHTTPError(http.StatusUnauthorized, fmt.Sprintf("Failed to find user ID: %d", updatedMember.PrincipalId))
+ return echo.NewHTTPError(http.StatusUnauthorized, fmt.Sprintf("Failed to find user ID: %d", updatedMember.PrincipalID))
}
- return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Server error to find user ID: %d", updatedMember.PrincipalId)).SetInternal(err)
+ return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Server error to find user ID: %d", updatedMember.PrincipalID)).SetInternal(err)
}
if memberPatch.Role != nil {
bytes, err := json.Marshal(api.ActivityMemberRoleUpdatePayload{
- PrincipalId: updatedMember.PrincipalId,
+ PrincipalID: updatedMember.PrincipalID,
PrincipalName: user.Name,
PrincipalEmail: user.Email,
OldRole: member.Role,
@@ -158,8 +158,8 @@ func (s *Server) registerMemberRoutes(g *echo.Group) {
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to construct activity payload").SetInternal(err)
}
activityCreate := &api.ActivityCreate{
- CreatorId: c.Get(GetPrincipalIdContextKey()).(int),
- ContainerId: updatedMember.ID,
+ CreatorID: c.Get(GetPrincipalIDContextKey()).(int),
+ ContainerID: updatedMember.ID,
Type: api.ActivityMemberRoleUpdate,
Level: api.ACTIVITY_INFO,
Payload: string(bytes),
@@ -170,7 +170,7 @@ func (s *Server) registerMemberRoutes(g *echo.Group) {
}
} else if memberPatch.RowStatus != nil {
bytes, err := json.Marshal(api.ActivityMemberActivateDeactivatePayload{
- PrincipalId: updatedMember.PrincipalId,
+ PrincipalID: updatedMember.PrincipalID,
PrincipalName: user.Name,
PrincipalEmail: user.Email,
Role: member.Role,
@@ -183,8 +183,8 @@ func (s *Server) registerMemberRoutes(g *echo.Group) {
theType = api.ActivityMemberDeactivate
}
activityCreate := &api.ActivityCreate{
- CreatorId: c.Get(GetPrincipalIdContextKey()).(int),
- ContainerId: updatedMember.ID,
+ CreatorID: c.Get(GetPrincipalIDContextKey()).(int),
+ ContainerID: updatedMember.ID,
Type: theType,
Level: api.ACTIVITY_INFO,
Payload: string(bytes),
@@ -211,17 +211,17 @@ func (s *Server) registerMemberRoutes(g *echo.Group) {
func (s *Server) ComposeMemberRelationship(ctx context.Context, member *api.Member) error {
var err error
- member.Creator, err = s.ComposePrincipalById(ctx, member.CreatorId)
+ member.Creator, err = s.ComposePrincipalByID(ctx, member.CreatorID)
if err != nil {
return err
}
- member.Updater, err = s.ComposePrincipalById(ctx, member.UpdaterId)
+ member.Updater, err = s.ComposePrincipalByID(ctx, member.UpdaterID)
if err != nil {
return err
}
- member.Principal, err = s.ComposePrincipalById(ctx, member.PrincipalId)
+ member.Principal, err = s.ComposePrincipalByID(ctx, member.PrincipalID)
if err != nil {
return err
}
diff --git a/server/pipeline.go b/server/pipeline.go
index 63f5b3c998..d5e92b34ec 100644
--- a/server/pipeline.go
+++ b/server/pipeline.go
@@ -6,7 +6,7 @@ import (
"github.com/bytebase/bytebase/api"
)
-func (s *Server) ComposePipelineById(ctx context.Context, id int) (*api.Pipeline, error) {
+func (s *Server) ComposePipelineByID(ctx context.Context, id int) (*api.Pipeline, error) {
pipelineFind := &api.PipelineFind{
ID: &id,
}
@@ -25,17 +25,17 @@ func (s *Server) ComposePipelineById(ctx context.Context, id int) (*api.Pipeline
func (s *Server) ComposePipelineRelationship(ctx context.Context, pipeline *api.Pipeline) error {
var err error
- pipeline.Creator, err = s.ComposePrincipalById(ctx, pipeline.CreatorId)
+ pipeline.Creator, err = s.ComposePrincipalByID(ctx, pipeline.CreatorID)
if err != nil {
return err
}
- pipeline.Updater, err = s.ComposePrincipalById(ctx, pipeline.UpdaterId)
+ pipeline.Updater, err = s.ComposePrincipalByID(ctx, pipeline.UpdaterID)
if err != nil {
return err
}
- pipeline.StageList, err = s.ComposeStageListByPipelineId(ctx, pipeline.ID)
+ pipeline.StageList, err = s.ComposeStageListByPipelineID(ctx, pipeline.ID)
if err != nil {
return err
}
diff --git a/server/policy.go b/server/policy.go
index 2e1794bd1e..ddf1a41dd5 100644
--- a/server/policy.go
+++ b/server/policy.go
@@ -12,9 +12,9 @@ import (
)
func (s *Server) registerPolicyRoutes(g *echo.Group) {
- g.PATCH("/policy/environment/:environmentId", func(c echo.Context) error {
+ g.PATCH("/policy/environment/:environmentID", func(c echo.Context) error {
ctx := context.Background()
- environmentID, err := strconv.Atoi(c.Param("environmentId"))
+ environmentID, err := strconv.Atoi(c.Param("environmentID"))
if err != nil {
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("environmentID is not a number: %s", c.Param("id"))).SetInternal(err)
}
@@ -27,9 +27,9 @@ func (s *Server) registerPolicyRoutes(g *echo.Group) {
if err := api.ValidatePolicy(pType, ""); err != nil {
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid policy type: %q", pType)).SetInternal(err)
}
- policyUpsert.EnvironmentId = environmentID
+ policyUpsert.EnvironmentID = environmentID
policyUpsert.Type = pType
- policyUpsert.UpdaterId = c.Get(GetPrincipalIdContextKey()).(int)
+ policyUpsert.UpdaterID = c.Get(GetPrincipalIDContextKey()).(int)
policy, err := s.PolicyService.UpsertPolicy(ctx, policyUpsert)
if err != nil {
@@ -47,9 +47,9 @@ func (s *Server) registerPolicyRoutes(g *echo.Group) {
return nil
})
- g.GET("/policy/environment/:environmentId", func(c echo.Context) error {
+ g.GET("/policy/environment/:environmentID", func(c echo.Context) error {
ctx := context.Background()
- environmentID, err := strconv.Atoi(c.Param("environmentId"))
+ environmentID, err := strconv.Atoi(c.Param("environmentID"))
if err != nil {
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("environmentID is not a number: %s", c.Param("id"))).SetInternal(err)
}
@@ -59,7 +59,7 @@ func (s *Server) registerPolicyRoutes(g *echo.Group) {
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid policy type: %q", pType)).SetInternal(err)
}
policyFind.Type = &pType
- policyFind.EnvironmentId = &environmentID
+ policyFind.EnvironmentID = &environmentID
policy, err := s.PolicyService.FindPolicy(ctx, policyFind)
if err != nil {
@@ -81,17 +81,17 @@ func (s *Server) registerPolicyRoutes(g *echo.Group) {
func (s *Server) ComposePolicyRelationship(ctx context.Context, policy *api.Policy) error {
var err error
- policy.Creator, err = s.ComposePrincipalById(ctx, policy.CreatorId)
+ policy.Creator, err = s.ComposePrincipalByID(ctx, policy.CreatorID)
if err != nil {
return err
}
- policy.Updater, err = s.ComposePrincipalById(ctx, policy.UpdaterId)
+ policy.Updater, err = s.ComposePrincipalByID(ctx, policy.UpdaterID)
if err != nil {
return err
}
- policy.Environment, err = s.ComposeEnvironmentById(ctx, policy.EnvironmentId)
+ policy.Environment, err = s.ComposeEnvironmentByID(ctx, policy.EnvironmentID)
if err != nil {
return err
}
diff --git a/server/principal.go b/server/principal.go
index a778751269..a94dc2ade9 100644
--- a/server/principal.go
+++ b/server/principal.go
@@ -22,7 +22,7 @@ func (s *Server) registerPrincipalRoutes(g *echo.Group) {
return echo.NewHTTPError(http.StatusBadRequest, "Malformatted create principal request").SetInternal(err)
}
- principalCreate.CreatorId = c.Get(GetPrincipalIdContextKey()).(int)
+ principalCreate.CreatorID = c.Get(GetPrincipalIDContextKey()).(int)
principalCreate.Type = api.EndUser
passwordHash, err := bcrypt.GenerateFromPassword([]byte(principalCreate.Password), bcrypt.DefaultCost)
if err != nil {
@@ -78,14 +78,14 @@ func (s *Server) registerPrincipalRoutes(g *echo.Group) {
return nil
})
- g.GET("/principal/:principalId", func(c echo.Context) error {
+ g.GET("/principal/:principalID", func(c echo.Context) error {
ctx := context.Background()
- id, err := strconv.Atoi(c.Param("principalId"))
+ id, err := strconv.Atoi(c.Param("principalID"))
if err != nil {
- return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("principalId"))).SetInternal(err)
+ return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("principalID"))).SetInternal(err)
}
- principal, err := s.ComposePrincipalById(ctx, id)
+ principal, err := s.ComposePrincipalByID(ctx, id)
if err != nil {
if common.ErrorCode(err) == common.NotFound {
return echo.NewHTTPError(http.StatusNotFound, fmt.Sprintf("User ID not found: %d", id))
@@ -100,16 +100,16 @@ func (s *Server) registerPrincipalRoutes(g *echo.Group) {
return nil
})
- g.PATCH("/principal/:principalId", func(c echo.Context) error {
+ g.PATCH("/principal/:principalID", func(c echo.Context) error {
ctx := context.Background()
- id, err := strconv.Atoi(c.Param("principalId"))
+ id, err := strconv.Atoi(c.Param("principalID"))
if err != nil {
- return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("principalId"))).SetInternal(err)
+ return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("principalID"))).SetInternal(err)
}
principalPatch := &api.PrincipalPatch{
ID: id,
- UpdaterId: c.Get(GetPrincipalIdContextKey()).(int),
+ UpdaterID: c.Get(GetPrincipalIDContextKey()).(int),
}
if err := jsonapi.UnmarshalPayload(c.Request().Body, principalPatch); err != nil {
return echo.NewHTTPError(http.StatusBadRequest, "Malformatted patch principal request").SetInternal(err)
@@ -142,7 +142,7 @@ func (s *Server) registerPrincipalRoutes(g *echo.Group) {
})
}
-func (s *Server) ComposePrincipalById(ctx context.Context, id int) (*api.Principal, error) {
+func (s *Server) ComposePrincipalByID(ctx context.Context, id int) (*api.Principal, error) {
principalFind := &api.PrincipalFind{
ID: &id,
}
@@ -161,7 +161,7 @@ func (s *Server) ComposePrincipalRole(ctx context.Context, principal *api.Princi
principal.Role = api.Owner
} else {
memberFind := &api.MemberFind{
- PrincipalId: &principal.ID,
+ PrincipalID: &principal.ID,
}
member, err := s.MemberService.FindMember(ctx, memberFind)
if err != nil {
diff --git a/server/project.go b/server/project.go
index fc71d6937a..deda73d6b8 100644
--- a/server/project.go
+++ b/server/project.go
@@ -25,7 +25,7 @@ func (s *Server) registerProjectRoutes(g *echo.Group) {
if err := jsonapi.UnmarshalPayload(c.Request().Body, projectCreate); err != nil {
return echo.NewHTTPError(http.StatusBadRequest, "Malformatted create project request").SetInternal(err)
}
- projectCreate.CreatorId = c.Get(GetPrincipalIdContextKey()).(int)
+ projectCreate.CreatorID = c.Get(GetPrincipalIDContextKey()).(int)
project, err := s.ProjectService.CreateProject(ctx, projectCreate)
if err != nil {
if common.ErrorCode(err) == common.Conflict {
@@ -35,10 +35,10 @@ func (s *Server) registerProjectRoutes(g *echo.Group) {
}
projectMember := &api.ProjectMemberCreate{
- CreatorId: projectCreate.CreatorId,
- ProjectId: project.ID,
+ CreatorID: projectCreate.CreatorID,
+ ProjectID: project.ID,
Role: api.ProjectOwner,
- PrincipalId: projectCreate.CreatorId,
+ PrincipalID: projectCreate.CreatorID,
}
_, err = s.ProjectMemberService.CreateProjectMember(ctx, projectMember)
@@ -60,12 +60,12 @@ func (s *Server) registerProjectRoutes(g *echo.Group) {
g.GET("/project", func(c echo.Context) error {
ctx := context.Background()
projectFind := &api.ProjectFind{}
- if userIdStr := c.QueryParam("user"); userIdStr != "" {
- userId, err := strconv.Atoi(userIdStr)
+ if userIDStr := c.QueryParam("user"); userIDStr != "" {
+ userID, err := strconv.Atoi(userIDStr)
if err != nil {
- return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Query parameter user is not a number: %s", userIdStr)).SetInternal(err)
+ return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Query parameter user is not a number: %s", userIDStr)).SetInternal(err)
}
- projectFind.PrincipalId = &userId
+ projectFind.PrincipalID = &userID
}
if rowStatusStr := c.QueryParam("rowstatus"); rowStatusStr != "" {
rowStatus := api.RowStatus(rowStatusStr)
@@ -89,14 +89,14 @@ func (s *Server) registerProjectRoutes(g *echo.Group) {
return nil
})
- g.GET("/project/:projectId", func(c echo.Context) error {
+ g.GET("/project/:projectID", func(c echo.Context) error {
ctx := context.Background()
- id, err := strconv.Atoi(c.Param("projectId"))
+ id, err := strconv.Atoi(c.Param("projectID"))
if err != nil {
- return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("projectId"))).SetInternal(err)
+ return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("projectID"))).SetInternal(err)
}
- project, err := s.ComposeProjectlById(ctx, id)
+ project, err := s.ComposeProjectlByID(ctx, id)
if err != nil {
if common.ErrorCode(err) == common.NotFound {
return echo.NewHTTPError(http.StatusNotFound, fmt.Sprintf("Project ID not found: %d", id))
@@ -111,16 +111,16 @@ func (s *Server) registerProjectRoutes(g *echo.Group) {
return nil
})
- g.PATCH("/project/:projectId", func(c echo.Context) error {
+ g.PATCH("/project/:projectID", func(c echo.Context) error {
ctx := context.Background()
- id, err := strconv.Atoi(c.Param("projectId"))
+ id, err := strconv.Atoi(c.Param("projectID"))
if err != nil {
- return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("projectId"))).SetInternal(err)
+ return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("projectID"))).SetInternal(err)
}
projectPatch := &api.ProjectPatch{
ID: id,
- UpdaterId: c.Get(GetPrincipalIdContextKey()).(int),
+ UpdaterID: c.Get(GetPrincipalIDContextKey()).(int),
}
if err := jsonapi.UnmarshalPayload(c.Request().Body, projectPatch); err != nil {
return echo.NewHTTPError(http.StatusBadRequest, "Malformatted patch project request").SetInternal(err)
@@ -146,7 +146,7 @@ func (s *Server) registerProjectRoutes(g *echo.Group) {
})
// When we link the repository with the project, we will also change the project workflow type to VCS
- g.POST("/project/:projectId/repository", func(c echo.Context) error {
+ g.POST("/project/:projectID/repository", func(c echo.Context) error {
ctx := context.Background()
repositoryCreate := &api.RepositoryCreate{}
if err := jsonapi.UnmarshalPayload(c.Request().Body, repositoryCreate); err != nil {
@@ -162,23 +162,23 @@ func (s *Server) registerProjectRoutes(g *echo.Group) {
}
vcsFind := &api.VCSFind{
- ID: &repositoryCreate.VCSId,
+ ID: &repositoryCreate.VCSID,
}
vcs, err := s.VCSService.FindVCS(ctx, vcsFind)
if err != nil {
if common.ErrorCode(err) == common.NotFound {
- return echo.NewHTTPError(http.StatusNotFound, fmt.Sprintf("VCS ID not found: %d", repositoryCreate.VCSId))
+ return echo.NewHTTPError(http.StatusNotFound, fmt.Sprintf("VCS ID not found: %d", repositoryCreate.VCSID))
}
- return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to find VCS for creating repository: %d", repositoryCreate.VCSId)).SetInternal(err)
+ return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to find VCS for creating repository: %d", repositoryCreate.VCSID)).SetInternal(err)
}
repositoryCreate.WebhookURLHost = fmt.Sprintf("%s:%d", s.host, s.port)
- repositoryCreate.WebhookEndpointId = uuid.New().String()
+ repositoryCreate.WebhookEndpointID = uuid.New().String()
repositoryCreate.WebhookSecretToken = common.RandomString(gitlab.SECRET_TOKEN_LENGTH)
switch vcs.Type {
case "GITLAB_SELF_HOST":
webhookPost := gitlab.WebhookPost{
- URL: fmt.Sprintf("%s:%d/%s/%s", s.host, s.port, gitLabWebhookPath, repositoryCreate.WebhookEndpointId),
+ URL: fmt.Sprintf("%s:%d/%s/%s", s.host, s.port, gitLabWebhookPath, repositoryCreate.WebhookEndpointID),
SecretToken: repositoryCreate.WebhookSecretToken,
PushEvents: true,
PushEventsBranchFilter: repositoryCreate.BranchFilter,
@@ -186,37 +186,37 @@ func (s *Server) registerProjectRoutes(g *echo.Group) {
}
body, err := json.Marshal(webhookPost)
if err != nil {
- return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to marshal post request for creating webhook for project ID: %v", repositoryCreate.ProjectId)).SetInternal(err)
+ return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to marshal post request for creating webhook for project ID: %v", repositoryCreate.ProjectID)).SetInternal(err)
}
- resourcePath := fmt.Sprintf("projects/%s/hooks", repositoryCreate.ExternalId)
+ resourcePath := fmt.Sprintf("projects/%s/hooks", repositoryCreate.ExternalID)
resp, err := gitlab.POST(vcs.InstanceURL, resourcePath, repositoryCreate.AccessToken, bytes.NewBuffer(body))
if err != nil {
- return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to create webhook for project ID: %v", repositoryCreate.ProjectId)).SetInternal(err)
+ return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to create webhook for project ID: %v", repositoryCreate.ProjectID)).SetInternal(err)
}
defer resp.Body.Close()
if resp.StatusCode >= 300 {
return echo.NewHTTPError(http.StatusInternalServerError,
fmt.Sprintf("Failed to create webhook for project ID: %v, status code: %d",
- repositoryCreate.ProjectId,
+ repositoryCreate.ProjectID,
resp.StatusCode,
))
}
webhookInfo := &gitlab.WebhookInfo{}
if err := json.NewDecoder(resp.Body).Decode(webhookInfo); err != nil {
- return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to unmarshal create webhook response for project ID: %v", repositoryCreate.ProjectId)).SetInternal(err)
+ return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to unmarshal create webhook response for project ID: %v", repositoryCreate.ProjectID)).SetInternal(err)
}
- repositoryCreate.ExternalWebhookId = strconv.Itoa(webhookInfo.ID)
+ repositoryCreate.ExternalWebhookID = strconv.Itoa(webhookInfo.ID)
}
- repositoryCreate.CreatorId = c.Get(GetPrincipalIdContextKey()).(int)
+ repositoryCreate.CreatorID = c.Get(GetPrincipalIDContextKey()).(int)
// Remove enclosing /
repositoryCreate.BaseDirectory = strings.Trim(repositoryCreate.BaseDirectory, "/")
repository, err := s.RepositoryService.CreateRepository(ctx, repositoryCreate)
if err != nil {
if common.ErrorCode(err) == common.Conflict {
- return echo.NewHTTPError(http.StatusConflict, fmt.Sprintf("Project %d has already linked repository", repositoryCreate.ProjectId))
+ return echo.NewHTTPError(http.StatusConflict, fmt.Sprintf("Project %d has already linked repository", repositoryCreate.ProjectID))
}
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to link project repository").SetInternal(err)
}
@@ -235,24 +235,24 @@ func (s *Server) registerProjectRoutes(g *echo.Group) {
// Requires a separate API to return the repository, we do this because
// 1. repository also contains project, which would cause circular dependency when composing it.
// 2. repository info is only needed when fetching a particular project by id, thus it's unnecessary to include it in the project list response.
- g.GET("/project/:projectId/repository", func(c echo.Context) error {
+ g.GET("/project/:projectID/repository", func(c echo.Context) error {
ctx := context.Background()
- projectId, err := strconv.Atoi(c.Param("projectId"))
+ projectID, err := strconv.Atoi(c.Param("projectID"))
if err != nil {
- return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Project ID is not a number: %s", c.Param("projectId"))).SetInternal(err)
+ return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Project ID is not a number: %s", c.Param("projectID"))).SetInternal(err)
}
repositoryFind := &api.RepositoryFind{
- ProjectId: &projectId,
+ ProjectID: &projectID,
}
list, 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)
+ 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)
+ return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Retrieved %d repository list for project ID: %d, expect at most 1", len(list), projectID)).SetInternal(err)
}
for _, repository := range list {
@@ -263,21 +263,21 @@ func (s *Server) registerProjectRoutes(g *echo.Group) {
c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSONCharsetUTF8)
if err := jsonapi.MarshalPayload(c.Response().Writer, list); err != nil {
- return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to marshal project repository response: %v", projectId)).SetInternal(err)
+ return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to marshal project repository response: %v", projectID)).SetInternal(err)
}
return nil
})
// When we unlink the repository with the project, we will also change the project workflow type to UI
- g.PATCH("/project/:projectId/repository", func(c echo.Context) error {
+ g.PATCH("/project/:projectID/repository", func(c echo.Context) error {
ctx := context.Background()
- projectId, err := strconv.Atoi(c.Param("projectId"))
+ projectID, err := strconv.Atoi(c.Param("projectID"))
if err != nil {
- return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Project ID is not a number: %s", c.Param("projectId"))).SetInternal(err)
+ return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Project ID is not a number: %s", c.Param("projectID"))).SetInternal(err)
}
repositoryPatch := &api.RepositoryPatch{
- UpdaterId: c.Get(GetPrincipalIdContextKey()).(int),
+ UpdaterID: c.Get(GetPrincipalIDContextKey()).(int),
}
if err := jsonapi.UnmarshalPayload(c.Request().Body, repositoryPatch); err != nil {
return echo.NewHTTPError(http.StatusBadRequest, "Malformatted patch linked repository request").SetInternal(err)
@@ -302,34 +302,34 @@ func (s *Server) registerProjectRoutes(g *echo.Group) {
}
repositoryFind := &api.RepositoryFind{
- ProjectId: &projectId,
+ ProjectID: &projectID,
}
list, 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)
+ 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)
+ 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 {
- return echo.NewHTTPError(http.StatusNotFound, fmt.Sprintf("Repository not found for project ID: %d", projectId))
+ return echo.NewHTTPError(http.StatusNotFound, fmt.Sprintf("Repository not found for project ID: %d", projectID))
}
repository := list[0]
repositoryPatch.ID = repository.ID
updatedRepository, err := s.RepositoryService.PatchRepository(ctx, repositoryPatch)
if err != nil {
- return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to update repository for project ID: %d", projectId)).SetInternal(err)
+ return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to update repository for project ID: %d", projectID)).SetInternal(err)
}
if repositoryPatch.BranchFilter != nil {
vcsFind := &api.VCSFind{
- ID: &repository.VCSId,
+ ID: &repository.VCSID,
}
vcs, err := s.VCSService.FindVCS(ctx, vcsFind)
if err != nil {
- return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to update repository for project ID: %d", projectId)).SetInternal(err)
+ return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to update repository for project ID: %d", projectID)).SetInternal(err)
}
// Updates the webhook after we successfully update the repository.
// This is because in case the webhook update fails, we can still have a reconcile process to reconcile the webhook state.
@@ -337,17 +337,17 @@ func (s *Server) registerProjectRoutes(g *echo.Group) {
switch vcs.Type {
case "GITLAB_SELF_HOST":
webhookPut := gitlab.WebhookPut{
- URL: fmt.Sprintf("%s:%d/%s/%s", s.host, s.port, gitLabWebhookPath, updatedRepository.WebhookEndpointId),
+ URL: fmt.Sprintf("%s:%d/%s/%s", s.host, s.port, gitLabWebhookPath, updatedRepository.WebhookEndpointID),
PushEventsBranchFilter: *repositoryPatch.BranchFilter,
}
json, err := json.Marshal(webhookPut)
if err != nil {
- return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to marshal put request for updating webhook %s for project ID: %v", repository.ExternalWebhookId, projectId)).SetInternal(err)
+ return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to marshal put request for updating webhook %s for project ID: %v", repository.ExternalWebhookID, projectID)).SetInternal(err)
}
- resourcePath := fmt.Sprintf("projects/%s/hooks/%s", repository.ExternalId, repository.ExternalWebhookId)
+ resourcePath := fmt.Sprintf("projects/%s/hooks/%s", repository.ExternalID, repository.ExternalWebhookID)
resp, err := gitlab.PUT(vcs.InstanceURL, resourcePath, repository.AccessToken, bytes.NewBuffer(json))
if err != nil {
- return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to update webhook ID %s for project ID: %v", repository.ExternalWebhookId, projectId)).SetInternal(err)
+ return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to update webhook ID %s for project ID: %v", repository.ExternalWebhookID, projectID)).SetInternal(err)
}
defer resp.Body.Close()
@@ -356,7 +356,7 @@ func (s *Server) registerProjectRoutes(g *echo.Group) {
s.l.Error(("Failed to update gitlab webhook when updating repository for project"),
zap.Int("status_code", resp.StatusCode),
zap.String("status", resp.Status),
- zap.Int("project_id", projectId),
+ zap.Int("project_id", projectID),
zap.Int("repository_id", repository.ID),
zap.String("resource_path", resourcePath),
zap.String("body", string(json)),
@@ -371,49 +371,49 @@ func (s *Server) registerProjectRoutes(g *echo.Group) {
c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSONCharsetUTF8)
if err := jsonapi.MarshalPayload(c.Response().Writer, updatedRepository); err != nil {
- return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to marshal project repository response: %v", projectId)).SetInternal(err)
+ return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to marshal project repository response: %v", projectID)).SetInternal(err)
}
return nil
})
// When we unlink the repository with the project, we will also change the project workflow type to UI
- g.DELETE("/project/:projectId/repository", func(c echo.Context) error {
+ g.DELETE("/project/:projectID/repository", func(c echo.Context) error {
ctx := context.Background()
- projectId, err := strconv.Atoi(c.Param("projectId"))
+ projectID, err := strconv.Atoi(c.Param("projectID"))
if err != nil {
- return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Project ID is not a number: %s", c.Param("projectId"))).SetInternal(err)
+ return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Project ID is not a number: %s", c.Param("projectID"))).SetInternal(err)
}
repositoryFind := &api.RepositoryFind{
- ProjectId: &projectId,
+ ProjectID: &projectID,
}
list, 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)
+ 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)
+ 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 {
- return echo.NewHTTPError(http.StatusNotFound, fmt.Sprintf("Repository not found for project ID: %d", projectId))
+ return echo.NewHTTPError(http.StatusNotFound, fmt.Sprintf("Repository not found for project ID: %d", projectID))
}
repository := list[0]
vcsFind := &api.VCSFind{
- ID: &repository.VCSId,
+ ID: &repository.VCSID,
}
vcs, err := s.VCSService.FindVCS(ctx, vcsFind)
if err != nil {
- return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to delete repository for project ID: %d", projectId)).SetInternal(err)
+ return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to delete repository for project ID: %d", projectID)).SetInternal(err)
}
repositoryDelete := &api.RepositoryDelete{
- ProjectId: projectId,
- DeleterId: c.Get(GetPrincipalIdContextKey()).(int),
+ ProjectID: projectID,
+ DeleterID: c.Get(GetPrincipalIDContextKey()).(int),
}
if err := s.RepositoryService.DeleteRepository(ctx, repositoryDelete); err != nil {
- return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to delete repository for project ID: %d", projectId)).SetInternal(err)
+ return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to delete repository for project ID: %d", projectID)).SetInternal(err)
}
// Deletes the webhook after we successfully delete the repository.
@@ -421,9 +421,9 @@ func (s *Server) registerProjectRoutes(g *echo.Group) {
// If we delete it before we delete the repository, then if the repository deletion fails, we will have a broken repository with no webhook.
switch vcs.Type {
case "GITLAB_SELF_HOST":
- resp, err := gitlab.DELETE(vcs.InstanceURL, fmt.Sprintf("projects/%s/hooks/%s", repository.ExternalId, repository.ExternalWebhookId), repository.AccessToken)
+ resp, err := gitlab.DELETE(vcs.InstanceURL, fmt.Sprintf("projects/%s/hooks/%s", repository.ExternalID, repository.ExternalWebhookID), repository.AccessToken)
if err != nil {
- return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to delete webhook ID %s for project ID: %v", repository.ExternalWebhookId, projectId)).SetInternal(err)
+ return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to delete webhook ID %s for project ID: %v", repository.ExternalWebhookID, projectID)).SetInternal(err)
}
defer resp.Body.Close()
@@ -431,10 +431,10 @@ func (s *Server) registerProjectRoutes(g *echo.Group) {
if resp.StatusCode >= 300 {
s.l.Error(("Failed to delete gitlab webhook when unlinking repository from project"),
zap.Int("status_code", resp.StatusCode),
- zap.Int("project_id", projectId),
+ zap.Int("project_id", projectID),
zap.Int("repository_id", repository.ID),
- zap.String("gitlab_project_id", repository.ExternalId),
- zap.String("gitlab_webhook_id", repository.ExternalWebhookId))
+ zap.String("gitlab_project_id", repository.ExternalID),
+ zap.String("gitlab_webhook_id", repository.ExternalWebhookID))
}
}
@@ -444,7 +444,7 @@ func (s *Server) registerProjectRoutes(g *echo.Group) {
})
}
-func (s *Server) ComposeProjectlById(ctx context.Context, id int) (*api.Project, error) {
+func (s *Server) ComposeProjectlByID(ctx context.Context, id int) (*api.Project, error) {
projectFind := &api.ProjectFind{
ID: &id,
}
@@ -463,17 +463,17 @@ func (s *Server) ComposeProjectlById(ctx context.Context, id int) (*api.Project,
func (s *Server) ComposeProjectRelationship(ctx context.Context, project *api.Project) error {
var err error
- project.Creator, err = s.ComposePrincipalById(ctx, project.CreatorId)
+ project.Creator, err = s.ComposePrincipalByID(ctx, project.CreatorID)
if err != nil {
return err
}
- project.Updater, err = s.ComposePrincipalById(ctx, project.UpdaterId)
+ project.Updater, err = s.ComposePrincipalByID(ctx, project.UpdaterID)
if err != nil {
return err
}
- project.ProjectMemberList, err = s.ComposeProjectMemberListByProjectId(ctx, project.ID)
+ project.ProjectMemberList, err = s.ComposeProjectMemberListByProjectID(ctx, project.ID)
if err != nil {
return err
}
diff --git a/server/project_member.go b/server/project_member.go
index 1ec888ed0f..1b84b3626b 100644
--- a/server/project_member.go
+++ b/server/project_member.go
@@ -14,16 +14,16 @@ import (
)
func (s *Server) registerProjectMemberRoutes(g *echo.Group) {
- g.POST("/project/:projectId/member", func(c echo.Context) error {
+ g.POST("/project/:projectID/member", func(c echo.Context) error {
ctx := context.Background()
- projectId, err := strconv.Atoi(c.Param("projectId"))
+ projectID, err := strconv.Atoi(c.Param("projectID"))
if err != nil {
- return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Project ID is not a number: %s", c.Param("projectId"))).SetInternal(err)
+ return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Project ID is not a number: %s", c.Param("projectID"))).SetInternal(err)
}
projectMemberCreate := &api.ProjectMemberCreate{
- ProjectId: projectId,
- CreatorId: c.Get(GetPrincipalIdContextKey()).(int),
+ ProjectID: projectID,
+ CreatorID: c.Get(GetPrincipalIDContextKey()).(int),
}
if err := jsonapi.UnmarshalPayload(c.Request().Body, projectMemberCreate); err != nil {
return echo.NewHTTPError(http.StatusBadRequest, "Malformatted create project membership request").SetInternal(err)
@@ -43,8 +43,8 @@ func (s *Server) registerProjectMemberRoutes(g *echo.Group) {
{
activityCreate := &api.ActivityCreate{
- CreatorId: c.Get(GetPrincipalIdContextKey()).(int),
- ContainerId: projectId,
+ CreatorID: c.Get(GetPrincipalIDContextKey()).(int),
+ ContainerID: projectID,
Type: api.ActivityProjectMemberCreate,
Level: api.ACTIVITY_INFO,
Comment: fmt.Sprintf("Granted %s to %s (%s).",
@@ -53,7 +53,7 @@ func (s *Server) registerProjectMemberRoutes(g *echo.Group) {
_, err = s.ActivityManager.CreateActivity(ctx, activityCreate, &ActivityMeta{})
if err != nil {
s.l.Warn("Failed to create project activity after creating member",
- zap.Int("project_id", projectId),
+ zap.Int("project_id", projectID),
zap.Int("principal_id", projectMember.Principal.ID),
zap.String("principal_name", projectMember.Principal.Name),
zap.String("role", projectMember.Role),
@@ -68,16 +68,16 @@ func (s *Server) registerProjectMemberRoutes(g *echo.Group) {
return nil
})
- g.PATCH("/project/:projectId/member/:memberId", func(c echo.Context) error {
+ g.PATCH("/project/:projectID/member/:memberID", func(c echo.Context) error {
ctx := context.Background()
- projectId, err := strconv.Atoi(c.Param("projectId"))
+ projectID, err := strconv.Atoi(c.Param("projectID"))
if err != nil {
- return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Project ID is not a number: %s", c.Param("projectId"))).SetInternal(err)
+ return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Project ID is not a number: %s", c.Param("projectID"))).SetInternal(err)
}
- id, err := strconv.Atoi(c.Param("memberId"))
+ id, err := strconv.Atoi(c.Param("memberID"))
if err != nil {
- return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("memberId"))).SetInternal(err)
+ return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("memberID"))).SetInternal(err)
}
existingProjectMember, err := s.ProjectMemberService.FindProjectMember(ctx, &api.ProjectMemberFind{ID: &id})
@@ -90,7 +90,7 @@ func (s *Server) registerProjectMemberRoutes(g *echo.Group) {
projectMemberPatch := &api.ProjectMemberPatch{
ID: id,
- UpdaterId: c.Get(GetPrincipalIdContextKey()).(int),
+ UpdaterID: c.Get(GetPrincipalIDContextKey()).(int),
}
if err := jsonapi.UnmarshalPayload(c.Request().Body, projectMemberPatch); err != nil {
return echo.NewHTTPError(http.StatusBadRequest, "Malformatted change project membership").SetInternal(err)
@@ -110,8 +110,8 @@ func (s *Server) registerProjectMemberRoutes(g *echo.Group) {
{
activityCreate := &api.ActivityCreate{
- CreatorId: c.Get(GetPrincipalIdContextKey()).(int),
- ContainerId: projectId,
+ CreatorID: c.Get(GetPrincipalIDContextKey()).(int),
+ ContainerID: projectID,
Type: api.ActivityProjectMemberRoleUpdate,
Level: api.ACTIVITY_INFO,
Comment: fmt.Sprintf("Changed %s (%s) from %s to %s.",
@@ -120,7 +120,7 @@ func (s *Server) registerProjectMemberRoutes(g *echo.Group) {
_, err = s.ActivityManager.CreateActivity(ctx, activityCreate, &ActivityMeta{})
if err != nil {
s.l.Warn("Failed to create project activity after updating member role",
- zap.Int("project_id", projectId),
+ zap.Int("project_id", projectID),
zap.Int("principal_id", projectMember.Principal.ID),
zap.String("principal_name", projectMember.Principal.Name),
zap.String("old_role", existingProjectMember.Role),
@@ -136,16 +136,16 @@ func (s *Server) registerProjectMemberRoutes(g *echo.Group) {
return nil
})
- g.DELETE("/project/:projectId/member/:memberId", func(c echo.Context) error {
+ g.DELETE("/project/:projectID/member/:memberID", func(c echo.Context) error {
ctx := context.Background()
- projectId, err := strconv.Atoi(c.Param("projectId"))
+ projectID, err := strconv.Atoi(c.Param("projectID"))
if err != nil {
- return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Project ID is not a number: %s", c.Param("projectId"))).SetInternal(err)
+ return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Project ID is not a number: %s", c.Param("projectID"))).SetInternal(err)
}
- id, err := strconv.Atoi(c.Param("memberId"))
+ id, err := strconv.Atoi(c.Param("memberID"))
if err != nil {
- return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("memberId"))).SetInternal(err)
+ return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("memberID"))).SetInternal(err)
}
projectMember, err := s.ProjectMemberService.FindProjectMember(ctx, &api.ProjectMemberFind{ID: &id})
@@ -158,7 +158,7 @@ func (s *Server) registerProjectMemberRoutes(g *echo.Group) {
projectMemberDelete := &api.ProjectMemberDelete{
ID: id,
- DeleterId: c.Get(GetPrincipalIdContextKey()).(int),
+ DeleterID: c.Get(GetPrincipalIDContextKey()).(int),
}
err = s.ProjectMemberService.DeleteProjectMember(ctx, projectMemberDelete)
if err != nil {
@@ -169,11 +169,11 @@ func (s *Server) registerProjectMemberRoutes(g *echo.Group) {
}
{
- projectMember.Principal, err = s.ComposePrincipalById(ctx, projectMember.PrincipalId)
+ projectMember.Principal, err = s.ComposePrincipalByID(ctx, projectMember.PrincipalID)
if err == nil {
activityCreate := &api.ActivityCreate{
- CreatorId: c.Get(GetPrincipalIdContextKey()).(int),
- ContainerId: projectId,
+ CreatorID: c.Get(GetPrincipalIDContextKey()).(int),
+ ContainerID: projectID,
Type: api.ActivityProjectMemberDelete,
Level: api.ACTIVITY_INFO,
Comment: fmt.Sprintf("Revoked %s from %s (%s).",
@@ -183,7 +183,7 @@ func (s *Server) registerProjectMemberRoutes(g *echo.Group) {
}
if err != nil {
s.l.Warn("Failed to create project activity after deleting member",
- zap.Int("project_id", projectId),
+ zap.Int("project_id", projectID),
zap.Int("principal_id", projectMember.Principal.ID),
zap.String("principal_name", projectMember.Principal.Name),
zap.String("role", projectMember.Role),
@@ -197,9 +197,9 @@ func (s *Server) registerProjectMemberRoutes(g *echo.Group) {
})
}
-func (s *Server) ComposeProjectMemberListByProjectId(ctx context.Context, projectId int) ([]*api.ProjectMember, error) {
+func (s *Server) ComposeProjectMemberListByProjectID(ctx context.Context, projectID int) ([]*api.ProjectMember, error) {
projectMemberFind := &api.ProjectMemberFind{
- ProjectId: &projectId,
+ ProjectID: &projectID,
}
projectMemberList, err := s.ProjectMemberService.FindProjectMemberList(ctx, projectMemberFind)
if err != nil {
@@ -217,17 +217,17 @@ func (s *Server) ComposeProjectMemberListByProjectId(ctx context.Context, projec
func (s *Server) ComposeProjectMemberRelationship(ctx context.Context, projectMember *api.ProjectMember) error {
var err error
- projectMember.Creator, err = s.ComposePrincipalById(ctx, projectMember.CreatorId)
+ projectMember.Creator, err = s.ComposePrincipalByID(ctx, projectMember.CreatorID)
if err != nil {
return err
}
- projectMember.Updater, err = s.ComposePrincipalById(ctx, projectMember.UpdaterId)
+ projectMember.Updater, err = s.ComposePrincipalByID(ctx, projectMember.UpdaterID)
if err != nil {
return err
}
- projectMember.Principal, err = s.ComposePrincipalById(ctx, projectMember.PrincipalId)
+ projectMember.Principal, err = s.ComposePrincipalByID(ctx, projectMember.PrincipalID)
if err != nil {
return err
}
diff --git a/server/project_webhook.go b/server/project_webhook.go
index 12a9e64932..56c9ede48e 100644
--- a/server/project_webhook.go
+++ b/server/project_webhook.go
@@ -15,19 +15,19 @@ import (
)
func (s *Server) registerProjectWebhookRoutes(g *echo.Group) {
- g.GET("/project/:projectId/webhook", func(c echo.Context) error {
+ g.GET("/project/:projectID/webhook", func(c echo.Context) error {
ctx := context.Background()
- projectId, err := strconv.Atoi(c.Param("projectId"))
+ projectID, err := strconv.Atoi(c.Param("projectID"))
if err != nil {
- return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Project ID is not a number: %s", c.Param("projectId"))).SetInternal(err)
+ return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Project ID is not a number: %s", c.Param("projectID"))).SetInternal(err)
}
find := &api.ProjectWebhookFind{
- ProjectId: &projectId,
+ ProjectID: &projectID,
}
list, 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)
+ return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to fetch webhook list for project ID: %d", projectID)).SetInternal(err)
}
for _, hook := range list {
@@ -38,21 +38,21 @@ func (s *Server) registerProjectWebhookRoutes(g *echo.Group) {
c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSONCharsetUTF8)
if err := jsonapi.MarshalPayload(c.Response().Writer, list); err != nil {
- return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to marshal project webhook response: %v", projectId)).SetInternal(err)
+ return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to marshal project webhook response: %v", projectID)).SetInternal(err)
}
return nil
})
- g.POST("/project/:projectId/webhook", func(c echo.Context) error {
+ g.POST("/project/:projectID/webhook", func(c echo.Context) error {
ctx := context.Background()
- projectId, err := strconv.Atoi(c.Param("projectId"))
+ projectID, err := strconv.Atoi(c.Param("projectID"))
if err != nil {
- return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Project ID is not a number: %s", c.Param("projectId"))).SetInternal(err)
+ return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Project ID is not a number: %s", c.Param("projectID"))).SetInternal(err)
}
hookCreate := &api.ProjectWebhookCreate{
- CreatorId: c.Get(GetPrincipalIdContextKey()).(int),
- ProjectId: projectId,
+ CreatorID: c.Get(GetPrincipalIDContextKey()).(int),
+ ProjectID: projectID,
}
if err := jsonapi.UnmarshalPayload(c.Request().Body, hookCreate); err != nil {
return echo.NewHTTPError(http.StatusBadRequest, "Malformatted create project webhook request").SetInternal(err)
@@ -77,16 +77,16 @@ func (s *Server) registerProjectWebhookRoutes(g *echo.Group) {
return nil
})
- g.GET("/project/:projectId/webhook/:webhookId", func(c echo.Context) error {
+ g.GET("/project/:projectID/webhook/:webhookID", func(c echo.Context) error {
ctx := context.Background()
- _, err := strconv.Atoi(c.Param("projectId"))
+ _, err := strconv.Atoi(c.Param("projectID"))
if err != nil {
- return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Project ID is not a number: %s", c.Param("projectId"))).SetInternal(err)
+ return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Project ID is not a number: %s", c.Param("projectID"))).SetInternal(err)
}
- id, err := strconv.Atoi(c.Param("webhookId"))
+ id, err := strconv.Atoi(c.Param("webhookID"))
if err != nil {
- return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Project webhook ID is not a number: %s", c.Param("webhookId"))).SetInternal(err)
+ return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Project webhook ID is not a number: %s", c.Param("webhookID"))).SetInternal(err)
}
find := &api.ProjectWebhookFind{
@@ -111,21 +111,21 @@ func (s *Server) registerProjectWebhookRoutes(g *echo.Group) {
return nil
})
- g.PATCH("/project/:projectId/webhook/:webhookId", func(c echo.Context) error {
+ g.PATCH("/project/:projectID/webhook/:webhookID", func(c echo.Context) error {
ctx := context.Background()
- _, err := strconv.Atoi(c.Param("projectId"))
+ _, err := strconv.Atoi(c.Param("projectID"))
if err != nil {
- return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Project ID is not a number: %s", c.Param("projectId"))).SetInternal(err)
+ return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Project ID is not a number: %s", c.Param("projectID"))).SetInternal(err)
}
- id, err := strconv.Atoi(c.Param("webhookId"))
+ id, err := strconv.Atoi(c.Param("webhookID"))
if err != nil {
- return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Project webhook ID is not a number: %s", c.Param("webhookId"))).SetInternal(err)
+ return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Project webhook ID is not a number: %s", c.Param("webhookID"))).SetInternal(err)
}
hookPatch := &api.ProjectWebhookPatch{
ID: id,
- UpdaterId: c.Get(GetPrincipalIdContextKey()).(int),
+ UpdaterID: c.Get(GetPrincipalIDContextKey()).(int),
}
if err := jsonapi.UnmarshalPayload(c.Request().Body, hookPatch); err != nil {
return echo.NewHTTPError(http.StatusBadRequest, "Malformatted change project webhook").SetInternal(err)
@@ -153,21 +153,21 @@ func (s *Server) registerProjectWebhookRoutes(g *echo.Group) {
return nil
})
- g.DELETE("/project/:projectId/webhook/:webhookId", func(c echo.Context) error {
+ g.DELETE("/project/:projectID/webhook/:webhookID", func(c echo.Context) error {
ctx := context.Background()
- _, err := strconv.Atoi(c.Param("projectId"))
+ _, err := strconv.Atoi(c.Param("projectID"))
if err != nil {
- return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Project ID is not a number: %s", c.Param("projectId"))).SetInternal(err)
+ return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Project ID is not a number: %s", c.Param("projectID"))).SetInternal(err)
}
- id, err := strconv.Atoi(c.Param("webhookId"))
+ id, err := strconv.Atoi(c.Param("webhookID"))
if err != nil {
- return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Webhook ID is not a number: %s", c.Param("webhookId"))).SetInternal(err)
+ return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Webhook ID is not a number: %s", c.Param("webhookID"))).SetInternal(err)
}
hookDelete := &api.ProjectWebhookDelete{
ID: id,
- DeleterId: c.Get(GetPrincipalIdContextKey()).(int),
+ DeleterID: c.Get(GetPrincipalIDContextKey()).(int),
}
err = s.ProjectWebhookService.DeleteProjectWebhook(ctx, hookDelete)
if err != nil {
@@ -182,27 +182,27 @@ func (s *Server) registerProjectWebhookRoutes(g *echo.Group) {
return nil
})
- g.GET("/project/:projectId/webhook/:webhookId/test", func(c echo.Context) error {
+ g.GET("/project/:projectID/webhook/:webhookID/test", func(c echo.Context) error {
ctx := context.Background()
- projectId, err := strconv.Atoi(c.Param("projectId"))
+ projectID, err := strconv.Atoi(c.Param("projectID"))
if err != nil {
- return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Project ID is not a number: %s", c.Param("projectId"))).SetInternal(err)
+ return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Project ID is not a number: %s", c.Param("projectID"))).SetInternal(err)
}
projectFind := &api.ProjectFind{
- ID: &projectId,
+ ID: &projectID,
}
project, err := s.ProjectService.FindProject(ctx, projectFind)
if err != nil {
if common.ErrorCode(err) == common.NotFound {
- return echo.NewHTTPError(http.StatusNotFound, fmt.Sprintf("Project ID not found: %d", projectId))
+ return echo.NewHTTPError(http.StatusNotFound, fmt.Sprintf("Project ID not found: %d", projectID))
}
- return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to fetch project ID: %v", projectId)).SetInternal(err)
+ return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to fetch project ID: %v", projectID)).SetInternal(err)
}
- id, err := strconv.Atoi(c.Param("webhookId"))
+ id, err := strconv.Atoi(c.Param("webhookID"))
if err != nil {
- return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Project webhook ID is not a number: %s", c.Param("webhookId"))).SetInternal(err)
+ return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Project webhook ID is not a number: %s", c.Param("webhookID"))).SetInternal(err)
}
find := &api.ProjectWebhookFind{
@@ -243,7 +243,7 @@ func (s *Server) registerProjectWebhookRoutes(g *echo.Group) {
c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSONCharsetUTF8)
if err := jsonapi.MarshalPayload(c.Response().Writer, result); err != nil {
- return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to marshal project webhook response: %v", projectId)).SetInternal(err)
+ return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to marshal project webhook response: %v", projectID)).SetInternal(err)
}
return nil
})
@@ -252,12 +252,12 @@ func (s *Server) registerProjectWebhookRoutes(g *echo.Group) {
func (s *Server) ComposeProjectWebhookRelationship(ctx context.Context, hook *api.ProjectWebhook) error {
var err error
- hook.Creator, err = s.ComposePrincipalById(ctx, hook.CreatorId)
+ hook.Creator, err = s.ComposePrincipalByID(ctx, hook.CreatorID)
if err != nil {
return err
}
- hook.Updater, err = s.ComposePrincipalById(ctx, hook.UpdaterId)
+ hook.Updater, err = s.ComposePrincipalByID(ctx, hook.UpdaterID)
if err != nil {
return err
}
diff --git a/server/repository.go b/server/repository.go
index 4001db1dc9..21be74c633 100644
--- a/server/repository.go
+++ b/server/repository.go
@@ -9,22 +9,22 @@ import (
func (s *Server) ComposeRepositoryRelationship(ctx context.Context, repository *api.Repository) error {
var err error
- repository.Creator, err = s.ComposePrincipalById(ctx, repository.CreatorId)
+ repository.Creator, err = s.ComposePrincipalByID(ctx, repository.CreatorID)
if err != nil {
return err
}
- repository.Updater, err = s.ComposePrincipalById(ctx, repository.UpdaterId)
+ repository.Updater, err = s.ComposePrincipalByID(ctx, repository.UpdaterID)
if err != nil {
return err
}
- repository.VCS, err = s.ComposeVCSById(ctx, repository.VCSId)
+ repository.VCS, err = s.ComposeVCSByID(ctx, repository.VCSID)
if err != nil {
return err
}
- repository.Project, err = s.ComposeProjectlById(ctx, repository.ProjectId)
+ repository.Project, err = s.ComposeProjectlByID(ctx, repository.ProjectID)
if err != nil {
return err
}
diff --git a/server/setting.go b/server/setting.go
index af5477efe3..e329913d87 100644
--- a/server/setting.go
+++ b/server/setting.go
@@ -52,7 +52,7 @@ func (s *Server) registerSettingRoutes(g *echo.Group) {
ctx := context.Background()
settingPatch := &api.SettingPatch{
Name: api.SettingName(c.Param("name")),
- UpdaterId: c.Get(GetPrincipalIdContextKey()).(int),
+ UpdaterID: c.Get(GetPrincipalIDContextKey()).(int),
}
if err := jsonapi.UnmarshalPayload(c.Request().Body, settingPatch); err != nil {
return echo.NewHTTPError(http.StatusBadRequest, "Malformatted update setting request").SetInternal(err)
@@ -77,12 +77,12 @@ func (s *Server) registerSettingRoutes(g *echo.Group) {
func (s *Server) ComposeSettingRelationship(ctx context.Context, setting *api.Setting) error {
var err error
- setting.Creator, err = s.ComposePrincipalById(ctx, setting.CreatorId)
+ setting.Creator, err = s.ComposePrincipalByID(ctx, setting.CreatorID)
if err != nil {
return err
}
- setting.Updater, err = s.ComposePrincipalById(ctx, setting.UpdaterId)
+ setting.Updater, err = s.ComposePrincipalByID(ctx, setting.UpdaterID)
if err != nil {
return err
}
diff --git a/server/sql.go b/server/sql.go
index 196aa2838c..5966d0769a 100644
--- a/server/sql.go
+++ b/server/sql.go
@@ -24,12 +24,12 @@ func (s *Server) registerSqlRoutes(g *echo.Group) {
password := connectionInfo.Password
// Instance detail page has a Test Connection button, if user doesn't input new password and doesn't specify
// to use empty password, we want the connection to use the existing password to test the connection, however,
- // we do not transfer the password back to client, thus the client will pass the instanceId to let server
+ // we do not transfer the password back to client, thus the client will pass the instanceID to let server
// retrieve the password.
- if password == "" && !connectionInfo.UseEmptyPassword && connectionInfo.InstanceId != nil {
- adminPassword, err := s.FindInstanceAdminPasswordById(ctx, *connectionInfo.InstanceId)
+ if password == "" && !connectionInfo.UseEmptyPassword && connectionInfo.InstanceID != nil {
+ adminPassword, err := s.FindInstanceAdminPasswordByID(ctx, *connectionInfo.InstanceID)
if err != nil {
- return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to retrieve admin password for instance: %d", connectionInfo.InstanceId)).SetInternal(err)
+ return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to retrieve admin password for instance: %d", connectionInfo.InstanceID)).SetInternal(err)
}
password = adminPassword
}
@@ -75,12 +75,12 @@ func (s *Server) registerSqlRoutes(g *echo.Group) {
return echo.NewHTTPError(http.StatusBadRequest, "Malformatted sql sync schema request").SetInternal(err)
}
- instance, err := s.ComposeInstanceById(ctx, sync.InstanceId)
+ instance, err := s.ComposeInstanceByID(ctx, sync.InstanceID)
if err != nil {
if common.ErrorCode(err) == common.NotFound {
- return echo.NewHTTPError(http.StatusNotFound, fmt.Sprintf("Instance ID not found: %d", sync.InstanceId))
+ return echo.NewHTTPError(http.StatusNotFound, fmt.Sprintf("Instance ID not found: %d", sync.InstanceID))
}
- return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to fetch instance ID: %v", sync.InstanceId)).SetInternal(err)
+ return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to fetch instance ID: %v", sync.InstanceID)).SetInternal(err)
}
resultSet := s.SyncEngineVersionAndSchema(ctx, instance)
@@ -112,7 +112,7 @@ func (s *Server) SyncEngineVersionAndSchema(ctx context.Context, instance *api.I
if version != instance.EngineVersion {
_, err := s.InstanceService.PatchInstance(ctx, &api.InstancePatch{
ID: instance.ID,
- UpdaterId: api.SYSTEM_BOT_ID,
+ UpdaterID: api.SYSTEM_BOT_ID,
EngineVersion: &version,
})
if err != nil {
@@ -174,10 +174,10 @@ func (s *Server) SyncEngineVersionAndSchema(ctx context.Context, instance *api.I
var recreateTableSchema = func(database *api.Database, table db.DBTable) error {
// Table
tableCreate := &api.TableCreate{
- CreatorId: api.SYSTEM_BOT_ID,
+ CreatorID: api.SYSTEM_BOT_ID,
CreatedTs: table.CreatedTs,
UpdatedTs: table.UpdatedTs,
- DatabaseId: database.ID,
+ DatabaseID: database.ID,
Name: table.Name,
Type: table.Type,
Engine: table.Engine,
@@ -197,17 +197,17 @@ func (s *Server) SyncEngineVersionAndSchema(ctx context.Context, instance *api.I
// Column
for _, column := range table.ColumnList {
columnFind := &api.ColumnFind{
- DatabaseId: &database.ID,
- TableId: &upsertedTable.ID,
+ DatabaseID: &database.ID,
+ TableID: &upsertedTable.ID,
Name: &column.Name,
}
_, err := s.ColumnService.FindColumn(ctx, columnFind)
if err != nil {
if common.ErrorCode(err) == common.NotFound {
columnCreate := &api.ColumnCreate{
- CreatorId: api.SYSTEM_BOT_ID,
- DatabaseId: database.ID,
- TableId: upsertedTable.ID,
+ CreatorID: api.SYSTEM_BOT_ID,
+ DatabaseID: database.ID,
+ TableID: upsertedTable.ID,
Name: column.Name,
Position: column.Position,
Default: column.Default,
@@ -229,8 +229,8 @@ func (s *Server) SyncEngineVersionAndSchema(ctx context.Context, instance *api.I
// Index
for _, index := range table.IndexList {
indexFind := &api.IndexFind{
- DatabaseId: &database.ID,
- TableId: &upsertedTable.ID,
+ DatabaseID: &database.ID,
+ TableID: &upsertedTable.ID,
Name: &index.Name,
Expression: &index.Expression,
}
@@ -238,9 +238,9 @@ func (s *Server) SyncEngineVersionAndSchema(ctx context.Context, instance *api.I
if err != nil {
if common.ErrorCode(err) == common.NotFound {
indexCreate := &api.IndexCreate{
- CreatorId: api.SYSTEM_BOT_ID,
- DatabaseId: database.ID,
- TableId: upsertedTable.ID,
+ CreatorID: api.SYSTEM_BOT_ID,
+ DatabaseID: database.ID,
+ TableID: upsertedTable.ID,
Name: index.Name,
Expression: index.Expression,
Position: index.Position,
@@ -263,10 +263,10 @@ func (s *Server) SyncEngineVersionAndSchema(ctx context.Context, instance *api.I
var recreateViewSchema = func(database *api.Database, view db.DBView) error {
// View
viewCreate := &api.ViewCreate{
- CreatorId: api.SYSTEM_BOT_ID,
+ CreatorID: api.SYSTEM_BOT_ID,
CreatedTs: view.CreatedTs,
UpdatedTs: view.UpdatedTs,
- DatabaseId: database.ID,
+ DatabaseID: database.ID,
Name: view.Name,
Definition: view.Definition,
Comment: view.Comment,
@@ -279,7 +279,7 @@ func (s *Server) SyncEngineVersionAndSchema(ctx context.Context, instance *api.I
}
instanceUserFind := &api.InstanceUserFind{
- InstanceId: instance.ID,
+ InstanceID: instance.ID,
}
instanceUserList, err := s.InstanceUserService.FindInstanceUserList(ctx, instanceUserFind)
if err != nil {
@@ -289,8 +289,8 @@ func (s *Server) SyncEngineVersionAndSchema(ctx context.Context, instance *api.I
// Upsert user found in the instance
for _, user := range userList {
userUpsert := &api.InstanceUserUpsert{
- CreatorId: api.SYSTEM_BOT_ID,
- InstanceId: instance.ID,
+ CreatorID: api.SYSTEM_BOT_ID,
+ InstanceID: instance.ID,
Name: user.Name,
Grant: user.Grant,
}
@@ -333,7 +333,7 @@ func (s *Server) SyncEngineVersionAndSchema(ctx context.Context, instance *api.I
// we don't reference those objects and they are for information purpose.
databaseFind := &api.DatabaseFind{
- InstanceId: &instance.ID,
+ InstanceID: &instance.ID,
}
dbList, err := s.DatabaseService.FindDatabaseList(ctx, databaseFind)
if err != nil {
@@ -354,7 +354,7 @@ func (s *Server) SyncEngineVersionAndSchema(ctx context.Context, instance *api.I
ts := time.Now().Unix()
databasePatch := &api.DatabasePatch{
ID: matchedDb.ID,
- UpdaterId: api.SYSTEM_BOT_ID,
+ UpdaterID: api.SYSTEM_BOT_ID,
SyncStatus: &syncStatus,
LastSuccessfulSyncTs: &ts,
}
@@ -367,7 +367,7 @@ func (s *Server) SyncEngineVersionAndSchema(ctx context.Context, instance *api.I
}
tableDelete := &api.TableDelete{
- DatabaseId: database.ID,
+ DatabaseID: database.ID,
}
err = s.TableService.DeleteTable(ctx, tableDelete)
if err != nil {
@@ -382,7 +382,7 @@ func (s *Server) SyncEngineVersionAndSchema(ctx context.Context, instance *api.I
}
viewDelete := &api.ViewDelete{
- DatabaseId: database.ID,
+ DatabaseID: database.ID,
}
err = s.ViewService.DeleteView(ctx, viewDelete)
if err != nil {
@@ -398,10 +398,10 @@ func (s *Server) SyncEngineVersionAndSchema(ctx context.Context, instance *api.I
} else {
// Case 2, only appear in the synced db schema
databaseCreate := &api.DatabaseCreate{
- CreatorId: api.SYSTEM_BOT_ID,
- ProjectId: api.DEFAULT_PROJECT_ID,
- InstanceId: instance.ID,
- EnvironmentId: instance.EnvironmentId,
+ CreatorID: api.SYSTEM_BOT_ID,
+ ProjectID: api.DEFAULT_PROJECT_ID,
+ InstanceID: instance.ID,
+ EnvironmentID: instance.EnvironmentID,
Name: schema.Name,
CharacterSet: schema.CharacterSet,
Collation: schema.Collation,
@@ -444,7 +444,7 @@ func (s *Server) SyncEngineVersionAndSchema(ctx context.Context, instance *api.I
ts := time.Now().Unix()
databasePatch := &api.DatabasePatch{
ID: db.ID,
- UpdaterId: api.SYSTEM_BOT_ID,
+ UpdaterID: api.SYSTEM_BOT_ID,
SyncStatus: &syncStatus,
LastSuccessfulSyncTs: &ts,
}
diff --git a/server/stage.go b/server/stage.go
index 099a74ad43..7548c4e8aa 100644
--- a/server/stage.go
+++ b/server/stage.go
@@ -6,9 +6,9 @@ import (
"github.com/bytebase/bytebase/api"
)
-func (s *Server) ComposeStageListByPipelineId(ctx context.Context, pipelineId int) ([]*api.Stage, error) {
+func (s *Server) ComposeStageListByPipelineID(ctx context.Context, pipelineID int) ([]*api.Stage, error) {
stageFind := &api.StageFind{
- PipelineId: &pipelineId,
+ PipelineID: &pipelineID,
}
stageList, err := s.StageService.FindStageList(ctx, stageFind)
if err != nil {
@@ -26,22 +26,22 @@ func (s *Server) ComposeStageListByPipelineId(ctx context.Context, pipelineId in
func (s *Server) ComposeStageRelationship(ctx context.Context, stage *api.Stage) error {
var err error
- stage.Creator, err = s.ComposePrincipalById(ctx, stage.CreatorId)
+ stage.Creator, err = s.ComposePrincipalByID(ctx, stage.CreatorID)
if err != nil {
return err
}
- stage.Updater, err = s.ComposePrincipalById(ctx, stage.UpdaterId)
+ stage.Updater, err = s.ComposePrincipalByID(ctx, stage.UpdaterID)
if err != nil {
return err
}
- stage.Environment, err = s.ComposeEnvironmentById(ctx, stage.EnvironmentId)
+ stage.Environment, err = s.ComposeEnvironmentByID(ctx, stage.EnvironmentID)
if err != nil {
return err
}
- stage.TaskList, err = s.ComposeTaskListByPipelineAndStageId(ctx, stage.PipelineId, stage.ID)
+ stage.TaskList, err = s.ComposeTaskListByPipelineAndStageID(ctx, stage.PipelineID, stage.ID)
if err != nil {
return err
}
diff --git a/server/task.go b/server/task.go
index d75f5f6f9d..84d6881063 100644
--- a/server/task.go
+++ b/server/task.go
@@ -27,28 +27,28 @@ var (
)
func (s *Server) registerTaskRoutes(g *echo.Group) {
- g.PATCH("/pipeline/:pipelineId/task/:taskId", func(c echo.Context) error {
+ g.PATCH("/pipeline/:pipelineID/task/:taskID", func(c echo.Context) error {
ctx := context.Background()
- taskId, err := strconv.Atoi(c.Param("taskId"))
+ taskID, err := strconv.Atoi(c.Param("taskID"))
if err != nil {
- return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Task ID is not a number: %s", c.Param("taskId"))).SetInternal(err)
+ return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Task ID is not a number: %s", c.Param("taskID"))).SetInternal(err)
}
taskPatch := &api.TaskPatch{
- ID: taskId,
- UpdaterId: c.Get(GetPrincipalIdContextKey()).(int),
+ ID: taskID,
+ UpdaterID: c.Get(GetPrincipalIDContextKey()).(int),
}
if err := jsonapi.UnmarshalPayload(c.Request().Body, taskPatch); err != nil {
return echo.NewHTTPError(http.StatusBadRequest, "Malformatted update task request").SetInternal(err)
}
taskFind := &api.TaskFind{
- ID: &taskId,
+ ID: &taskID,
}
task, err := s.TaskService.FindTask(ctx, taskFind)
if err != nil {
if common.ErrorCode(err) == common.NotFound {
- return echo.NewHTTPError(http.StatusUnauthorized, fmt.Sprintf("Task ID not found: %d", taskId))
+ return echo.NewHTTPError(http.StatusUnauthorized, fmt.Sprintf("Task ID not found: %d", taskID))
}
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to update task").SetInternal(err)
}
@@ -99,8 +99,8 @@ func (s *Server) registerTaskRoutes(g *echo.Group) {
return echo.NewHTTPError(http.StatusInternalServerError, fmt.Errorf("failed to marshal statement advise payload: %v, err: %w", task.Name, err))
}
_, err = s.TaskCheckRunService.CreateTaskCheckRunIfNeeded(ctx, &api.TaskCheckRunCreate{
- CreatorId: api.SYSTEM_BOT_ID,
- TaskId: task.ID,
+ CreatorID: api.SYSTEM_BOT_ID,
+ TaskID: task.ID,
Type: api.TaskCheckDatabaseStatementSyntax,
Payload: string(payload),
SkipIfAlreadyTerminated: false,
@@ -115,8 +115,8 @@ func (s *Server) registerTaskRoutes(g *echo.Group) {
}
_, err = s.TaskCheckRunService.CreateTaskCheckRunIfNeeded(ctx, &api.TaskCheckRunCreate{
- CreatorId: api.SYSTEM_BOT_ID,
- TaskId: task.ID,
+ CreatorID: api.SYSTEM_BOT_ID,
+ TaskID: task.ID,
Type: api.TaskCheckDatabaseStatementCompatibility,
Payload: string(payload),
SkipIfAlreadyTerminated: false,
@@ -139,28 +139,28 @@ func (s *Server) registerTaskRoutes(g *echo.Group) {
return nil
})
- g.PATCH("/pipeline/:pipelineId/task/:taskId/status", func(c echo.Context) error {
+ g.PATCH("/pipeline/:pipelineID/task/:taskID/status", func(c echo.Context) error {
ctx := context.Background()
- taskId, err := strconv.Atoi(c.Param("taskId"))
+ taskID, err := strconv.Atoi(c.Param("taskID"))
if err != nil {
- return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Task ID is not a number: %s", c.Param("taskId"))).SetInternal(err)
+ return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Task ID is not a number: %s", c.Param("taskID"))).SetInternal(err)
}
taskStatusPatch := &api.TaskStatusPatch{
- ID: taskId,
- UpdaterId: c.Get(GetPrincipalIdContextKey()).(int),
+ ID: taskID,
+ UpdaterID: c.Get(GetPrincipalIDContextKey()).(int),
}
if err := jsonapi.UnmarshalPayload(c.Request().Body, taskStatusPatch); err != nil {
return echo.NewHTTPError(http.StatusBadRequest, "Malformatted update task status request").SetInternal(err)
}
taskFind := &api.TaskFind{
- ID: &taskId,
+ ID: &taskID,
}
task, err := s.TaskService.FindTask(ctx, taskFind)
if err != nil {
if common.ErrorCode(err) == common.NotFound {
- return echo.NewHTTPError(http.StatusUnauthorized, fmt.Sprintf("Task ID not found: %d", taskId))
+ return echo.NewHTTPError(http.StatusUnauthorized, fmt.Sprintf("Task ID not found: %d", taskID))
}
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to update task status").SetInternal(err)
}
@@ -184,26 +184,26 @@ func (s *Server) registerTaskRoutes(g *echo.Group) {
return nil
})
- g.POST("/pipeline/:pipelineId/task/:taskId/check", func(c echo.Context) error {
+ g.POST("/pipeline/:pipelineID/task/:taskID/check", func(c echo.Context) error {
ctx := context.Background()
- taskId, err := strconv.Atoi(c.Param("taskId"))
+ taskID, err := strconv.Atoi(c.Param("taskID"))
if err != nil {
- return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Task ID is not a number: %s", c.Param("taskId"))).SetInternal(err)
+ return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Task ID is not a number: %s", c.Param("taskID"))).SetInternal(err)
}
taskFind := &api.TaskFind{
- ID: &taskId,
+ ID: &taskID,
}
task, err := s.TaskService.FindTask(ctx, taskFind)
if err != nil {
if common.ErrorCode(err) == common.NotFound {
- return echo.NewHTTPError(http.StatusUnauthorized, fmt.Sprintf("Task ID not found: %d", taskId))
+ return echo.NewHTTPError(http.StatusUnauthorized, fmt.Sprintf("Task ID not found: %d", taskID))
}
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to update task status").SetInternal(err)
}
skipIfAlreadyTerminated := false
- updatedTask, err := s.TaskCheckScheduler.ScheduleCheckIfNeeded(ctx, task, c.Get(GetPrincipalIdContextKey()).(int), skipIfAlreadyTerminated)
+ updatedTask, err := s.TaskCheckScheduler.ScheduleCheckIfNeeded(ctx, task, c.Get(GetPrincipalIDContextKey()).(int), skipIfAlreadyTerminated)
if err != nil {
return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to run task check \"%v\"", task.Name)).SetInternal(err)
@@ -221,10 +221,10 @@ func (s *Server) registerTaskRoutes(g *echo.Group) {
})
}
-func (s *Server) ComposeTaskListByPipelineAndStageId(ctx context.Context, pipelineId int, stageId int) ([]*api.Task, error) {
+func (s *Server) ComposeTaskListByPipelineAndStageID(ctx context.Context, pipelineID int, stageID int) ([]*api.Task, error) {
taskFind := &api.TaskFind{
- PipelineId: &pipelineId,
- StageId: &stageId,
+ PipelineID: &pipelineID,
+ StageID: &stageID,
}
taskList, err := s.TaskService.FindTaskList(ctx, taskFind)
if err != nil {
@@ -240,7 +240,7 @@ func (s *Server) ComposeTaskListByPipelineAndStageId(ctx context.Context, pipeli
return taskList, nil
}
-func (s *Server) ComposeTaskById(ctx context.Context, id int) (*api.Task, error) {
+func (s *Server) ComposeTaskByID(ctx context.Context, id int) (*api.Task, error) {
taskFind := &api.TaskFind{
ID: &id,
}
@@ -259,48 +259,48 @@ func (s *Server) ComposeTaskById(ctx context.Context, id int) (*api.Task, error)
func (s *Server) ComposeTaskRelationship(ctx context.Context, task *api.Task) error {
var err error
- task.Creator, err = s.ComposePrincipalById(ctx, task.CreatorId)
+ task.Creator, err = s.ComposePrincipalByID(ctx, task.CreatorID)
if err != nil {
return err
}
- task.Updater, err = s.ComposePrincipalById(ctx, task.UpdaterId)
+ task.Updater, err = s.ComposePrincipalByID(ctx, task.UpdaterID)
if err != nil {
return err
}
for _, taskRun := range task.TaskRunList {
- taskRun.Creator, err = s.ComposePrincipalById(ctx, taskRun.CreatorId)
+ taskRun.Creator, err = s.ComposePrincipalByID(ctx, taskRun.CreatorID)
if err != nil {
return err
}
- taskRun.Updater, err = s.ComposePrincipalById(ctx, taskRun.UpdaterId)
+ taskRun.Updater, err = s.ComposePrincipalByID(ctx, taskRun.UpdaterID)
if err != nil {
return err
}
}
for _, taskCheckRun := range task.TaskCheckRunList {
- taskCheckRun.Creator, err = s.ComposePrincipalById(ctx, taskCheckRun.CreatorId)
+ taskCheckRun.Creator, err = s.ComposePrincipalByID(ctx, taskCheckRun.CreatorID)
if err != nil {
return err
}
- taskCheckRun.Updater, err = s.ComposePrincipalById(ctx, taskCheckRun.UpdaterId)
+ taskCheckRun.Updater, err = s.ComposePrincipalByID(ctx, taskCheckRun.UpdaterID)
if err != nil {
return err
}
}
- task.Instance, err = s.ComposeInstanceById(ctx, task.InstanceId)
+ task.Instance, err = s.ComposeInstanceByID(ctx, task.InstanceID)
if err != nil {
return err
}
- if task.DatabaseId != nil {
+ if task.DatabaseID != nil {
databaseFind := &api.DatabaseFind{
- ID: task.DatabaseId,
+ ID: task.DatabaseID,
}
task.Database, err = s.ComposeDatabaseByFind(ctx, databaseFind)
if err != nil {
@@ -311,10 +311,10 @@ func (s *Server) ComposeTaskRelationship(ctx context.Context, task *api.Task) er
return nil
}
-func (s *Server) ChangeTaskStatus(ctx context.Context, task *api.Task, newStatus api.TaskStatus, updaterId int) (*api.Task, error) {
+func (s *Server) ChangeTaskStatus(ctx context.Context, task *api.Task, newStatus api.TaskStatus, updaterID int) (*api.Task, error) {
taskStatusPatch := &api.TaskStatusPatch{
ID: task.ID,
- UpdaterId: updaterId,
+ UpdaterID: updaterID,
Status: newStatus,
}
return s.ChangeTaskStatusWithPatch(ctx, task, taskStatusPatch)
@@ -354,7 +354,7 @@ func (s *Server) ChangeTaskStatusWithPatch(ctx context.Context, task *api.Task,
// behaves differently depending on whether the task is wrapped in an issue.
// TODO(tianzhou): Refactor the followup code into chained onTaskStatusChange hook.
issueFind := &api.IssueFind{
- PipelineId: &task.PipelineId,
+ PipelineID: &task.PipelineID,
}
issue, err := s.IssueService.FindIssue(ctx, issueFind)
if err != nil {
@@ -370,7 +370,7 @@ func (s *Server) ChangeTaskStatusWithPatch(ctx context.Context, task *api.Task,
issueName = issue.Name
}
payload, err := json.Marshal(api.ActivityPipelineTaskStatusUpdatePayload{
- TaskId: task.ID,
+ TaskID: task.ID,
OldStatus: task.Status,
NewStatus: updatedTask.Status,
IssueName: issueName,
@@ -380,17 +380,17 @@ func (s *Server) ChangeTaskStatusWithPatch(ctx context.Context, task *api.Task,
return nil, fmt.Errorf("failed to marshal activity after changing the task status: %v, err: %w", task.Name, err)
}
- containerId := task.PipelineId
+ containerID := task.PipelineID
if issue != nil {
- containerId = issue.ID
+ containerID = issue.ID
}
level := api.ACTIVITY_INFO
if updatedTask.Status == api.TaskFailed {
level = api.ACTIVITY_ERROR
}
activityCreate := &api.ActivityCreate{
- CreatorId: taskStatusPatch.UpdaterId,
- ContainerId: containerId,
+ CreatorID: taskStatusPatch.UpdaterID,
+ ContainerID: containerID,
Type: api.ActivityPipelineTaskStatusUpdate,
Level: level,
Payload: string(payload),
@@ -435,16 +435,16 @@ func (s *Server) ChangeTaskStatusWithPatch(ctx context.Context, task *api.Task,
}
instance, err := s.InstanceService.FindInstance(ctx, &api.InstanceFind{
- ID: &task.InstanceId,
+ ID: &task.InstanceID,
})
if err != nil {
- return nil, fmt.Errorf("invalid instance ID: %v", task.InstanceId)
+ return nil, fmt.Errorf("invalid instance ID: %v", task.InstanceID)
}
databaseCreate := &api.DatabaseCreate{
- CreatorId: taskStatusPatch.UpdaterId,
- ProjectId: payload.ProjectId,
- InstanceId: task.InstanceId,
- EnvironmentId: instance.EnvironmentId,
+ CreatorID: taskStatusPatch.UpdaterID,
+ ProjectID: payload.ProjectID,
+ InstanceID: task.InstanceID,
+ EnvironmentID: instance.EnvironmentID,
Name: payload.DatabaseName,
CharacterSet: payload.CharacterSet,
Collation: payload.Collation,
@@ -455,8 +455,8 @@ func (s *Server) ChangeTaskStatusWithPatch(ctx context.Context, task *api.Task,
// Though the db will be assigned to the default project instead of the desired project in that case.
s.l.Error("failed to record database after creating database",
zap.String("database_name", payload.DatabaseName),
- zap.Int("project_id", payload.ProjectId),
- zap.Int("instance_id", task.InstanceId),
+ zap.Int("project_id", payload.ProjectID),
+ zap.Int("instance_id", task.InstanceID),
zap.Error(err),
)
}
@@ -465,7 +465,7 @@ func (s *Server) ChangeTaskStatusWithPatch(ctx context.Context, task *api.Task,
// If create database or schema update task completes, we sync the corresponding instance schema immediately.
if (updatedTask.Type == api.TaskDatabaseCreate || updatedTask.Type == api.TaskDatabaseSchemaUpdate) &&
updatedTask.Status == api.TaskDone {
- instance, err := s.ComposeInstanceById(ctx, task.InstanceId)
+ instance, err := s.ComposeInstanceByID(ctx, task.InstanceID)
if err != nil {
return nil, fmt.Errorf("failed to sync instance schema after completing task: %w", err)
}
@@ -475,8 +475,8 @@ func (s *Server) ChangeTaskStatusWithPatch(ctx context.Context, task *api.Task,
// If this is the last task in the pipeline and just completed, and the assignee is system bot:
// Case 1: If the task is associated with an issue, then we mark the issue (including the pipeline) as DONE.
// Case 2: If the task is NOT associated with an issue, then we mark the pipeline as DONE.
- if updatedTask.Status == "DONE" && (issue == nil || issue.AssigneeId == api.SYSTEM_BOT_ID) {
- pipeline, err := s.ComposePipelineById(ctx, updatedTask.PipelineId)
+ if updatedTask.Status == "DONE" && (issue == nil || issue.AssigneeID == api.SYSTEM_BOT_ID) {
+ pipeline, err := s.ComposePipelineByID(ctx, updatedTask.PipelineID)
if err != nil {
return nil, fmt.Errorf("failed to fetch pipeline/issue as DONE after completing task %v", updatedTask.Name)
}
@@ -486,7 +486,7 @@ func (s *Server) ChangeTaskStatusWithPatch(ctx context.Context, task *api.Task,
status := api.Pipeline_Done
pipelinePatch := &api.PipelinePatch{
ID: pipeline.ID,
- UpdaterId: taskStatusPatch.UpdaterId,
+ UpdaterID: taskStatusPatch.UpdaterID,
Status: &status,
}
if _, err := s.PipelineService.PatchPipeline(ctx, pipelinePatch); err != nil {
@@ -494,7 +494,7 @@ func (s *Server) ChangeTaskStatusWithPatch(ctx context.Context, task *api.Task,
}
} else {
issue.Pipeline = pipeline
- _, err := s.ChangeIssueStatus(ctx, issue, api.Issue_Done, taskStatusPatch.UpdaterId, "")
+ _, err := s.ChangeIssueStatus(ctx, issue, api.Issue_Done, taskStatusPatch.UpdaterID, "")
if err != nil {
return nil, fmt.Errorf("failed to mark issue %v as DONE after completing task %v: %w", issue.Name, updatedTask.Name, err)
}
diff --git a/server/task_check_executor_database_connect.go b/server/task_check_executor_database_connect.go
index 254f5b94f4..dcae943fb1 100644
--- a/server/task_check_executor_database_connect.go
+++ b/server/task_check_executor_database_connect.go
@@ -21,7 +21,7 @@ type TaskCheckDatabaseConnectExecutor struct {
func (exec *TaskCheckDatabaseConnectExecutor) Run(ctx context.Context, server *Server, taskCheckRun *api.TaskCheckRun) (result []api.TaskCheckResult, err error) {
taskFind := &api.TaskFind{
- ID: &taskCheckRun.TaskId,
+ ID: &taskCheckRun.TaskID,
}
task, err := server.TaskService.FindTask(ctx, taskFind)
if err != nil {
@@ -29,7 +29,7 @@ func (exec *TaskCheckDatabaseConnectExecutor) Run(ctx context.Context, server *S
}
databaseFind := &api.DatabaseFind{
- ID: task.DatabaseId,
+ ID: task.DatabaseID,
}
database, err := server.ComposeDatabaseByFind(ctx, databaseFind)
if err != nil {
diff --git a/server/task_check_executor_migration_schema.go b/server/task_check_executor_migration_schema.go
index 1331c8d295..85176a70b7 100644
--- a/server/task_check_executor_migration_schema.go
+++ b/server/task_check_executor_migration_schema.go
@@ -21,14 +21,14 @@ type TaskCheckMigrationSchemaExecutor struct {
func (exec *TaskCheckMigrationSchemaExecutor) Run(ctx context.Context, server *Server, taskCheckRun *api.TaskCheckRun) (result []api.TaskCheckResult, err error) {
taskFind := &api.TaskFind{
- ID: &taskCheckRun.TaskId,
+ ID: &taskCheckRun.TaskID,
}
task, err := server.TaskService.FindTask(ctx, taskFind)
if err != nil {
return []api.TaskCheckResult{}, common.Errorf(common.Internal, err)
}
- instance, err := server.ComposeInstanceById(ctx, task.InstanceId)
+ instance, err := server.ComposeInstanceByID(ctx, task.InstanceID)
if err != nil {
return []api.TaskCheckResult{}, err
}
diff --git a/server/task_check_scheduler.go b/server/task_check_scheduler.go
index 0d41283be2..990cf150f2 100644
--- a/server/task_check_scheduler.go
+++ b/server/task_check_scheduler.go
@@ -67,7 +67,7 @@ func (s *TaskCheckScheduler) Run() error {
if !ok {
s.l.Error("Skip running task check run with unknown type",
zap.Int("id", taskCheckRun.ID),
- zap.Int("task_id", taskCheckRun.TaskId),
+ zap.Int("task_id", taskCheckRun.TaskID),
zap.String("type", string(taskCheckRun.Type)),
)
continue
@@ -96,7 +96,7 @@ func (s *TaskCheckScheduler) Run() error {
if err != nil {
s.l.Error("Failed to marshal task check run result",
zap.Int("id", taskCheckRun.ID),
- zap.Int("task_id", taskCheckRun.TaskId),
+ zap.Int("task_id", taskCheckRun.TaskID),
zap.String("type", string(taskCheckRun.Type)),
zap.Error(err),
)
@@ -105,7 +105,7 @@ func (s *TaskCheckScheduler) Run() error {
taskCheckRunStatusPatch := &api.TaskCheckRunStatusPatch{
ID: &taskCheckRun.ID,
- UpdaterId: api.SYSTEM_BOT_ID,
+ UpdaterID: api.SYSTEM_BOT_ID,
Status: api.TaskCheckRunDone,
Code: common.Ok,
Result: string(bytes),
@@ -114,7 +114,7 @@ func (s *TaskCheckScheduler) Run() error {
if err != nil {
s.l.Error("Failed to mark task check run as DONE",
zap.Int("id", taskCheckRun.ID),
- zap.Int("task_id", taskCheckRun.TaskId),
+ zap.Int("task_id", taskCheckRun.TaskID),
zap.String("type", string(taskCheckRun.Type)),
zap.Error(err),
)
@@ -122,7 +122,7 @@ func (s *TaskCheckScheduler) Run() error {
} else {
s.l.Debug("Failed to run task check",
zap.Int("id", taskCheckRun.ID),
- zap.Int("task_id", taskCheckRun.TaskId),
+ zap.Int("task_id", taskCheckRun.TaskID),
zap.String("type", string(taskCheckRun.Type)),
zap.Error(err),
)
@@ -132,7 +132,7 @@ func (s *TaskCheckScheduler) Run() error {
if marshalErr != nil {
s.l.Error("Failed to marshal task check run result",
zap.Int("id", taskCheckRun.ID),
- zap.Int("task_id", taskCheckRun.TaskId),
+ zap.Int("task_id", taskCheckRun.TaskID),
zap.String("type", string(taskCheckRun.Type)),
zap.Error(marshalErr),
)
@@ -141,7 +141,7 @@ func (s *TaskCheckScheduler) Run() error {
taskCheckRunStatusPatch := &api.TaskCheckRunStatusPatch{
ID: &taskCheckRun.ID,
- UpdaterId: api.SYSTEM_BOT_ID,
+ UpdaterID: api.SYSTEM_BOT_ID,
Status: api.TaskCheckRunFailed,
Code: common.ErrorCode(err),
Result: string(bytes),
@@ -150,7 +150,7 @@ func (s *TaskCheckScheduler) Run() error {
if err != nil {
s.l.Error("Failed to mark task check run as FAILED",
zap.Int("id", taskCheckRun.ID),
- zap.Int("task_id", taskCheckRun.TaskId),
+ zap.Int("task_id", taskCheckRun.TaskID),
zap.String("type", string(taskCheckRun.Type)),
zap.Error(err),
)
@@ -177,7 +177,7 @@ func (s *TaskCheckScheduler) Register(taskType string, executor TaskCheckExecuto
s.executors[taskType] = executor
}
-func (s *TaskCheckScheduler) ScheduleCheckIfNeeded(ctx context.Context, task *api.Task, creatorId int, skipIfAlreadyTerminated bool) (*api.Task, error) {
+func (s *TaskCheckScheduler) ScheduleCheckIfNeeded(ctx context.Context, task *api.Task, creatorID int, skipIfAlreadyTerminated bool) (*api.Task, error) {
if task.Type == api.TaskDatabaseSchemaUpdate {
taskPayload := &api.TaskDatabaseSchemaUpdatePayload{}
if err := json.Unmarshal([]byte(task.Payload), taskPayload); err != nil {
@@ -185,7 +185,7 @@ func (s *TaskCheckScheduler) ScheduleCheckIfNeeded(ctx context.Context, task *ap
}
databaseFind := &api.DatabaseFind{
- ID: task.DatabaseId,
+ ID: task.DatabaseID,
}
database, err := s.server.ComposeDatabaseByFind(ctx, databaseFind)
if err != nil {
@@ -193,8 +193,8 @@ func (s *TaskCheckScheduler) ScheduleCheckIfNeeded(ctx context.Context, task *ap
}
_, err = s.server.TaskCheckRunService.CreateTaskCheckRunIfNeeded(ctx, &api.TaskCheckRunCreate{
- CreatorId: creatorId,
- TaskId: task.ID,
+ CreatorID: creatorID,
+ TaskID: task.ID,
Type: api.TaskCheckDatabaseConnect,
SkipIfAlreadyTerminated: skipIfAlreadyTerminated,
})
@@ -203,8 +203,8 @@ func (s *TaskCheckScheduler) ScheduleCheckIfNeeded(ctx context.Context, task *ap
}
_, err = s.server.TaskCheckRunService.CreateTaskCheckRunIfNeeded(ctx, &api.TaskCheckRunCreate{
- CreatorId: creatorId,
- TaskId: task.ID,
+ CreatorID: creatorID,
+ TaskID: task.ID,
Type: api.TaskCheckInstanceMigrationSchema,
SkipIfAlreadyTerminated: skipIfAlreadyTerminated,
})
@@ -224,8 +224,8 @@ func (s *TaskCheckScheduler) ScheduleCheckIfNeeded(ctx context.Context, task *ap
return nil, fmt.Errorf("failed to marshal statement advise payload: %v, err: %w", task.Name, err)
}
_, err = s.server.TaskCheckRunService.CreateTaskCheckRunIfNeeded(ctx, &api.TaskCheckRunCreate{
- CreatorId: creatorId,
- TaskId: task.ID,
+ CreatorID: creatorID,
+ TaskID: task.ID,
Type: api.TaskCheckDatabaseStatementSyntax,
Payload: string(payload),
SkipIfAlreadyTerminated: skipIfAlreadyTerminated,
@@ -235,8 +235,8 @@ func (s *TaskCheckScheduler) ScheduleCheckIfNeeded(ctx context.Context, task *ap
}
_, err = s.server.TaskCheckRunService.CreateTaskCheckRunIfNeeded(ctx, &api.TaskCheckRunCreate{
- CreatorId: creatorId,
- TaskId: task.ID,
+ CreatorID: creatorID,
+ TaskID: task.ID,
Type: api.TaskCheckDatabaseStatementCompatibility,
Payload: string(payload),
SkipIfAlreadyTerminated: skipIfAlreadyTerminated,
@@ -247,7 +247,7 @@ func (s *TaskCheckScheduler) ScheduleCheckIfNeeded(ctx context.Context, task *ap
}
taskCheckRunFind := &api.TaskCheckRunFind{
- TaskId: &task.ID,
+ TaskID: &task.ID,
}
task.TaskCheckRunList, err = s.server.TaskCheckRunService.FindTaskCheckRunList(ctx, taskCheckRunFind)
if err != nil {
diff --git a/server/task_executor.go b/server/task_executor.go
index d94d207789..c99b8affb3 100644
--- a/server/task_executor.go
+++ b/server/task_executor.go
@@ -22,6 +22,6 @@ type TaskExecutor interface {
// defaultMigrationVersion returns the default migration version string
// Use the concatenation of current time and the task id to guarantee uniqueness in a monotonic increasing way.
-func defaultMigrationVersionFromTaskId(taskId int) string {
- return strings.Join([]string{time.Now().Format("20060102150405"), strconv.Itoa(taskId)}, ".")
+func defaultMigrationVersionFromTaskID(taskID int) string {
+ return strings.Join([]string{time.Now().Format("20060102150405"), strconv.Itoa(taskID)}, ".")
}
diff --git a/server/task_executor_database_backup.go b/server/task_executor_database_backup.go
index aaaaf6363f..8be3b4a73f 100644
--- a/server/task_executor_database_backup.go
+++ b/server/task_executor_database_backup.go
@@ -47,7 +47,7 @@ func (exec *DatabaseBackupTaskExecutor) RunOnce(ctx context.Context, server *Ser
return true, nil, err
}
- backup, err := server.BackupService.FindBackup(ctx, &api.BackupFind{ID: &payload.BackupId})
+ backup, err := server.BackupService.FindBackup(ctx, &api.BackupFind{ID: &payload.BackupID})
if err != nil {
return true, nil, fmt.Errorf("failed to find backup: %w", err)
}
@@ -68,7 +68,7 @@ func (exec *DatabaseBackupTaskExecutor) RunOnce(ctx context.Context, server *Ser
if _, err = server.BackupService.PatchBackup(ctx, &api.BackupPatch{
ID: backup.ID,
Status: newBackupStatus,
- UpdaterId: api.SYSTEM_BOT_ID,
+ UpdaterID: api.SYSTEM_BOT_ID,
Comment: comment,
}); err != nil {
return true, nil, fmt.Errorf("failed to patch backup: %w", err)
diff --git a/server/task_executor_database_create.go b/server/task_executor_database_create.go
index b6e40a7079..80bec1ca62 100644
--- a/server/task_executor_database_create.go
+++ b/server/task_executor_database_create.go
@@ -65,7 +65,7 @@ func (exec *DatabaseCreateTaskExecutor) RunOnce(ctx context.Context, server *Ser
// Create a baseline migration history upon creating the database.
mi := &db.MigrationInfo{
ReleaseVersion: server.version,
- Version: defaultMigrationVersionFromTaskId(task.ID),
+ Version: defaultMigrationVersionFromTaskID(task.ID),
Namespace: payload.DatabaseName,
Database: payload.DatabaseName,
Environment: instance.Environment.Name,
@@ -74,7 +74,7 @@ func (exec *DatabaseCreateTaskExecutor) RunOnce(ctx context.Context, server *Ser
Description: "Create database",
CreateDatabase: true,
}
- creator, err := server.ComposePrincipalById(ctx, task.CreatorId)
+ creator, err := server.ComposePrincipalByID(ctx, task.CreatorID)
if err != nil {
// If somehow we unable to find the principal, we just emit the error since it's not
// critical enough to fail the entire operation.
@@ -87,7 +87,7 @@ func (exec *DatabaseCreateTaskExecutor) RunOnce(ctx context.Context, server *Ser
}
issueFind := &api.IssueFind{
- PipelineId: &task.PipelineId,
+ PipelineID: &task.PipelineID,
}
issue, err := server.IssueService.FindIssue(ctx, issueFind)
if err != nil {
@@ -98,17 +98,17 @@ func (exec *DatabaseCreateTaskExecutor) RunOnce(ctx context.Context, server *Ser
zap.Error(err),
)
} else {
- mi.IssueId = strconv.Itoa(issue.ID)
+ mi.IssueID = strconv.Itoa(issue.ID)
}
- migrationId, _, err := driver.ExecuteMigration(ctx, mi, statement)
+ migrationID, _, err := driver.ExecuteMigration(ctx, mi, statement)
if err != nil {
return true, nil, err
}
return true, &api.TaskRunResultPayload{
Detail: fmt.Sprintf("Created database %q", payload.DatabaseName),
- MigrationId: migrationId,
+ MigrationID: migrationID,
Version: mi.Version,
}, nil
}
diff --git a/server/task_executor_database_restore.go b/server/task_executor_database_restore.go
index 6290a48ff5..0e6a019493 100644
--- a/server/task_executor_database_restore.go
+++ b/server/task_executor_database_restore.go
@@ -50,13 +50,13 @@ func (exec *DatabaseRestoreTaskExecutor) RunOnce(ctx context.Context, server *Se
return true, nil, err
}
- backup, err := server.BackupService.FindBackup(ctx, &api.BackupFind{ID: &payload.BackupId})
+ backup, err := server.BackupService.FindBackup(ctx, &api.BackupFind{ID: &payload.BackupID})
if err != nil {
return true, nil, fmt.Errorf("failed to find backup: %w", err)
}
sourceDatabaseFind := &api.DatabaseFind{
- ID: &backup.DatabaseId,
+ ID: &backup.DatabaseID,
}
sourceDatabase, err := server.ComposeDatabaseByFind(ctx, sourceDatabaseFind)
if err != nil {
@@ -64,7 +64,7 @@ func (exec *DatabaseRestoreTaskExecutor) RunOnce(ctx context.Context, server *Se
}
targetDatabaseFind := &api.DatabaseFind{
- InstanceId: &task.InstanceId,
+ InstanceID: &task.InstanceID,
Name: &payload.DatabaseName,
}
targetDatabase, err := server.ComposeDatabaseByFind(ctx, targetDatabaseFind)
@@ -90,7 +90,7 @@ func (exec *DatabaseRestoreTaskExecutor) RunOnce(ctx context.Context, server *Se
// TODO(tianzhou): This should be done in the same transaction as restoreDatabase to guarantee consistency.
// For now, we do this after restoreDatabase, since this one is unlikely to fail.
- migrationId, version, err := createBranchMigrationHistory(ctx, server, sourceDatabase, targetDatabase, backup, task, exec.l)
+ migrationID, version, err := createBranchMigrationHistory(ctx, server, sourceDatabase, targetDatabase, backup, task, exec.l)
if err != nil {
return true, nil, err
}
@@ -101,8 +101,8 @@ func (exec *DatabaseRestoreTaskExecutor) RunOnce(ctx context.Context, server *Se
// inconsistent data. We choose to do Patch afterwards since this one is unlikely to fail.
databasePatch := &api.DatabasePatch{
ID: targetDatabase.ID,
- UpdaterId: api.SYSTEM_BOT_ID,
- SourceBackupId: &backup.ID,
+ UpdaterID: api.SYSTEM_BOT_ID,
+ SourceBackupID: &backup.ID,
}
if _, err = server.DatabaseService.PatchDatabase(ctx, databasePatch); err != nil {
return true, nil, fmt.Errorf("failed to patch database source backup ID after restore: %w", err)
@@ -113,7 +113,7 @@ func (exec *DatabaseRestoreTaskExecutor) RunOnce(ctx context.Context, server *Se
return true, &api.TaskRunResultPayload{
Detail: fmt.Sprintf("Restored database %q from backup %q", targetDatabase.Name, backup.Name),
- MigrationId: migrationId,
+ MigrationID: migrationID,
Version: version,
}, nil
}
@@ -156,7 +156,7 @@ func createBranchMigrationHistory(ctx context.Context, server *Server, sourceDat
defer targetDriver.Close(ctx)
issueFind := &api.IssueFind{
- PipelineId: &task.PipelineId,
+ PipelineID: &task.PipelineID,
}
issue, err := server.IssueService.FindIssue(ctx, issueFind)
if err != nil {
@@ -167,17 +167,17 @@ func createBranchMigrationHistory(ctx context.Context, server *Server, sourceDat
}
// Add a branch migration history record.
- issueId := ""
+ issueID := ""
if issue != nil {
- issueId = strconv.Itoa(issue.ID)
+ issueID = strconv.Itoa(issue.ID)
}
description := fmt.Sprintf("Restored from backup %q of database %q.", backup.Name, sourceDatabase.Name)
- if sourceDatabase.InstanceId != targetDatabase.InstanceId {
+ if sourceDatabase.InstanceID != targetDatabase.InstanceID {
description = fmt.Sprintf("Restored from backup %q of database %q in instance %q.", backup.Name, sourceDatabase.Name, sourceDatabase.Instance.Name)
}
m := &db.MigrationInfo{
ReleaseVersion: server.version,
- Version: defaultMigrationVersionFromTaskId(task.ID),
+ Version: defaultMigrationVersionFromTaskID(task.ID),
Namespace: targetDatabase.Name,
Database: targetDatabase.Name,
Environment: targetDatabase.Instance.Environment.Name,
@@ -185,12 +185,12 @@ func createBranchMigrationHistory(ctx context.Context, server *Server, sourceDat
Type: db.Branch,
Description: description,
Creator: task.Creator.Name,
- IssueId: issueId,
+ IssueID: issueID,
Payload: "",
}
- migrationId, _, err := targetDriver.ExecuteMigration(ctx, m, "")
+ migrationID, _, err := targetDriver.ExecuteMigration(ctx, m, "")
if err != nil {
return -1, "", fmt.Errorf("failed to create migration history: %w", err)
}
- return migrationId, m.Version, nil
+ return migrationID, m.Version, nil
}
diff --git a/server/task_executor_schema_update.go b/server/task_executor_schema_update.go
index 4f48958f47..9002017d34 100644
--- a/server/task_executor_schema_update.go
+++ b/server/task_executor_schema_update.go
@@ -57,7 +57,7 @@ func (exec *SchemaUpdateTaskExecutor) RunOnce(ctx context.Context, server *Serve
}
if payload.VCSPushEvent == nil {
mi.Engine = db.UI
- creator, err := server.ComposePrincipalById(ctx, task.CreatorId)
+ creator, err := server.ComposePrincipalByID(ctx, task.CreatorID)
if err != nil {
// If somehow we unable to find the principal, we just emit the error since it's not
// critical enough to fail the entire operation.
@@ -68,13 +68,13 @@ func (exec *SchemaUpdateTaskExecutor) RunOnce(ctx context.Context, server *Serve
} else {
mi.Creator = creator.Name
}
- mi.Version = defaultMigrationVersionFromTaskId(task.ID)
+ mi.Version = defaultMigrationVersionFromTaskID(task.ID)
mi.Database = databaseName
mi.Namespace = databaseName
mi.Description = task.Name
} else {
repositoryFind := &api.RepositoryFind{
- ProjectId: &task.Database.ProjectId,
+ ProjectID: &task.Database.ProjectID,
}
repository, err = server.RepositoryService.FindRepository(ctx, repositoryFind)
if err != nil {
@@ -102,7 +102,7 @@ func (exec *SchemaUpdateTaskExecutor) RunOnce(ctx context.Context, server *Serve
}
issueFind := &api.IssueFind{
- PipelineId: &task.PipelineId,
+ PipelineID: &task.PipelineID,
}
issue, err := server.IssueService.FindIssue(ctx, issueFind)
if err != nil {
@@ -113,7 +113,7 @@ func (exec *SchemaUpdateTaskExecutor) RunOnce(ctx context.Context, server *Serve
zap.Error(err),
)
} else {
- mi.IssueId = strconv.Itoa(issue.ID)
+ mi.IssueID = strconv.Itoa(issue.ID)
}
statement := strings.TrimSpace(payload.Statement)
@@ -148,7 +148,7 @@ func (exec *SchemaUpdateTaskExecutor) RunOnce(ctx context.Context, server *Serve
return true, nil, common.Errorf(common.MigrationSchemaMissing, fmt.Errorf("missing migration schema for instance %q", task.Instance.Name))
}
- migrationId, schema, err := driver.ExecuteMigration(ctx, mi, statement)
+ migrationID, schema, err := driver.ExecuteMigration(ctx, mi, statement)
if err != nil {
return true, nil, err
}
@@ -159,7 +159,7 @@ func (exec *SchemaUpdateTaskExecutor) RunOnce(ctx context.Context, server *Serve
latestSchemaFile = strings.ReplaceAll(latestSchemaFile, "{{ENV_NAME}}", mi.Environment)
latestSchemaFile = strings.ReplaceAll(latestSchemaFile, "{{DB_NAME}}", mi.Database)
- repository.VCS, err = server.ComposeVCSById(ctx, repository.VCSId)
+ repository.VCS, err = server.ComposeVCSByID(ctx, repository.VCSID)
if err != nil {
return true, nil, fmt.Errorf("failed to sync schema file %s after applying migration %s to %q", latestSchemaFile, mi.Version, databaseName)
}
@@ -171,10 +171,10 @@ func (exec *SchemaUpdateTaskExecutor) RunOnce(ctx context.Context, server *Serve
bytebaseURL := ""
if issue != nil {
- bytebaseURL = fmt.Sprintf("%s:%d/issue/%s?stage=%d", server.frontendHost, server.frontendPort, api.IssueSlug(issue), task.StageId)
+ bytebaseURL = fmt.Sprintf("%s:%d/issue/%s?stage=%d", server.frontendHost, server.frontendPort, api.IssueSlug(issue), task.StageID)
}
- commitId, err := writeBackLatestSchema(server, repository, payload.VCSPushEvent, mi, branch, latestSchemaFile, schema, bytebaseURL)
+ commitID, err := writeBackLatestSchema(server, repository, payload.VCSPushEvent, mi, branch, latestSchemaFile, schema, bytebaseURL)
if err != nil {
return true, nil, err
}
@@ -182,12 +182,12 @@ func (exec *SchemaUpdateTaskExecutor) RunOnce(ctx context.Context, server *Serve
// Create file commit activity
{
payload, err := json.Marshal(api.ActivityPipelineTaskFileCommitPayload{
- TaskId: task.ID,
+ TaskID: task.ID,
VCSInstanceURL: repository.VCS.InstanceURL,
RepositoryFullPath: payload.VCSPushEvent.RepositoryFullPath,
Branch: branch,
FilePath: latestSchemaFile,
- CommitId: commitId,
+ CommitID: commitID,
})
if err != nil {
exec.l.Error("Failed to marshal file commit activity after writing back the latest schema",
@@ -198,13 +198,13 @@ func (exec *SchemaUpdateTaskExecutor) RunOnce(ctx context.Context, server *Serve
)
}
- containerId := task.PipelineId
+ containerID := task.PipelineID
if issue != nil {
- containerId = issue.ID
+ containerID = issue.ID
}
activityCreate := &api.ActivityCreate{
- CreatorId: task.CreatorId,
- ContainerId: containerId,
+ CreatorID: task.CreatorID,
+ ContainerID: containerID,
Type: api.ActivityPipelineTaskFileCommit,
Level: api.ACTIVITY_INFO,
Comment: fmt.Sprintf("Committed the latest schema after applying migration version %s to %q.",
@@ -233,7 +233,7 @@ func (exec *SchemaUpdateTaskExecutor) RunOnce(ctx context.Context, server *Serve
return true, &api.TaskRunResultPayload{
Detail: detail,
- MigrationId: migrationId,
+ MigrationID: migrationID,
Version: mi.Version,
}, nil
}
@@ -241,7 +241,7 @@ func (exec *SchemaUpdateTaskExecutor) RunOnce(ctx context.Context, server *Serve
// Writes back the latest schema to the repository after migration
// Returns the commit id on success.
func writeBackLatestSchema(server *Server, repository *api.Repository, pushEvent *common.VCSPushEvent, mi *db.MigrationInfo, branch string, latestSchemaFile string, schema string, bytebaseURL string) (string, error) {
- filePath := fmt.Sprintf("projects/%s/repository/files/%s", repository.ExternalId, url.QueryEscape(latestSchemaFile))
+ filePath := fmt.Sprintf("projects/%s/repository/files/%s", repository.ExternalID, url.QueryEscape(latestSchemaFile))
getFilePath := filePath + "?ref=" + url.QueryEscape(branch)
getResp, err := gitlab.GET(
@@ -308,7 +308,7 @@ func writeBackLatestSchema(server *Server, repository *api.Repository, pushEvent
return "", fmt.Errorf("failed to unmarshal file response %s after applying migration %s to %q", filePath, mi.Version, mi.Database)
}
- schemaFileCommit.LastCommitId = file.LastCommitId
+ schemaFileCommit.LastCommitID = file.LastCommitID
body, err := json.Marshal(schemaFileCommit)
if err != nil {
return "", fmt.Errorf("failed to marshal file request %s after applying migration %s to %q", filePath, mi.Version, mi.Database)
@@ -352,5 +352,5 @@ func writeBackLatestSchema(server *Server, repository *api.Repository, pushEvent
if err := json.NewDecoder(getResp.Body).Decode(file); err != nil {
return "", fmt.Errorf("failed to unmarshal file response %s after update, VCS instance: %s", filePath, repository.VCS.InstanceURL)
}
- return file.LastCommitId, nil
+ return file.LastCommitID, nil
}
diff --git a/server/task_scheduler.go b/server/task_scheduler.go
index 48beb8f80c..c85f53daa8 100644
--- a/server/task_scheduler.go
+++ b/server/task_scheduler.go
@@ -149,7 +149,7 @@ func (s *TaskScheduler) Run() error {
result := string(bytes)
taskStatusPatch := &api.TaskStatusPatch{
ID: task.ID,
- UpdaterId: api.SYSTEM_BOT_ID,
+ UpdaterID: api.SYSTEM_BOT_ID,
Status: api.TaskDone,
Code: &code,
Result: &result,
@@ -184,7 +184,7 @@ func (s *TaskScheduler) Run() error {
result := string(bytes)
taskStatusPatch := &api.TaskStatusPatch{
ID: task.ID,
- UpdaterId: api.SYSTEM_BOT_ID,
+ UpdaterID: api.SYSTEM_BOT_ID,
Status: api.TaskFailed,
Code: &code,
Result: &result,
@@ -248,7 +248,7 @@ func (s *TaskScheduler) ScheduleIfNeeded(ctx context.Context, task *api.Task) (*
}
instanceFind := &api.InstanceFind{
- ID: &task.InstanceId,
+ ID: &task.InstanceID,
}
instance, err := s.server.InstanceService.FindInstance(ctx, instanceFind)
if err != nil {
@@ -286,7 +286,7 @@ func (s *TaskScheduler) ScheduleIfNeeded(ctx context.Context, task *api.Task) (*
func passCheck(ctx context.Context, server *Server, task *api.Task, checkType api.TaskCheckType) (bool, error) {
statusList := []api.TaskCheckRunStatus{api.TaskCheckRunDone, api.TaskCheckRunFailed}
taskCheckRunFind := &api.TaskCheckRunFind{
- TaskId: &task.ID,
+ TaskID: &task.ID,
Type: &checkType,
StatusList: &statusList,
Latest: true,
diff --git a/server/vcs.go b/server/vcs.go
index 50747a12c7..89629f0e4c 100644
--- a/server/vcs.go
+++ b/server/vcs.go
@@ -18,7 +18,7 @@ func (s *Server) registerVCSRoutes(g *echo.Group) {
g.POST("/vcs", func(c echo.Context) error {
ctx := context.Background()
vcsCreate := &api.VCSCreate{
- CreatorId: c.Get(GetPrincipalIdContextKey()).(int),
+ CreatorID: c.Get(GetPrincipalIDContextKey()).(int),
}
if err := jsonapi.UnmarshalPayload(c.Request().Body, vcsCreate); err != nil {
return echo.NewHTTPError(http.StatusBadRequest, "Malformatted create VCS request").SetInternal(err)
@@ -64,14 +64,14 @@ func (s *Server) registerVCSRoutes(g *echo.Group) {
return nil
})
- g.GET("/vcs/:vcsId", func(c echo.Context) error {
+ g.GET("/vcs/:vcsID", func(c echo.Context) error {
ctx := context.Background()
- id, err := strconv.Atoi(c.Param("vcsId"))
+ id, err := strconv.Atoi(c.Param("vcsID"))
if err != nil {
- return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("vcsId"))).SetInternal(err)
+ return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("vcsID"))).SetInternal(err)
}
- vcs, err := s.ComposeVCSById(ctx, id)
+ vcs, err := s.ComposeVCSByID(ctx, id)
if err != nil {
if common.ErrorCode(err) == common.NotFound {
return echo.NewHTTPError(http.StatusNotFound, fmt.Sprintf("VCS ID not found: %d", id))
@@ -86,16 +86,16 @@ func (s *Server) registerVCSRoutes(g *echo.Group) {
return nil
})
- g.PATCH("/vcs/:vcsId", func(c echo.Context) error {
+ g.PATCH("/vcs/:vcsID", func(c echo.Context) error {
ctx := context.Background()
- id, err := strconv.Atoi(c.Param("vcsId"))
+ id, err := strconv.Atoi(c.Param("vcsID"))
if err != nil {
- return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("VCS ID is not a number: %s", c.Param("vcsId"))).SetInternal(err)
+ return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("VCS ID is not a number: %s", c.Param("vcsID"))).SetInternal(err)
}
vcsPatch := &api.VCSPatch{
ID: id,
- UpdaterId: c.Get(GetPrincipalIdContextKey()).(int),
+ UpdaterID: c.Get(GetPrincipalIDContextKey()).(int),
}
if err := jsonapi.UnmarshalPayload(c.Request().Body, vcsPatch); err != nil {
return echo.NewHTTPError(http.StatusBadRequest, "Malformatted change VCS request").SetInternal(err)
@@ -120,16 +120,16 @@ func (s *Server) registerVCSRoutes(g *echo.Group) {
return nil
})
- g.DELETE("/vcs/:vcsId", func(c echo.Context) error {
+ g.DELETE("/vcs/:vcsID", func(c echo.Context) error {
ctx := context.Background()
- id, err := strconv.Atoi(c.Param("vcsId"))
+ id, err := strconv.Atoi(c.Param("vcsID"))
if err != nil {
- return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("VCS is not a number: %s", c.Param("vcsId"))).SetInternal(err)
+ return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("VCS is not a number: %s", c.Param("vcsID"))).SetInternal(err)
}
vcsDelete := &api.VCSDelete{
ID: id,
- DeleterId: c.Get(GetPrincipalIdContextKey()).(int),
+ DeleterID: c.Get(GetPrincipalIDContextKey()).(int),
}
err = s.VCSService.DeleteVCS(ctx, vcsDelete)
if err != nil {
@@ -144,15 +144,15 @@ func (s *Server) registerVCSRoutes(g *echo.Group) {
return nil
})
- g.GET("/vcs/:vcsId/repository", func(c echo.Context) error {
+ g.GET("/vcs/:vcsID/repository", func(c echo.Context) error {
ctx := context.Background()
- id, err := strconv.Atoi(c.Param("vcsId"))
+ id, err := strconv.Atoi(c.Param("vcsID"))
if err != nil {
- return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("vcsId"))).SetInternal(err)
+ return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("ID is not a number: %s", c.Param("vcsID"))).SetInternal(err)
}
repositoryFind := &api.RepositoryFind{
- VCSId: &id,
+ VCSID: &id,
}
list, err := s.RepositoryService.FindRepositoryList(ctx, repositoryFind)
if err != nil {
@@ -173,7 +173,7 @@ func (s *Server) registerVCSRoutes(g *echo.Group) {
})
}
-func (s *Server) ComposeVCSById(ctx context.Context, id int) (*api.VCS, error) {
+func (s *Server) ComposeVCSByID(ctx context.Context, id int) (*api.VCS, error) {
vcsFind := &api.VCSFind{
ID: &id,
}
@@ -192,12 +192,12 @@ func (s *Server) ComposeVCSById(ctx context.Context, id int) (*api.VCS, error) {
func (s *Server) ComposeVCSRelationship(ctx context.Context, vcs *api.VCS) error {
var err error
- vcs.Creator, err = s.ComposePrincipalById(ctx, vcs.CreatorId)
+ vcs.Creator, err = s.ComposePrincipalByID(ctx, vcs.CreatorID)
if err != nil {
return err
}
- vcs.Updater, err = s.ComposePrincipalById(ctx, vcs.UpdaterId)
+ vcs.Updater, err = s.ComposePrincipalByID(ctx, vcs.UpdaterID)
if err != nil {
return err
}
diff --git a/server/webhook.go b/server/webhook.go
index 20164d54a5..e13ae59d27 100644
--- a/server/webhook.go
+++ b/server/webhook.go
@@ -44,16 +44,16 @@ func (s *Server) registerWebhookRoutes(g *echo.Group) {
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid webhook event type, got %s, want push", pushEvent.ObjectKind))
}
- webhookEndpointId := c.Param("id")
+ webhookEndpointID := c.Param("id")
repositoryFind := &api.RepositoryFind{
- WebhookEndpointId: &webhookEndpointId,
+ WebhookEndpointID: &webhookEndpointID,
}
repository, err := s.RepositoryService.FindRepository(ctx, repositoryFind)
if err != nil {
if common.ErrorCode(err) == common.NotFound {
- return echo.NewHTTPError(http.StatusNotFound, fmt.Sprintf("Endpoint not found: %v", webhookEndpointId))
+ return echo.NewHTTPError(http.StatusNotFound, fmt.Sprintf("Endpoint not found: %v", webhookEndpointID))
}
- return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to respond webhook event for endpoint: %v", webhookEndpointId)).SetInternal(err)
+ return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to respond webhook event for endpoint: %v", webhookEndpointID)).SetInternal(err)
}
if err := s.ComposeRepositoryRelationship(ctx, repository); err != nil {
@@ -64,8 +64,8 @@ func (s *Server) registerWebhookRoutes(g *echo.Group) {
return echo.NewHTTPError(http.StatusBadRequest, "Secret token mismatch")
}
- if strconv.Itoa(pushEvent.Project.ID) != repository.ExternalId {
- return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Project mismatch, got %d, want %s", pushEvent.Project.ID, repository.ExternalId))
+ if strconv.Itoa(pushEvent.Project.ID) != repository.ExternalID {
+ return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Project mismatch, got %d, want %s", pushEvent.Project.ID, repository.ExternalID))
}
createdMessageList := []string{}
@@ -134,8 +134,8 @@ func (s *Server) registerWebhookRoutes(g *echo.Group) {
}
activityCreate := &api.ActivityCreate{
- CreatorId: api.SYSTEM_BOT_ID,
- ContainerId: repository.ProjectId,
+ CreatorID: api.SYSTEM_BOT_ID,
+ ContainerID: repository.ProjectID,
Type: api.ActivityProjectRepositoryPush,
Level: api.ACTIVITY_WARN,
Comment: fmt.Sprintf("Ignored committed file %q, %s.", added, err.Error()),
@@ -156,7 +156,7 @@ func (s *Server) registerWebhookRoutes(g *echo.Group) {
// Retrieve sql by reading the file content
resp, err := gitlab.GET(
repository.VCS.InstanceURL,
- fmt.Sprintf("projects/%s/repository/files/%s/raw?ref=%s", repository.ExternalId, url.QueryEscape(added), commit.ID),
+ fmt.Sprintf("projects/%s/repository/files/%s/raw?ref=%s", repository.ExternalID, url.QueryEscape(added), commit.ID),
repository.AccessToken,
)
if err != nil {
@@ -173,7 +173,7 @@ func (s *Server) registerWebhookRoutes(g *echo.Group) {
// Find matching database list
databaseFind := &api.DatabaseFind{
- ProjectId: &repository.ProjectId,
+ ProjectID: &repository.ProjectID,
Name: &mi.Database,
}
databaseList, err := s.ComposeDatabaseListByFind(ctx, databaseFind)
@@ -181,7 +181,7 @@ func (s *Server) registerWebhookRoutes(g *echo.Group) {
createIgnoredFileActivity(fmt.Errorf("failed to find database matching database %q referenced by the committed file", mi.Database))
continue
} else if len(databaseList) == 0 {
- createIgnoredFileActivity(fmt.Errorf("project ID %d does not own database %q referenced by the committed file", repository.ProjectId, mi.Database))
+ createIgnoredFileActivity(fmt.Errorf("project ID %d does not own database %q referenced by the committed file", repository.ProjectID, mi.Database))
continue
}
@@ -219,32 +219,32 @@ func (s *Server) registerWebhookRoutes(g *echo.Group) {
// We will emit warning in this case.
var databaseListByEnv = map[int][]*api.Database{}
for _, database := range filterdDatabaseList {
- list, ok := databaseListByEnv[database.Instance.EnvironmentId]
+ list, ok := databaseListByEnv[database.Instance.EnvironmentID]
if ok {
- databaseListByEnv[database.Instance.EnvironmentId] = append(list, database)
+ databaseListByEnv[database.Instance.EnvironmentID] = append(list, database)
} else {
list := make([]*api.Database, 0)
- databaseListByEnv[database.Instance.EnvironmentId] = append(list, database)
+ databaseListByEnv[database.Instance.EnvironmentID] = append(list, database)
}
// Load pipeline approval policy per environment.
- if _, ok := pipelineApprovalByEnv[database.Instance.EnvironmentId]; !ok {
- p, err := s.PolicyService.GetPipelineApprovalPolicy(ctx, database.Instance.EnvironmentId)
+ if _, ok := pipelineApprovalByEnv[database.Instance.EnvironmentID]; !ok {
+ p, err := s.PolicyService.GetPipelineApprovalPolicy(ctx, database.Instance.EnvironmentID)
if err != nil {
- createIgnoredFileActivity(fmt.Errorf("failed to find pipeline approval policy for environment %v", database.Instance.EnvironmentId))
+ createIgnoredFileActivity(fmt.Errorf("failed to find pipeline approval policy for environment %v", database.Instance.EnvironmentID))
continue
}
- pipelineApprovalByEnv[database.Instance.EnvironmentId] = p.Value
+ pipelineApprovalByEnv[database.Instance.EnvironmentID] = p.Value
}
}
var multipleDatabaseForSameEnv = false
- for environemntId, databaseList := range databaseListByEnv {
+ for environemntID, databaseList := range databaseListByEnv {
if len(databaseList) > 1 {
multipleDatabaseForSameEnv = true
- s.l.Warn(fmt.Sprintf("Ignored committed file, multiple ambiguous databases named %q for environment %d.", mi.Database, environemntId),
- zap.Int("project_id", repository.ProjectId),
+ s.l.Warn(fmt.Sprintf("Ignored committed file, multiple ambiguous databases named %q for environment %d.", mi.Database, environemntID),
+ zap.Int("project_id", repository.ProjectID),
zap.String("file", added),
)
}
@@ -264,8 +264,8 @@ func (s *Server) registerWebhookRoutes(g *echo.Group) {
taskStatus = api.TaskPending
}
task := &api.TaskCreate{
- InstanceId: database.InstanceId,
- DatabaseId: &databaseID,
+ InstanceID: database.InstanceID,
+ DatabaseID: &databaseID,
Name: mi.Description,
Status: taskStatus,
Type: api.TaskDatabaseSchemaUpdate,
@@ -274,7 +274,7 @@ func (s *Server) registerWebhookRoutes(g *echo.Group) {
MigrationType: mi.Type,
}
stageList = append(stageList, api.StageCreate{
- EnvironmentId: database.Instance.EnvironmentId,
+ EnvironmentID: database.Instance.EnvironmentID,
TaskList: []api.TaskCreate{*task},
Name: database.Instance.Environment.Name,
})
@@ -284,12 +284,12 @@ func (s *Server) registerWebhookRoutes(g *echo.Group) {
Name: fmt.Sprintf("Pipeline - %s", commit.Title),
}
issueCreate := &api.IssueCreate{
- ProjectId: repository.ProjectId,
+ ProjectID: repository.ProjectID,
Pipeline: *pipeline,
Name: commit.Title,
Type: api.IssueDatabaseSchemaUpdate,
Description: commit.Message,
- AssigneeId: api.SYSTEM_BOT_ID,
+ AssigneeID: api.SYSTEM_BOT_ID,
}
issue, err := s.CreateIssue(ctx, issueCreate, api.SYSTEM_BOT_ID)
@@ -305,7 +305,7 @@ func (s *Server) registerWebhookRoutes(g *echo.Group) {
{
bytes, err := json.Marshal(api.ActivityProjectRepositoryPushPayload{
VCSPushEvent: vcsPushEvent,
- IssueId: issue.ID,
+ IssueID: issue.ID,
IssueName: issue.Name,
})
if err != nil {
@@ -313,8 +313,8 @@ func (s *Server) registerWebhookRoutes(g *echo.Group) {
}
activityCreate := &api.ActivityCreate{
- CreatorId: api.SYSTEM_BOT_ID,
- ContainerId: repository.ProjectId,
+ CreatorID: api.SYSTEM_BOT_ID,
+ ContainerID: repository.ProjectID,
Type: api.ActivityProjectRepositoryPush,
Level: api.ACTIVITY_INFO,
Comment: fmt.Sprintf("Created issue %q.", issue.Name),
diff --git a/store/activity.go b/store/activity.go
index 730e5803d5..884c727b8e 100644
--- a/store/activity.go
+++ b/store/activity.go
@@ -140,9 +140,9 @@ func createActivity(ctx context.Context, tx *Tx, create *api.ActivityCreate) (*a
VALUES (?, ?, ?, ?, ?, ?, ?)
RETURNING id, creator_id, created_ts, updater_id, updated_ts, container_id, `+"`type`, level, comment, payload"+`
`,
- create.CreatorId,
- create.CreatorId,
- create.ContainerId,
+ create.CreatorID,
+ create.CreatorID,
+ create.ContainerID,
create.Type,
create.Level,
create.Comment,
@@ -158,11 +158,11 @@ func createActivity(ctx context.Context, tx *Tx, create *api.ActivityCreate) (*a
var activity api.Activity
if err := row.Scan(
&activity.ID,
- &activity.CreatorId,
+ &activity.CreatorID,
&activity.CreatedTs,
- &activity.UpdaterId,
+ &activity.UpdaterID,
&activity.UpdatedTs,
- &activity.ContainerId,
+ &activity.ContainerID,
&activity.Type,
&activity.Level,
&activity.Comment,
@@ -180,7 +180,7 @@ func findActivityList(ctx context.Context, tx *Tx, find *api.ActivityFind) (_ []
if v := find.ID; v != nil {
where, args = append(where, "id = ?"), append(args, *v)
}
- if v := find.ContainerId; v != nil {
+ if v := find.ContainerID; v != nil {
where, args = append(where, "container_id = ?"), append(args, *v)
}
@@ -216,11 +216,11 @@ func findActivityList(ctx context.Context, tx *Tx, find *api.ActivityFind) (_ []
var activity api.Activity
if err := rows.Scan(
&activity.ID,
- &activity.CreatorId,
+ &activity.CreatorID,
&activity.CreatedTs,
- &activity.UpdaterId,
+ &activity.UpdaterID,
&activity.UpdatedTs,
- &activity.ContainerId,
+ &activity.ContainerID,
&activity.Type,
&activity.Level,
&activity.Comment,
@@ -241,7 +241,7 @@ func findActivityList(ctx context.Context, tx *Tx, find *api.ActivityFind) (_ []
// patchActivity updates a activity by ID. Returns the new state of the activity after update.
func patchActivity(ctx context.Context, tx *Tx, patch *api.ActivityPatch) (*api.Activity, error) {
// Build UPDATE clause.
- set, args := []string{"updater_id = ?"}, []interface{}{patch.UpdaterId}
+ set, args := []string{"updater_id = ?"}, []interface{}{patch.UpdaterID}
if v := patch.Comment; v != nil {
set, args = append(set, "comment = ?"), append(args, api.Role(*v))
}
@@ -266,11 +266,11 @@ func patchActivity(ctx context.Context, tx *Tx, patch *api.ActivityPatch) (*api.
var activity api.Activity
if err := row.Scan(
&activity.ID,
- &activity.CreatorId,
+ &activity.CreatorID,
&activity.CreatedTs,
- &activity.UpdaterId,
+ &activity.UpdaterID,
&activity.UpdatedTs,
- &activity.ContainerId,
+ &activity.ContainerID,
&activity.Type,
&activity.Level,
&activity.Comment,
diff --git a/store/anomaly.go b/store/anomaly.go
index 1a0b0fbcb6..f41f1a2a21 100644
--- a/store/anomaly.go
+++ b/store/anomaly.go
@@ -39,8 +39,8 @@ func (s *AnomalyService) UpsertActiveAnomaly(ctx context.Context, upsert *api.An
status := api.Normal
find := &api.AnomalyFind{
RowStatus: &status,
- InstanceId: &upsert.InstanceId,
- DatabaseId: upsert.DatabaseId,
+ InstanceID: &upsert.InstanceID,
+ DatabaseID: upsert.DatabaseID,
Type: &upsert.Type,
}
list, err := findAnomalyList(ctx, tx, find)
@@ -58,7 +58,7 @@ func (s *AnomalyService) UpsertActiveAnomaly(ctx context.Context, upsert *api.An
// Even if field value does not change, we still patch to update the updated_ts
anomaly, err = patchAnomaly(ctx, tx, &anomalyPatch{
ID: list[0].ID,
- UpdaterId: upsert.CreatorId,
+ UpdaterID: upsert.CreatorID,
Payload: upsert.Payload,
})
if err != nil {
@@ -127,10 +127,10 @@ func createAnomaly(ctx context.Context, tx *Tx, upsert *api.AnomalyUpsert) (*api
VALUES (?, ?, ?, ?, ?, ?)
RETURNING id, creator_id, created_ts, updater_id, updated_ts, instance_id, database_id, `+"`type`"+`, payload
`,
- upsert.CreatorId,
- upsert.CreatorId,
- upsert.InstanceId,
- upsert.DatabaseId,
+ upsert.CreatorID,
+ upsert.CreatorID,
+ upsert.InstanceID,
+ upsert.DatabaseID,
upsert.Type,
upsert.Payload,
)
@@ -142,23 +142,23 @@ func createAnomaly(ctx context.Context, tx *Tx, upsert *api.AnomalyUpsert) (*api
row.Next()
var anomaly api.Anomaly
- databaseId := sql.NullInt32{}
+ databaseID := sql.NullInt32{}
if err := row.Scan(
&anomaly.ID,
- &anomaly.CreatorId,
+ &anomaly.CreatorID,
&anomaly.CreatedTs,
- &anomaly.UpdaterId,
+ &anomaly.UpdaterID,
&anomaly.UpdatedTs,
- &anomaly.InstanceId,
- &databaseId,
+ &anomaly.InstanceID,
+ &databaseID,
&anomaly.Type,
&anomaly.Payload,
); err != nil {
return nil, FormatError(err)
}
- if databaseId.Valid {
- value := int(databaseId.Int32)
- anomaly.DatabaseId = &value
+ if databaseID.Valid {
+ value := int(databaseID.Int32)
+ anomaly.DatabaseID = &value
}
anomaly.Severity = api.AnomalySeverityFromType(anomaly.Type)
@@ -168,14 +168,14 @@ func createAnomaly(ctx context.Context, tx *Tx, upsert *api.AnomalyUpsert) (*api
func findAnomalyList(ctx context.Context, tx *Tx, find *api.AnomalyFind) (_ []*api.Anomaly, err error) {
// Build WHERE clause.
where, args := []string{"1 = 1"}, []interface{}{}
- if v := find.InstanceId; v != nil {
+ if v := find.InstanceID; v != nil {
where, args = append(where, "instance_id = ?"), append(args, *v)
if find.InstanceOnly {
where = append(where, "database_id is NULL")
}
}
- if find.InstanceId == nil || !find.InstanceOnly {
- if v := find.DatabaseId; v != nil {
+ if find.InstanceID == nil || !find.InstanceOnly {
+ if v := find.DatabaseID; v != nil {
where, args = append(where, "database_id = ?"), append(args, *v)
}
}
@@ -211,23 +211,23 @@ func findAnomalyList(ctx context.Context, tx *Tx, find *api.AnomalyFind) (_ []*a
list := make([]*api.Anomaly, 0)
for rows.Next() {
var anomaly api.Anomaly
- databaseId := sql.NullInt32{}
+ databaseID := sql.NullInt32{}
if err := rows.Scan(
&anomaly.ID,
- &anomaly.CreatorId,
+ &anomaly.CreatorID,
&anomaly.CreatedTs,
- &anomaly.UpdaterId,
+ &anomaly.UpdaterID,
&anomaly.UpdatedTs,
- &anomaly.InstanceId,
- &databaseId,
+ &anomaly.InstanceID,
+ &databaseID,
&anomaly.Type,
&anomaly.Payload,
); err != nil {
return nil, FormatError(err)
}
- if databaseId.Valid {
- value := int(databaseId.Int32)
- anomaly.DatabaseId = &value
+ if databaseID.Valid {
+ value := int(databaseID.Int32)
+ anomaly.DatabaseID = &value
}
anomaly.Severity = api.AnomalySeverityFromType(anomaly.Type)
@@ -244,7 +244,7 @@ type anomalyPatch struct {
ID int
// Standard fields
- UpdaterId int
+ UpdaterID int
// Domain specific fields
Payload string
@@ -253,7 +253,7 @@ type anomalyPatch struct {
// patchAnomaly patches an anomaly
func patchAnomaly(ctx context.Context, tx *Tx, patch *anomalyPatch) (*api.Anomaly, error) {
// Build UPDATE clause.
- set, args := []string{"updater_id = ?"}, []interface{}{patch.UpdaterId}
+ set, args := []string{"updater_id = ?"}, []interface{}{patch.UpdaterID}
set, args = append(set, "payload = ?"), append(args, patch.Payload)
args = append(args, patch.ID)
@@ -278,23 +278,23 @@ func patchAnomaly(ctx context.Context, tx *Tx, patch *anomalyPatch) (*api.Anomal
row.Next()
var anomaly api.Anomaly
- databaseId := sql.NullInt32{}
+ databaseID := sql.NullInt32{}
if err := row.Scan(
&anomaly.ID,
- &anomaly.CreatorId,
+ &anomaly.CreatorID,
&anomaly.CreatedTs,
- &anomaly.UpdaterId,
+ &anomaly.UpdaterID,
&anomaly.UpdatedTs,
- &anomaly.InstanceId,
- &anomaly.DatabaseId,
+ &anomaly.InstanceID,
+ &anomaly.DatabaseID,
&anomaly.Type,
&anomaly.Payload,
); err != nil {
return nil, FormatError(err)
}
- if databaseId.Valid {
- value := int(databaseId.Int32)
- anomaly.DatabaseId = &value
+ if databaseID.Valid {
+ value := int(databaseID.Int32)
+ anomaly.DatabaseID = &value
}
anomaly.Severity = api.AnomalySeverityFromType(anomaly.Type)
@@ -303,18 +303,18 @@ func patchAnomaly(ctx context.Context, tx *Tx, patch *anomalyPatch) (*api.Anomal
// archiveAnomaly archives an anomaly by ID.
func archiveAnomaly(ctx context.Context, tx *Tx, archive *api.AnomalyArchive) error {
- if archive.InstanceId == nil && archive.DatabaseId == nil {
- return &common.Error{Code: common.Internal, Err: fmt.Errorf("failed to close anomaly, should specify either instanceId or databaseId")}
+ if archive.InstanceID == nil && archive.DatabaseID == nil {
+ return &common.Error{Code: common.Internal, Err: fmt.Errorf("failed to close anomaly, should specify either instanceID or databaseID")}
}
- if archive.InstanceId != nil && archive.DatabaseId != nil {
- return &common.Error{Code: common.Internal, Err: fmt.Errorf("failed to close anomaly, should specify either instanceId or databaseId, but not both")}
+ if archive.InstanceID != nil && archive.DatabaseID != nil {
+ return &common.Error{Code: common.Internal, Err: fmt.Errorf("failed to close anomaly, should specify either instanceID or databaseID, but not both")}
}
// Remove row from database.
- if archive.InstanceId != nil {
+ if archive.InstanceID != nil {
result, err := tx.ExecContext(ctx,
`UPDATE anomaly SET row_status = ? WHERE instance_id = ? AND database_id IS NULL AND type = ?`,
api.Archived,
- *archive.InstanceId,
+ *archive.InstanceID,
archive.Type,
)
if err != nil {
@@ -323,13 +323,13 @@ func archiveAnomaly(ctx context.Context, tx *Tx, archive *api.AnomalyArchive) er
rows, _ := result.RowsAffected()
if rows == 0 {
- return &common.Error{Code: common.NotFound, Err: fmt.Errorf("anomaly not found instance: %d type: %s", *archive.InstanceId, archive.Type)}
+ return &common.Error{Code: common.NotFound, Err: fmt.Errorf("anomaly not found instance: %d type: %s", *archive.InstanceID, archive.Type)}
}
- } else if archive.DatabaseId != nil {
+ } else if archive.DatabaseID != nil {
result, err := tx.ExecContext(ctx,
`UPDATE anomaly SET row_status = ? WHERE database_id = ? AND type = ?`,
api.Archived,
- *archive.DatabaseId,
+ *archive.DatabaseID,
archive.Type,
)
if err != nil {
@@ -338,7 +338,7 @@ func archiveAnomaly(ctx context.Context, tx *Tx, archive *api.AnomalyArchive) er
rows, _ := result.RowsAffected()
if rows == 0 {
- return &common.Error{Code: common.NotFound, Err: fmt.Errorf("anomaly not found database: %d type: %s", *archive.DatabaseId, archive.Type)}
+ return &common.Error{Code: common.NotFound, Err: fmt.Errorf("anomaly not found database: %d type: %s", *archive.DatabaseID, archive.Type)}
}
}
diff --git a/store/backup.go b/store/backup.go
index 5188ca8000..e05dad75fb 100644
--- a/store/backup.go
+++ b/store/backup.go
@@ -124,9 +124,9 @@ func (s *BackupService) createBackup(ctx context.Context, tx *Tx, create *api.Ba
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
RETURNING id, creator_id, created_ts, updater_id, updated_ts, database_id, name, `+"`status`,"+` `+"`type`, storage_backend, migration_history_version, path, comment"+`
`,
- create.CreatorId,
- create.CreatorId,
- create.DatabaseId,
+ create.CreatorID,
+ create.CreatorID,
+ create.DatabaseID,
create.Name,
create.Status,
create.Type,
@@ -144,11 +144,11 @@ func (s *BackupService) createBackup(ctx context.Context, tx *Tx, create *api.Ba
var backup api.Backup
if err := row.Scan(
&backup.ID,
- &backup.CreatorId,
+ &backup.CreatorID,
&backup.CreatedTs,
- &backup.UpdaterId,
+ &backup.UpdaterID,
&backup.UpdatedTs,
- &backup.DatabaseId,
+ &backup.DatabaseID,
&backup.Name,
&backup.Status,
&backup.Type,
@@ -169,7 +169,7 @@ func (s *BackupService) findBackupList(ctx context.Context, tx *Tx, find *api.Ba
if v := find.ID; v != nil {
where, args = append(where, "id = ?"), append(args, *v)
}
- if v := find.DatabaseId; v != nil {
+ if v := find.DatabaseID; v != nil {
where, args = append(where, "database_id = ?"), append(args, *v)
}
if v := find.Name; v != nil {
@@ -209,11 +209,11 @@ func (s *BackupService) findBackupList(ctx context.Context, tx *Tx, find *api.Ba
var backup api.Backup
if err := rows.Scan(
&backup.ID,
- &backup.CreatorId,
+ &backup.CreatorID,
&backup.CreatedTs,
- &backup.UpdaterId,
+ &backup.UpdaterID,
&backup.UpdatedTs,
- &backup.DatabaseId,
+ &backup.DatabaseID,
&backup.Name,
&backup.Status,
&backup.Type,
@@ -237,7 +237,7 @@ func (s *BackupService) findBackupList(ctx context.Context, tx *Tx, find *api.Ba
// patchBackup updates a backup by ID. Returns the new state of the backup after update.
func (s *BackupService) patchBackup(ctx context.Context, tx *Tx, patch *api.BackupPatch) (*api.Backup, error) {
// Build UPDATE clause.
- set, args := []string{"updater_id = ?"}, []interface{}{patch.UpdaterId}
+ set, args := []string{"updater_id = ?"}, []interface{}{patch.UpdaterID}
set, args = append(set, "status = ?"), append(args, patch.Status)
set, args = append(set, "comment = ?"), append(args, patch.Comment)
@@ -261,11 +261,11 @@ func (s *BackupService) patchBackup(ctx context.Context, tx *Tx, patch *api.Back
var backup api.Backup
if err := row.Scan(
&backup.ID,
- &backup.CreatorId,
+ &backup.CreatorID,
&backup.CreatedTs,
- &backup.UpdaterId,
+ &backup.UpdaterID,
&backup.UpdatedTs,
- &backup.DatabaseId,
+ &backup.DatabaseID,
&backup.Name,
&backup.Status,
&backup.Type,
@@ -310,7 +310,7 @@ func (s *BackupService) findBackupSetting(ctx context.Context, tx *Tx, find *api
if v := find.ID; v != nil {
where, args = append(where, "id = ?"), append(args, *v)
}
- if v := find.DatabaseId; v != nil {
+ if v := find.DatabaseID; v != nil {
where, args = append(where, "database_id = ?"), append(args, *v)
}
@@ -341,11 +341,11 @@ func (s *BackupService) findBackupSetting(ctx context.Context, tx *Tx, find *api
var backupSetting api.BackupSetting
if err := rows.Scan(
&backupSetting.ID,
- &backupSetting.CreatorId,
+ &backupSetting.CreatorID,
&backupSetting.CreatedTs,
- &backupSetting.UpdaterId,
+ &backupSetting.UpdaterID,
&backupSetting.UpdatedTs,
- &backupSetting.DatabaseId,
+ &backupSetting.DatabaseID,
&backupSetting.Enabled,
&backupSetting.Hour,
&backupSetting.DayOfWeek,
@@ -365,7 +365,7 @@ func (s *BackupService) findBackupSetting(ctx context.Context, tx *Tx, find *api
// UpsertBackupSetting sets the backup settings for a database.
func (s *BackupService) UpsertBackupSetting(ctx context.Context, upsert *api.BackupSettingUpsert) (*api.BackupSetting, error) {
- backupPlanPolicy, err := s.policyService.GetBackupPlanPolicy(ctx, upsert.EnvironmentId)
+ backupPlanPolicy, err := s.policyService.GetBackupPlanPolicy(ctx, upsert.EnvironmentID)
if err != nil {
return nil, err
}
@@ -425,9 +425,9 @@ func (s *BackupService) UpsertBackupSettingTx(ctx context.Context, tx *sql.Tx, u
hook_url = excluded.hook_url
RETURNING id, creator_id, created_ts, updater_id, updated_ts, database_id, `+"`enabled`,"+` `+"hour, day_of_week"+`, hook_url
`,
- upsert.UpdaterId,
- upsert.UpdaterId,
- upsert.DatabaseId,
+ upsert.UpdaterID,
+ upsert.UpdaterID,
+ upsert.DatabaseID,
upsert.Enabled,
upsert.Hour,
upsert.DayOfWeek,
@@ -443,11 +443,11 @@ func (s *BackupService) UpsertBackupSettingTx(ctx context.Context, tx *sql.Tx, u
var backupSetting api.BackupSetting
if err := row.Scan(
&backupSetting.ID,
- &backupSetting.CreatorId,
+ &backupSetting.CreatorID,
&backupSetting.CreatedTs,
- &backupSetting.UpdaterId,
+ &backupSetting.UpdaterID,
&backupSetting.UpdatedTs,
- &backupSetting.DatabaseId,
+ &backupSetting.DatabaseID,
&backupSetting.Enabled,
&backupSetting.Hour,
&backupSetting.DayOfWeek,
@@ -503,11 +503,11 @@ func (s *BackupService) FindBackupSettingsMatch(ctx context.Context, match *api.
var backupSetting api.BackupSetting
if err := rows.Scan(
&backupSetting.ID,
- &backupSetting.CreatorId,
+ &backupSetting.CreatorID,
&backupSetting.CreatedTs,
- &backupSetting.UpdaterId,
+ &backupSetting.UpdaterID,
&backupSetting.UpdatedTs,
- &backupSetting.DatabaseId,
+ &backupSetting.DatabaseID,
&backupSetting.Enabled,
&backupSetting.Hour,
&backupSetting.DayOfWeek,
diff --git a/store/bookmark.go b/store/bookmark.go
index 456ff2f08b..70629f7894 100644
--- a/store/bookmark.go
+++ b/store/bookmark.go
@@ -116,8 +116,8 @@ func createBookmark(ctx context.Context, tx *Tx, create *api.BookmarkCreate) (*a
VALUES (?, ?, ?, ?)
RETURNING id, creator_id, created_ts, updater_id, updated_ts, name, link
`,
- create.CreatorId,
- create.CreatorId,
+ create.CreatorID,
+ create.CreatorID,
create.Name,
create.Link,
)
@@ -131,9 +131,9 @@ func createBookmark(ctx context.Context, tx *Tx, create *api.BookmarkCreate) (*a
var bookmark api.Bookmark
if err := row.Scan(
&bookmark.ID,
- &bookmark.CreatorId,
+ &bookmark.CreatorID,
&bookmark.CreatedTs,
- &bookmark.UpdaterId,
+ &bookmark.UpdaterID,
&bookmark.UpdatedTs,
&bookmark.Name,
&bookmark.Link,
@@ -150,7 +150,7 @@ func findBookmarkList(ctx context.Context, tx *Tx, find *api.BookmarkFind) (_ []
if v := find.ID; v != nil {
where, args = append(where, "id = ?"), append(args, *v)
}
- if v := find.CreatorId; v != nil {
+ if v := find.CreatorID; v != nil {
where, args = append(where, "creator_id = ?"), append(args, *v)
}
@@ -178,9 +178,9 @@ func findBookmarkList(ctx context.Context, tx *Tx, find *api.BookmarkFind) (_ []
var bookmark api.Bookmark
if err := rows.Scan(
&bookmark.ID,
- &bookmark.CreatorId,
+ &bookmark.CreatorID,
&bookmark.CreatedTs,
- &bookmark.UpdaterId,
+ &bookmark.UpdaterID,
&bookmark.UpdatedTs,
&bookmark.Name,
&bookmark.Link,
diff --git a/store/column.go b/store/column.go
index dfa8833c0d..62fde4e9c7 100644
--- a/store/column.go
+++ b/store/column.go
@@ -133,10 +133,10 @@ func (s *ColumnService) createColumn(ctx context.Context, tx *Tx, create *api.Co
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`+
"RETURNING id, creator_id, created_ts, updater_id, updated_ts, database_id, table_id, name, position, `default`, `nullable`, `type`, character_set, `collation`, comment"+`
`,
- create.CreatorId,
- create.CreatorId,
- create.DatabaseId,
- create.TableId,
+ create.CreatorID,
+ create.CreatorID,
+ create.DatabaseID,
+ create.TableID,
create.Name,
create.Position,
defaultStr,
@@ -156,12 +156,12 @@ func (s *ColumnService) createColumn(ctx context.Context, tx *Tx, create *api.Co
var column api.Column
if err := row.Scan(
&column.ID,
- &column.CreatorId,
+ &column.CreatorID,
&column.CreatedTs,
- &column.UpdaterId,
+ &column.UpdaterID,
&column.UpdatedTs,
- &column.DatabaseId,
- &column.TableId,
+ &column.DatabaseID,
+ &column.TableID,
&column.Name,
&column.Position,
&defaultStr,
@@ -187,10 +187,10 @@ func (s *ColumnService) findColumnList(ctx context.Context, tx *Tx, find *api.Co
if v := find.ID; v != nil {
where, args = append(where, "id = ?"), append(args, *v)
}
- if v := find.DatabaseId; v != nil {
+ if v := find.DatabaseID; v != nil {
where, args = append(where, "database_id = ?"), append(args, *v)
}
- if v := find.TableId; v != nil {
+ if v := find.TableID; v != nil {
where, args = append(where, "table_id = ?"), append(args, *v)
}
if v := find.Name; v != nil {
@@ -231,12 +231,12 @@ func (s *ColumnService) findColumnList(ctx context.Context, tx *Tx, find *api.Co
defaultStr := sql.NullString{}
if err := rows.Scan(
&column.ID,
- &column.CreatorId,
+ &column.CreatorID,
&column.CreatedTs,
- &column.UpdaterId,
+ &column.UpdaterID,
&column.UpdatedTs,
- &column.DatabaseId,
- &column.TableId,
+ &column.DatabaseID,
+ &column.TableID,
&column.Name,
&column.Position,
&defaultStr,
@@ -265,7 +265,7 @@ func (s *ColumnService) findColumnList(ctx context.Context, tx *Tx, find *api.Co
// patchColumn updates a column by ID. Returns the new state of the column after update.
func (s *ColumnService) patchColumn(ctx context.Context, tx *Tx, patch *api.ColumnPatch) (*api.Column, error) {
// Build UPDATE clause.
- set, args := []string{"updater_id = ?"}, []interface{}{patch.UpdaterId}
+ set, args := []string{"updater_id = ?"}, []interface{}{patch.UpdaterID}
args = append(args, patch.ID)
@@ -288,12 +288,12 @@ func (s *ColumnService) patchColumn(ctx context.Context, tx *Tx, patch *api.Colu
defaultStr := sql.NullString{}
if err := row.Scan(
&column.ID,
- &column.CreatorId,
+ &column.CreatorID,
&column.CreatedTs,
- &column.UpdaterId,
+ &column.UpdaterID,
&column.UpdatedTs,
- &column.DatabaseId,
- &column.TableId,
+ &column.DatabaseID,
+ &column.TableID,
&column.Name,
&column.Position,
&defaultStr,
diff --git a/store/data_source.go b/store/data_source.go
index d89cf8bd5e..c36c7bbc70 100644
--- a/store/data_source.go
+++ b/store/data_source.go
@@ -125,10 +125,10 @@ func (s *DataSourceService) createDataSource(ctx context.Context, tx *sql.Tx, cr
VALUES (?, ?, ?, ?, ?, ?, ?, ?)
RETURNING id, creator_id, created_ts, updater_id, updated_ts, instance_id, database_id, name, type, username, password
`,
- create.CreatorId,
- create.CreatorId,
- create.InstanceId,
- create.DatabaseId,
+ create.CreatorID,
+ create.CreatorID,
+ create.InstanceID,
+ create.DatabaseID,
create.Name,
create.Type,
create.Username,
@@ -144,12 +144,12 @@ func (s *DataSourceService) createDataSource(ctx context.Context, tx *sql.Tx, cr
var dataSource api.DataSource
if err := row.Scan(
&dataSource.ID,
- &dataSource.CreatorId,
+ &dataSource.CreatorID,
&dataSource.CreatedTs,
- &dataSource.UpdaterId,
+ &dataSource.UpdaterID,
&dataSource.UpdatedTs,
- &dataSource.InstanceId,
- &dataSource.DatabaseId,
+ &dataSource.InstanceID,
+ &dataSource.DatabaseID,
&dataSource.Name,
&dataSource.Type,
&dataSource.Username,
@@ -164,10 +164,10 @@ func (s *DataSourceService) createDataSource(ctx context.Context, tx *sql.Tx, cr
func (s *DataSourceService) findDataSourceList(ctx context.Context, tx *Tx, find *api.DataSourceFind) (_ []*api.DataSource, err error) {
// Build WHERE clause.
where, args := []string{"1 = 1"}, []interface{}{}
- if v := find.InstanceId; v != nil {
+ if v := find.InstanceID; v != nil {
where, args = append(where, "instance_id = ?"), append(args, *v)
}
- if v := find.DatabaseId; v != nil {
+ if v := find.DatabaseID; v != nil {
where, args = append(where, "`database_id` = ?"), append(args, *v)
}
if v := find.Type; v != nil {
@@ -202,12 +202,12 @@ func (s *DataSourceService) findDataSourceList(ctx context.Context, tx *Tx, find
var dataSource api.DataSource
if err := rows.Scan(
&dataSource.ID,
- &dataSource.CreatorId,
+ &dataSource.CreatorID,
&dataSource.CreatedTs,
- &dataSource.UpdaterId,
+ &dataSource.UpdaterID,
&dataSource.UpdatedTs,
- &dataSource.InstanceId,
- &dataSource.DatabaseId,
+ &dataSource.InstanceID,
+ &dataSource.DatabaseID,
&dataSource.Name,
&dataSource.Type,
&dataSource.Username,
@@ -228,7 +228,7 @@ func (s *DataSourceService) findDataSourceList(ctx context.Context, tx *Tx, find
// patchDataSource updates a dataSource by ID. Returns the new state of the dataSource after update.
func (s *DataSourceService) patchDataSource(ctx context.Context, tx *Tx, patch *api.DataSourcePatch) (*api.DataSource, error) {
// Build UPDATE clause.
- set, args := []string{"updater_id = ?"}, []interface{}{patch.UpdaterId}
+ set, args := []string{"updater_id = ?"}, []interface{}{patch.UpdaterID}
if v := patch.Username; v != nil {
set, args = append(set, "username = ?"), append(args, *v)
}
@@ -256,12 +256,12 @@ func (s *DataSourceService) patchDataSource(ctx context.Context, tx *Tx, patch *
var dataSource api.DataSource
if err := row.Scan(
&dataSource.ID,
- &dataSource.CreatorId,
+ &dataSource.CreatorID,
&dataSource.CreatedTs,
- &dataSource.UpdaterId,
+ &dataSource.UpdaterID,
&dataSource.UpdatedTs,
- &dataSource.InstanceId,
- &dataSource.DatabaseId,
+ &dataSource.InstanceID,
+ &dataSource.DatabaseID,
&dataSource.Name,
&dataSource.Type,
&dataSource.Username,
diff --git a/store/database.go b/store/database.go
index 308d6fbbd7..cc367b70c2 100644
--- a/store/database.go
+++ b/store/database.go
@@ -58,7 +58,7 @@ func (s *DatabaseService) CreateDatabase(ctx context.Context, create *api.Databa
}
func (s *DatabaseService) CreateDatabaseTx(ctx context.Context, tx *sql.Tx, create *api.DatabaseCreate) (*api.Database, error) {
- backupPlanPolicy, err := s.policyService.GetBackupPlanPolicy(ctx, create.EnvironmentId)
+ backupPlanPolicy, err := s.policyService.GetBackupPlanPolicy(ctx, create.EnvironmentID)
if err != nil {
return nil, err
}
@@ -71,8 +71,8 @@ func (s *DatabaseService) CreateDatabaseTx(ctx context.Context, tx *sql.Tx, crea
// Enable automatic backup setting based on backup plan policy.
if backupPlanPolicy.Schedule != api.BackupPlanPolicyScheduleUnset {
backupSettingUpsert := &api.BackupSettingUpsert{
- UpdaterId: api.SYSTEM_BOT_ID,
- DatabaseId: database.ID,
+ UpdaterID: api.SYSTEM_BOT_ID,
+ DatabaseID: database.ID,
Enabled: true,
Hour: rand.Intn(24),
HookURL: "",
@@ -199,10 +199,10 @@ func (s *DatabaseService) createDatabase(ctx context.Context, tx *sql.Tx, create
VALUES (?, ?, ?, ?, ?, ?, ?, 'OK', (strftime('%s', 'now')))
RETURNING id, creator_id, created_ts, updater_id, updated_ts, instance_id, project_id, name, character_set, collation, sync_status, last_successful_sync_ts
`,
- create.CreatorId,
- create.CreatorId,
- create.InstanceId,
- create.ProjectId,
+ create.CreatorID,
+ create.CreatorID,
+ create.InstanceID,
+ create.ProjectID,
create.Name,
create.CharacterSet,
create.Collation,
@@ -217,12 +217,12 @@ func (s *DatabaseService) createDatabase(ctx context.Context, tx *sql.Tx, create
var database api.Database
if err := row.Scan(
&database.ID,
- &database.CreatorId,
+ &database.CreatorID,
&database.CreatedTs,
- &database.UpdaterId,
+ &database.UpdaterID,
&database.UpdatedTs,
- &database.InstanceId,
- &database.ProjectId,
+ &database.InstanceID,
+ &database.ProjectID,
&database.Name,
&database.CharacterSet,
&database.Collation,
@@ -241,10 +241,10 @@ func (s *DatabaseService) findDatabaseList(ctx context.Context, tx *Tx, find *ap
if v := find.ID; v != nil {
where, args = append(where, "id = ?"), append(args, *v)
}
- if v := find.InstanceId; v != nil {
+ if v := find.InstanceID; v != nil {
where, args = append(where, "instance_id = ?"), append(args, *v)
}
- if v := find.ProjectId; v != nil {
+ if v := find.ProjectID; v != nil {
where, args = append(where, "project_id = ?"), append(args, *v)
}
if v := find.Name; v != nil {
@@ -285,12 +285,12 @@ func (s *DatabaseService) findDatabaseList(ctx context.Context, tx *Tx, find *ap
var nullSourceBackupID sql.NullInt64
if err := rows.Scan(
&database.ID,
- &database.CreatorId,
+ &database.CreatorID,
&database.CreatedTs,
- &database.UpdaterId,
+ &database.UpdaterID,
&database.UpdatedTs,
- &database.InstanceId,
- &database.ProjectId,
+ &database.InstanceID,
+ &database.ProjectID,
&nullSourceBackupID,
&database.Name,
&database.CharacterSet,
@@ -301,7 +301,7 @@ func (s *DatabaseService) findDatabaseList(ctx context.Context, tx *Tx, find *ap
return nil, FormatError(err)
}
if nullSourceBackupID.Valid {
- database.SourceBackupId = int(nullSourceBackupID.Int64)
+ database.SourceBackupID = int(nullSourceBackupID.Int64)
}
list = append(list, &database)
@@ -316,11 +316,11 @@ func (s *DatabaseService) findDatabaseList(ctx context.Context, tx *Tx, find *ap
// patchDatabase updates a database by ID. Returns the new state of the database after update.
func (s *DatabaseService) patchDatabase(ctx context.Context, tx *Tx, patch *api.DatabasePatch) (*api.Database, error) {
// Build UPDATE clause.
- set, args := []string{"updater_id = ?"}, []interface{}{patch.UpdaterId}
- if v := patch.ProjectId; v != nil {
+ set, args := []string{"updater_id = ?"}, []interface{}{patch.UpdaterID}
+ if v := patch.ProjectID; v != nil {
set, args = append(set, "project_id = ?"), append(args, *v)
}
- if v := patch.SourceBackupId; v != nil {
+ if v := patch.SourceBackupID; v != nil {
set, args = append(set, "source_backup_id = ?"), append(args, *v)
}
if v := patch.SyncStatus; v != nil {
@@ -351,12 +351,12 @@ func (s *DatabaseService) patchDatabase(ctx context.Context, tx *Tx, patch *api.
var nullSourceBackupID sql.NullInt64
if err := row.Scan(
&database.ID,
- &database.CreatorId,
+ &database.CreatorID,
&database.CreatedTs,
- &database.UpdaterId,
+ &database.UpdaterID,
&database.UpdatedTs,
- &database.InstanceId,
- &database.ProjectId,
+ &database.InstanceID,
+ &database.ProjectID,
&nullSourceBackupID,
&database.Name,
&database.CharacterSet,
@@ -367,7 +367,7 @@ func (s *DatabaseService) patchDatabase(ctx context.Context, tx *Tx, patch *api.
return nil, FormatError(err)
}
if nullSourceBackupID.Valid {
- database.SourceBackupId = int(nullSourceBackupID.Int64)
+ database.SourceBackupID = int(nullSourceBackupID.Int64)
}
return &database, nil
}
diff --git a/store/environment.go b/store/environment.go
index 5d3af56cae..7af39bda54 100644
--- a/store/environment.go
+++ b/store/environment.go
@@ -171,8 +171,8 @@ func (s *EnvironmentService) createEnvironment(ctx context.Context, tx *Tx, crea
VALUES (?, ?, ?, ?)
RETURNING id, row_status, creator_id, created_ts, updater_id, updated_ts, name, `+"`order`"+`
`,
- create.CreatorId,
- create.CreatorId,
+ create.CreatorID,
+ create.CreatorID,
create.Name,
order+1,
)
@@ -187,9 +187,9 @@ func (s *EnvironmentService) createEnvironment(ctx context.Context, tx *Tx, crea
if err := row2.Scan(
&environment.ID,
&environment.RowStatus,
- &environment.CreatorId,
+ &environment.CreatorID,
&environment.CreatedTs,
- &environment.UpdaterId,
+ &environment.UpdaterID,
&environment.UpdatedTs,
&environment.Name,
&environment.Order,
@@ -236,9 +236,9 @@ func (s *EnvironmentService) findEnvironmentList(ctx context.Context, tx *Tx, fi
if err := rows.Scan(
&environment.ID,
&environment.RowStatus,
- &environment.CreatorId,
+ &environment.CreatorID,
&environment.CreatedTs,
- &environment.UpdaterId,
+ &environment.UpdaterID,
&environment.UpdatedTs,
&environment.Name,
&environment.Order,
@@ -258,7 +258,7 @@ func (s *EnvironmentService) findEnvironmentList(ctx context.Context, tx *Tx, fi
// patchEnvironment updates a environment by ID. Returns the new state of the environment after update.
func (s *EnvironmentService) patchEnvironment(ctx context.Context, tx *Tx, patch *api.EnvironmentPatch) (*api.Environment, error) {
// Build UPDATE clause.
- set, args := []string{"updater_id = ?"}, []interface{}{patch.UpdaterId}
+ set, args := []string{"updater_id = ?"}, []interface{}{patch.UpdaterID}
if v := patch.RowStatus; v != nil {
set, args = append(set, "row_status = ?"), append(args, api.RowStatus(*v))
}
@@ -290,9 +290,9 @@ func (s *EnvironmentService) patchEnvironment(ctx context.Context, tx *Tx, patch
if err := row.Scan(
&environment.ID,
&environment.RowStatus,
- &environment.CreatorId,
+ &environment.CreatorID,
&environment.CreatedTs,
- &environment.UpdaterId,
+ &environment.UpdaterID,
&environment.UpdatedTs,
&environment.Name,
&environment.Order,
diff --git a/store/inbox.go b/store/inbox.go
index 23bfebf4d2..f88a036ac3 100644
--- a/store/inbox.go
+++ b/store/inbox.go
@@ -106,7 +106,7 @@ func (s *InboxService) PatchInbox(ctx context.Context, patch *api.InboxPatch) (*
}
// FindInboxSummary returns the inbox summary for a particular principal
-func (s *InboxService) FindInboxSummary(ctx context.Context, principalId int) (*api.InboxSummary, error) {
+func (s *InboxService) FindInboxSummary(ctx context.Context, principalID int) (*api.InboxSummary, error) {
tx, err := s.db.BeginTx(ctx, nil)
if err != nil {
return nil, FormatError(err)
@@ -116,7 +116,7 @@ func (s *InboxService) FindInboxSummary(ctx context.Context, principalId int) (*
row, err := tx.QueryContext(ctx, `
SELECT EXISTS (SELECT 1 FROM inbox WHERE receiver_id = ? AND status = 'UNREAD')
`,
- principalId,
+ principalID,
)
if err != nil {
@@ -136,7 +136,7 @@ func (s *InboxService) FindInboxSummary(ctx context.Context, principalId int) (*
row2, err := tx.QueryContext(ctx, `
SELECT EXISTS (SELECT 1 FROM inbox, activity WHERE inbox.receiver_id = ? AND inbox.status = 'UNREAD' AND inbox.activity_id = activity.id AND activity.level = 'ERROR')
`,
- principalId,
+ principalID,
)
if err != nil {
@@ -169,8 +169,8 @@ func (s *InboxService) createInbox(ctx context.Context, tx *Tx, create *api.Inbo
VALUES (?, ?, 'UNREAD')
RETURNING id, receiver_id, activity_id, `+"`status`"+`
`,
- create.ReceiverId,
- create.ActivityId,
+ create.ReceiverID,
+ create.ActivityID,
)
if err != nil {
@@ -180,18 +180,18 @@ func (s *InboxService) createInbox(ctx context.Context, tx *Tx, create *api.Inbo
row.Next()
var inbox api.Inbox
- var activityId int
+ var activityID int
if err := row.Scan(
&inbox.ID,
- &inbox.ReceiverId,
- &activityId,
+ &inbox.ReceiverID,
+ &activityID,
&inbox.Status,
); err != nil {
return nil, FormatError(err)
}
activityFind := &api.ActivityFind{
- ID: &activityId,
+ ID: &activityID,
}
inbox.Activity, err = s.activityService.FindActivity(ctx, activityFind)
if err != nil {
@@ -208,7 +208,7 @@ func findInboxList(ctx context.Context, tx *Tx, find *api.InboxFind) (_ []*api.I
if v := find.ID; v != nil {
where, args = append(where, "inbox.id = ?"), append(args, *v)
}
- if v := find.ReceiverId; v != nil {
+ if v := find.ReceiverID; v != nil {
where, args = append(where, "receiver_id = ?"), append(args, *v)
}
if v := find.ReadCreatedAfterTs; v != nil {
@@ -247,14 +247,14 @@ func findInboxList(ctx context.Context, tx *Tx, find *api.InboxFind) (_ []*api.I
inbox.Activity = &api.Activity{}
if err := rows.Scan(
&inbox.ID,
- &inbox.ReceiverId,
+ &inbox.ReceiverID,
&inbox.Status,
&inbox.Activity.ID,
- &inbox.Activity.CreatorId,
+ &inbox.Activity.CreatorID,
&inbox.Activity.CreatedTs,
- &inbox.Activity.UpdaterId,
+ &inbox.Activity.UpdaterID,
&inbox.Activity.UpdatedTs,
- &inbox.Activity.ContainerId,
+ &inbox.Activity.ContainerID,
&inbox.Activity.Type,
&inbox.Activity.Level,
&inbox.Activity.Comment,
@@ -294,18 +294,18 @@ func (s *InboxService) patchInbox(ctx context.Context, tx *Tx, patch *api.InboxP
if row.Next() {
var inbox api.Inbox
- var activityId int
+ var activityID int
if err := row.Scan(
&inbox.ID,
- &inbox.ReceiverId,
- &activityId,
+ &inbox.ReceiverID,
+ &activityID,
&inbox.Status,
); err != nil {
return nil, FormatError(err)
}
activityFind := &api.ActivityFind{
- ID: &activityId,
+ ID: &activityID,
}
inbox.Activity, err = s.activityService.FindActivity(ctx, activityFind)
if err != nil {
diff --git a/store/instance.go b/store/instance.go
index 10ace68491..1667dd123c 100644
--- a/store/instance.go
+++ b/store/instance.go
@@ -45,10 +45,10 @@ func (s *InstanceService) CreateInstance(ctx context.Context, create *api.Instan
// Create * database
databaseCreate := &api.DatabaseCreate{
- CreatorId: create.CreatorId,
- ProjectId: api.DEFAULT_PROJECT_ID,
- InstanceId: instance.ID,
- EnvironmentId: instance.EnvironmentId,
+ CreatorID: create.CreatorID,
+ ProjectID: api.DEFAULT_PROJECT_ID,
+ InstanceID: instance.ID,
+ EnvironmentID: instance.EnvironmentID,
Name: api.ALL_DATABASE_NAME,
CharacterSet: api.DEFAULT_CHARACTER_SET_NAME,
Collation: api.DEFAULT_COLLATION_NAME,
@@ -60,9 +60,9 @@ func (s *InstanceService) CreateInstance(ctx context.Context, create *api.Instan
// Create admin data source
adminDataSourceCreate := &api.DataSourceCreate{
- CreatorId: create.CreatorId,
- InstanceId: instance.ID,
- DatabaseId: allDatabase.ID,
+ CreatorID: create.CreatorID,
+ InstanceID: instance.ID,
+ DatabaseID: allDatabase.ID,
Name: api.ADMIN_DATA_SOURCE_NAME,
Type: api.Admin,
Username: create.Username,
@@ -187,9 +187,9 @@ func createInstance(ctx context.Context, tx *Tx, create *api.InstanceCreate) (*a
VALUES (?, ?, ?, ?, ?, ?, ?, ?)
RETURNING id, row_status, creator_id, created_ts, updater_id, updated_ts, environment_id, name, engine, engine_version, external_link, host, port
`,
- create.CreatorId,
- create.CreatorId,
- create.EnvironmentId,
+ create.CreatorID,
+ create.CreatorID,
+ create.EnvironmentID,
create.Name,
create.Engine,
create.ExternalLink,
@@ -207,11 +207,11 @@ func createInstance(ctx context.Context, tx *Tx, create *api.InstanceCreate) (*a
if err := row.Scan(
&instance.ID,
&instance.RowStatus,
- &instance.CreatorId,
+ &instance.CreatorID,
&instance.CreatedTs,
- &instance.UpdaterId,
+ &instance.UpdaterID,
&instance.UpdatedTs,
- &instance.EnvironmentId,
+ &instance.EnvironmentID,
&instance.Name,
&instance.Engine,
&instance.EngineVersion,
@@ -266,11 +266,11 @@ func findInstanceList(ctx context.Context, tx *Tx, find *api.InstanceFind) (_ []
if err := rows.Scan(
&instance.ID,
&instance.RowStatus,
- &instance.CreatorId,
+ &instance.CreatorID,
&instance.CreatedTs,
- &instance.UpdaterId,
+ &instance.UpdaterID,
&instance.UpdatedTs,
- &instance.EnvironmentId,
+ &instance.EnvironmentID,
&instance.Name,
&instance.Engine,
&instance.EngineVersion,
@@ -293,7 +293,7 @@ func findInstanceList(ctx context.Context, tx *Tx, find *api.InstanceFind) (_ []
// patchInstance updates a instance by ID. Returns the new state of the instance after update.
func patchInstance(ctx context.Context, tx *Tx, patch *api.InstancePatch) (*api.Instance, error) {
// Build UPDATE clause.
- set, args := []string{"updater_id = ?"}, []interface{}{patch.UpdaterId}
+ set, args := []string{"updater_id = ?"}, []interface{}{patch.UpdaterID}
if v := patch.RowStatus; v != nil {
set, args = append(set, "row_status = ?"), append(args, api.RowStatus(*v))
}
@@ -334,11 +334,11 @@ func patchInstance(ctx context.Context, tx *Tx, patch *api.InstancePatch) (*api.
if err := row.Scan(
&instance.ID,
&instance.RowStatus,
- &instance.CreatorId,
+ &instance.CreatorID,
&instance.CreatedTs,
- &instance.UpdaterId,
+ &instance.UpdaterID,
&instance.UpdatedTs,
- &instance.EnvironmentId,
+ &instance.EnvironmentID,
&instance.Name,
&instance.Engine,
&instance.EngineVersion,
diff --git a/store/instance_user.go b/store/instance_user.go
index 9fbc50143a..1fe1823f6b 100644
--- a/store/instance_user.go
+++ b/store/instance_user.go
@@ -99,9 +99,9 @@ func upsertInstanceUser(ctx context.Context, tx *Tx, upsert *api.InstanceUserUps
grant = excluded.grant
RETURNING id, instance_id, name, grant
`,
- upsert.CreatorId,
- upsert.CreatorId,
- upsert.InstanceId,
+ upsert.CreatorID,
+ upsert.CreatorID,
+ upsert.InstanceID,
upsert.Name,
upsert.Grant,
)
@@ -115,7 +115,7 @@ func upsertInstanceUser(ctx context.Context, tx *Tx, upsert *api.InstanceUserUps
var instanceUser api.InstanceUser
if err := row.Scan(
&instanceUser.ID,
- &instanceUser.InstanceId,
+ &instanceUser.InstanceID,
&instanceUser.Name,
&instanceUser.Grant,
); err != nil {
@@ -128,7 +128,7 @@ func upsertInstanceUser(ctx context.Context, tx *Tx, upsert *api.InstanceUserUps
func findInstanceUserList(ctx context.Context, tx *Tx, find *api.InstanceUserFind) (_ []*api.InstanceUser, err error) {
// Build WHERE clause.
where, args := []string{"1 = 1"}, []interface{}{}
- where, args = append(where, "instance_id = ?"), append(args, find.InstanceId)
+ where, args = append(where, "instance_id = ?"), append(args, find.InstanceID)
rows, err := tx.QueryContext(ctx, `
SELECT
@@ -153,7 +153,7 @@ func findInstanceUserList(ctx context.Context, tx *Tx, find *api.InstanceUserFin
var instanceUser api.InstanceUser
if err := rows.Scan(
&instanceUser.ID,
- &instanceUser.InstanceId,
+ &instanceUser.InstanceID,
&instanceUser.Name,
&instanceUser.Grant,
); err != nil {
diff --git a/store/issue.go b/store/issue.go
index 5810eb1248..7d4fc3f937 100644
--- a/store/issue.go
+++ b/store/issue.go
@@ -145,14 +145,14 @@ func (s *IssueService) createIssue(ctx context.Context, tx *Tx, create *api.Issu
VALUES (?, ?, ?, ?, ?, 'OPEN', ?, ?, ?, ?)
RETURNING id, creator_id, created_ts, updater_id, updated_ts, project_id, pipeline_id, name, `+"`status`, `type`, description, assignee_id, payload"+`
`,
- create.CreatorId,
- create.CreatorId,
- create.ProjectId,
- create.PipelineId,
+ create.CreatorID,
+ create.CreatorID,
+ create.ProjectID,
+ create.PipelineID,
create.Name,
create.Type,
create.Description,
- create.AssigneeId,
+ create.AssigneeID,
create.Payload,
)
@@ -165,17 +165,17 @@ func (s *IssueService) createIssue(ctx context.Context, tx *Tx, create *api.Issu
var issue api.Issue
if err := row.Scan(
&issue.ID,
- &issue.CreatorId,
+ &issue.CreatorID,
&issue.CreatedTs,
- &issue.UpdaterId,
+ &issue.UpdaterID,
&issue.UpdatedTs,
- &issue.ProjectId,
- &issue.PipelineId,
+ &issue.ProjectID,
+ &issue.PipelineID,
&issue.Name,
&issue.Status,
&issue.Type,
&issue.Description,
- &issue.AssigneeId,
+ &issue.AssigneeID,
&issue.Payload,
); err != nil {
return nil, FormatError(err)
@@ -190,13 +190,13 @@ func (s *IssueService) findIssueList(ctx context.Context, tx *Tx, find *api.Issu
if v := find.ID; v != nil {
where, args = append(where, "id = ?"), append(args, *v)
}
- if v := find.PipelineId; v != nil {
+ if v := find.PipelineID; v != nil {
where, args = append(where, "pipeline_id = ?"), append(args, *v)
}
- if v := find.ProjectId; v != nil {
+ if v := find.ProjectID; v != nil {
where, args = append(where, "project_id = ?"), append(args, *v)
}
- if v := find.PrincipalId; v != nil {
+ if v := find.PrincipalID; v != nil {
where = append(where, "(creator_id = ? OR assignee_id = ? OR EXISTS (SELECT 1 FROM issue_subscriber WHERE issue_id = issue.id AND subscriber_id = ?))")
args = append(args, *v)
args = append(args, *v)
@@ -244,17 +244,17 @@ func (s *IssueService) findIssueList(ctx context.Context, tx *Tx, find *api.Issu
var issue api.Issue
if err := rows.Scan(
&issue.ID,
- &issue.CreatorId,
+ &issue.CreatorID,
&issue.CreatedTs,
- &issue.UpdaterId,
+ &issue.UpdaterID,
&issue.UpdatedTs,
- &issue.ProjectId,
- &issue.PipelineId,
+ &issue.ProjectID,
+ &issue.PipelineID,
&issue.Name,
&issue.Status,
&issue.Type,
&issue.Description,
- &issue.AssigneeId,
+ &issue.AssigneeID,
&issue.Payload,
); err != nil {
return nil, FormatError(err)
@@ -272,7 +272,7 @@ func (s *IssueService) findIssueList(ctx context.Context, tx *Tx, find *api.Issu
// patchIssue updates a issue by ID. Returns the new state of the issue after update.
func (s *IssueService) patchIssue(ctx context.Context, tx *Tx, patch *api.IssuePatch) (*api.Issue, error) {
// Build UPDATE clause.
- set, args := []string{"updater_id = ?"}, []interface{}{patch.UpdaterId}
+ set, args := []string{"updater_id = ?"}, []interface{}{patch.UpdaterID}
if v := patch.Name; v != nil {
set, args = append(set, "name = ?"), append(args, *v)
}
@@ -282,7 +282,7 @@ func (s *IssueService) patchIssue(ctx context.Context, tx *Tx, patch *api.IssueP
if v := patch.Description; v != nil {
set, args = append(set, "description = ?"), append(args, *v)
}
- if v := patch.AssigneeId; v != nil {
+ if v := patch.AssigneeID; v != nil {
set, args = append(set, "assignee_id = ?"), append(args, *v)
}
if v := patch.Payload; v != nil {
@@ -313,17 +313,17 @@ func (s *IssueService) patchIssue(ctx context.Context, tx *Tx, patch *api.IssueP
var issue api.Issue
if err := row.Scan(
&issue.ID,
- &issue.CreatorId,
+ &issue.CreatorID,
&issue.CreatedTs,
- &issue.UpdaterId,
+ &issue.UpdaterID,
&issue.UpdatedTs,
- &issue.ProjectId,
- &issue.PipelineId,
+ &issue.ProjectID,
+ &issue.PipelineID,
&issue.Name,
&issue.Status,
&issue.Type,
&issue.Description,
- &issue.AssigneeId,
+ &issue.AssigneeID,
&issue.Payload,
); err != nil {
return nil, FormatError(err)
diff --git a/store/issue_subscriber.go b/store/issue_subscriber.go
index 75db2bb8e8..4bc43fa3a8 100644
--- a/store/issue_subscriber.go
+++ b/store/issue_subscriber.go
@@ -93,8 +93,8 @@ func createIssueSubscriber(ctx context.Context, tx *Tx, create *api.IssueSubscri
VALUES (?, ?)
RETURNING issue_id, subscriber_id
`,
- create.IssueId,
- create.SubscriberId,
+ create.IssueID,
+ create.SubscriberID,
)
if err != nil {
@@ -105,8 +105,8 @@ func createIssueSubscriber(ctx context.Context, tx *Tx, create *api.IssueSubscri
row.Next()
var issueSubscriber api.IssueSubscriber
if err := row.Scan(
- &issueSubscriber.IssueId,
- &issueSubscriber.SubscriberId,
+ &issueSubscriber.IssueID,
+ &issueSubscriber.SubscriberID,
); err != nil {
return nil, FormatError(err)
}
@@ -117,10 +117,10 @@ func createIssueSubscriber(ctx context.Context, tx *Tx, create *api.IssueSubscri
func findIssueSubscriberList(ctx context.Context, tx *Tx, find *api.IssueSubscriberFind) (_ []*api.IssueSubscriber, err error) {
// Build WHERE clause.
where, args := []string{"1 = 1"}, []interface{}{}
- if v := find.IssueId; v != nil {
+ if v := find.IssueID; v != nil {
where, args = append(where, "issue_id = ?"), append(args, *v)
}
- if v := find.SubscriberId; v != nil {
+ if v := find.SubscriberID; v != nil {
where, args = append(where, "subscriber_id = ?"), append(args, *v)
}
@@ -142,8 +142,8 @@ func findIssueSubscriberList(ctx context.Context, tx *Tx, find *api.IssueSubscri
for rows.Next() {
var issueSubscriber api.IssueSubscriber
if err := rows.Scan(
- &issueSubscriber.IssueId,
- &issueSubscriber.SubscriberId,
+ &issueSubscriber.IssueID,
+ &issueSubscriber.SubscriberID,
); err != nil {
return nil, FormatError(err)
}
@@ -160,14 +160,14 @@ func findIssueSubscriberList(ctx context.Context, tx *Tx, find *api.IssueSubscri
// deleteIssueSubscriber permanently deletes a issueSubscriber by ID.
func deleteIssueSubscriber(ctx context.Context, tx *Tx, delete *api.IssueSubscriberDelete) error {
// Remove row from database.
- result, err := tx.ExecContext(ctx, `DELETE FROM issue_subscriber WHERE issue_id = ? AND subscriber_id = ?`, delete.IssueId, delete.SubscriberId)
+ result, err := tx.ExecContext(ctx, `DELETE FROM issue_subscriber WHERE issue_id = ? AND subscriber_id = ?`, delete.IssueID, delete.SubscriberID)
if err != nil {
return FormatError(err)
}
rows, _ := result.RowsAffected()
if rows == 0 {
- return &common.Error{Code: common.NotFound, Err: fmt.Errorf("subscriber %d not found in issue %d", delete.SubscriberId, delete.IssueId)}
+ return &common.Error{Code: common.NotFound, Err: fmt.Errorf("subscriber %d not found in issue %d", delete.SubscriberID, delete.IssueID)}
}
return nil
diff --git a/store/member.go b/store/member.go
index 0b3e894159..6749efd8fc 100644
--- a/store/member.go
+++ b/store/member.go
@@ -44,7 +44,7 @@ func (s *MemberService) CreateMember(ctx context.Context, create *api.MemberCrea
return nil, FormatError(err)
}
- if err := s.cache.UpsertCache(api.MemberCache, member.PrincipalId, member); err != nil {
+ if err := s.cache.UpsertCache(api.MemberCache, member.PrincipalID, member); err != nil {
return nil, err
}
@@ -66,7 +66,7 @@ func (s *MemberService) FindMemberList(ctx context.Context, find *api.MemberFind
if err == nil {
for _, member := range list {
- if err := s.cache.UpsertCache(api.MemberCache, member.PrincipalId, member); err != nil {
+ if err := s.cache.UpsertCache(api.MemberCache, member.PrincipalID, member); err != nil {
return nil, err
}
}
@@ -79,9 +79,9 @@ func (s *MemberService) FindMemberList(ctx context.Context, find *api.MemberFind
// Returns ENOTFOUND if no matching record.
// Returns ECONFLICT if finding more than 1 matching records.
func (s *MemberService) FindMember(ctx context.Context, find *api.MemberFind) (*api.Member, error) {
- if find.PrincipalId != nil {
+ if find.PrincipalID != nil {
member := &api.Member{}
- has, err := s.cache.FindCache(api.MemberCache, *find.PrincipalId, member)
+ has, err := s.cache.FindCache(api.MemberCache, *find.PrincipalID, member)
if err != nil {
return nil, err
}
@@ -105,7 +105,7 @@ func (s *MemberService) FindMember(ctx context.Context, find *api.MemberFind) (*
return nil, &common.Error{Code: common.Conflict, Err: fmt.Errorf("found %d members with filter %+v, expect 1", len(list), find)}
}
- if err := s.cache.UpsertCache(api.MemberCache, list[0].PrincipalId, list[0]); err != nil {
+ if err := s.cache.UpsertCache(api.MemberCache, list[0].PrincipalID, list[0]); err != nil {
return nil, err
}
@@ -130,7 +130,7 @@ func (s *MemberService) PatchMember(ctx context.Context, patch *api.MemberPatch)
return nil, FormatError(err)
}
- if err := s.cache.UpsertCache(api.MemberCache, member.PrincipalId, member); err != nil {
+ if err := s.cache.UpsertCache(api.MemberCache, member.PrincipalID, member); err != nil {
return nil, err
}
@@ -151,11 +151,11 @@ func createMember(ctx context.Context, tx *Tx, create *api.MemberCreate) (*api.M
VALUES (?, ?, ?, ?, ?)
RETURNING id, row_status, creator_id, created_ts, updater_id, updated_ts, `+"`status`, role, principal_id"+`
`,
- create.CreatorId,
- create.CreatorId,
+ create.CreatorID,
+ create.CreatorID,
create.Status,
create.Role,
- create.PrincipalId,
+ create.PrincipalID,
)
if err != nil {
@@ -168,13 +168,13 @@ func createMember(ctx context.Context, tx *Tx, create *api.MemberCreate) (*api.M
if err := row.Scan(
&member.ID,
&member.RowStatus,
- &member.CreatorId,
+ &member.CreatorID,
&member.CreatedTs,
- &member.UpdaterId,
+ &member.UpdaterID,
&member.UpdatedTs,
&member.Status,
&member.Role,
- &member.PrincipalId,
+ &member.PrincipalID,
); err != nil {
return nil, FormatError(err)
}
@@ -188,7 +188,7 @@ func findMemberList(ctx context.Context, tx *Tx, find *api.MemberFind) (_ []*api
if v := find.ID; v != nil {
where, args = append(where, "id = ?"), append(args, *v)
}
- if v := find.PrincipalId; v != nil {
+ if v := find.PrincipalID; v != nil {
where, args = append(where, "principal_id = ?"), append(args, *v)
}
if v := find.Role; v != nil {
@@ -222,13 +222,13 @@ func findMemberList(ctx context.Context, tx *Tx, find *api.MemberFind) (_ []*api
if err := rows.Scan(
&member.ID,
&member.RowStatus,
- &member.CreatorId,
+ &member.CreatorID,
&member.CreatedTs,
- &member.UpdaterId,
+ &member.UpdaterID,
&member.UpdatedTs,
&member.Status,
&member.Role,
- &member.PrincipalId,
+ &member.PrincipalID,
); err != nil {
return nil, FormatError(err)
}
@@ -245,7 +245,7 @@ func findMemberList(ctx context.Context, tx *Tx, find *api.MemberFind) (_ []*api
// patchMember updates a member by ID. Returns the new state of the member after update.
func patchMember(ctx context.Context, tx *Tx, patch *api.MemberPatch) (*api.Member, error) {
// Build UPDATE clause.
- set, args := []string{"updater_id = ?"}, []interface{}{patch.UpdaterId}
+ set, args := []string{"updater_id = ?"}, []interface{}{patch.UpdaterID}
if v := patch.RowStatus; v != nil {
set, args = append(set, "row_status = ?"), append(args, api.RowStatus(*v))
}
@@ -274,13 +274,13 @@ func patchMember(ctx context.Context, tx *Tx, patch *api.MemberPatch) (*api.Memb
if err := row.Scan(
&member.ID,
&member.RowStatus,
- &member.CreatorId,
+ &member.CreatorID,
&member.CreatedTs,
- &member.UpdaterId,
+ &member.UpdaterID,
&member.UpdatedTs,
&member.Status,
&member.Role,
- &member.PrincipalId,
+ &member.PrincipalID,
); err != nil {
return nil, FormatError(err)
}
diff --git a/store/pipeline.go b/store/pipeline.go
index 451834bfcd..1f1ecd34b5 100644
--- a/store/pipeline.go
+++ b/store/pipeline.go
@@ -149,8 +149,8 @@ func (s *PipelineService) createPipeline(ctx context.Context, tx *Tx, create *ap
VALUES (?, ?, ?, 'OPEN')
RETURNING id, creator_id, created_ts, updater_id, updated_ts, name, `+"`status`"+`
`,
- create.CreatorId,
- create.CreatorId,
+ create.CreatorID,
+ create.CreatorID,
create.Name,
)
@@ -163,9 +163,9 @@ func (s *PipelineService) createPipeline(ctx context.Context, tx *Tx, create *ap
var pipeline api.Pipeline
if err := row.Scan(
&pipeline.ID,
- &pipeline.CreatorId,
+ &pipeline.CreatorID,
&pipeline.CreatedTs,
- &pipeline.UpdaterId,
+ &pipeline.UpdaterID,
&pipeline.UpdatedTs,
&pipeline.Name,
&pipeline.Status,
@@ -210,9 +210,9 @@ func (s *PipelineService) findPipelineList(ctx context.Context, tx *Tx, find *ap
var pipeline api.Pipeline
if err := rows.Scan(
&pipeline.ID,
- &pipeline.CreatorId,
+ &pipeline.CreatorID,
&pipeline.CreatedTs,
- &pipeline.UpdaterId,
+ &pipeline.UpdaterID,
&pipeline.UpdatedTs,
&pipeline.Name,
&pipeline.Status,
@@ -232,7 +232,7 @@ func (s *PipelineService) findPipelineList(ctx context.Context, tx *Tx, find *ap
// patchPipeline updates a pipeline by ID. Returns the new state of the pipeline after update.
func (s *PipelineService) patchPipeline(ctx context.Context, tx *Tx, patch *api.PipelinePatch) (*api.Pipeline, error) {
// Build UPDATE clause.
- set, args := []string{"updater_id = ?"}, []interface{}{patch.UpdaterId}
+ set, args := []string{"updater_id = ?"}, []interface{}{patch.UpdaterID}
if v := patch.Status; v != nil {
set, args = append(set, "status = ?"), append(args, api.PipelineStatus(*v))
}
@@ -257,9 +257,9 @@ func (s *PipelineService) patchPipeline(ctx context.Context, tx *Tx, patch *api.
var pipeline api.Pipeline
if err := row.Scan(
&pipeline.ID,
- &pipeline.CreatorId,
+ &pipeline.CreatorID,
&pipeline.CreatedTs,
- &pipeline.UpdaterId,
+ &pipeline.UpdaterID,
&pipeline.UpdatedTs,
&pipeline.Name,
&pipeline.Status,
diff --git a/store/policy.go b/store/policy.go
index e94b09234c..e801348703 100644
--- a/store/policy.go
+++ b/store/policy.go
@@ -49,9 +49,9 @@ func (s *PolicyService) FindPolicy(ctx context.Context, find *api.PolicyFind) (*
return nil, err
} else if len(list) == 0 {
ret = &api.Policy{
- CreatorId: api.SYSTEM_BOT_ID,
- UpdaterId: api.SYSTEM_BOT_ID,
- EnvironmentId: *find.EnvironmentId,
+ CreatorID: api.SYSTEM_BOT_ID,
+ UpdaterID: api.SYSTEM_BOT_ID,
+ EnvironmentID: *find.EnvironmentID,
Type: *find.Type,
}
} else if len(list) > 1 {
@@ -77,7 +77,7 @@ func (s *PolicyService) findPolicy(ctx context.Context, tx *Tx, find *api.Policy
if v := find.ID; v != nil {
where, args = append(where, "id = ?"), append(args, *v)
}
- if v := find.EnvironmentId; v != nil {
+ if v := find.EnvironmentID; v != nil {
where, args = append(where, "environment_id = ?"), append(args, *v)
}
if v := find.Type; v != nil {
@@ -109,11 +109,11 @@ func (s *PolicyService) findPolicy(ctx context.Context, tx *Tx, find *api.Policy
var policy api.Policy
if err := rows.Scan(
&policy.ID,
- &policy.CreatorId,
+ &policy.CreatorID,
&policy.CreatedTs,
- &policy.UpdaterId,
+ &policy.UpdaterID,
&policy.UpdatedTs,
- &policy.EnvironmentId,
+ &policy.EnvironmentID,
&policy.Type,
&policy.Payload,
); err != nil {
@@ -172,9 +172,9 @@ func (s *PolicyService) upsertPolicy(ctx context.Context, tx *Tx, upsert *api.Po
payload = excluded.payload
RETURNING id, creator_id, created_ts, updater_id, updated_ts, environment_id, type, payload
`,
- upsert.UpdaterId,
- upsert.UpdaterId,
- upsert.EnvironmentId,
+ upsert.UpdaterID,
+ upsert.UpdaterID,
+ upsert.EnvironmentID,
upsert.Type,
upsert.Payload,
)
@@ -188,11 +188,11 @@ func (s *PolicyService) upsertPolicy(ctx context.Context, tx *Tx, upsert *api.Po
var policy api.Policy
if err := row.Scan(
&policy.ID,
- &policy.CreatorId,
+ &policy.CreatorID,
&policy.CreatedTs,
- &policy.UpdaterId,
+ &policy.UpdaterID,
&policy.UpdatedTs,
- &policy.EnvironmentId,
+ &policy.EnvironmentID,
&policy.Type,
&policy.Payload,
); err != nil {
@@ -206,7 +206,7 @@ func (s *PolicyService) upsertPolicy(ctx context.Context, tx *Tx, upsert *api.Po
func (s *PolicyService) GetBackupPlanPolicy(ctx context.Context, environmentID int) (*api.BackupPlanPolicy, error) {
pType := api.PolicyTypeBackupPlan
policy, err := s.FindPolicy(ctx, &api.PolicyFind{
- EnvironmentId: &environmentID,
+ EnvironmentID: &environmentID,
Type: &pType,
})
if err != nil {
@@ -219,7 +219,7 @@ func (s *PolicyService) GetBackupPlanPolicy(ctx context.Context, environmentID i
func (s *PolicyService) GetPipelineApprovalPolicy(ctx context.Context, environmentID int) (*api.PipelineApprovalPolicy, error) {
pType := api.PolicyTypePipelineApproval
policy, err := s.FindPolicy(ctx, &api.PolicyFind{
- EnvironmentId: &environmentID,
+ EnvironmentID: &environmentID,
Type: &pType,
})
if err != nil {
diff --git a/store/principal.go b/store/principal.go
index d7eef12db8..bb46846f90 100644
--- a/store/principal.go
+++ b/store/principal.go
@@ -152,8 +152,8 @@ func createPrincipal(ctx context.Context, tx *Tx, create *api.PrincipalCreate) (
VALUES (?, ?, ?, ?, ?, ?)
RETURNING id, creator_id, created_ts, updater_id, updated_ts, type, name, email, password_hash
`,
- create.CreatorId,
- create.CreatorId,
+ create.CreatorID,
+ create.CreatorID,
create.Type,
create.Name,
create.Email,
@@ -169,9 +169,9 @@ func createPrincipal(ctx context.Context, tx *Tx, create *api.PrincipalCreate) (
var principal api.Principal
if err := row.Scan(
&principal.ID,
- &principal.CreatorId,
+ &principal.CreatorID,
&principal.CreatedTs,
- &principal.UpdaterId,
+ &principal.UpdaterID,
&principal.UpdatedTs,
&principal.Type,
&principal.Name,
@@ -220,9 +220,9 @@ func findPrincipalList(ctx context.Context, tx *Tx, find *api.PrincipalFind) (_
var principal api.Principal
if err := rows.Scan(
&principal.ID,
- &principal.CreatorId,
+ &principal.CreatorID,
&principal.CreatedTs,
- &principal.UpdaterId,
+ &principal.UpdaterID,
&principal.UpdatedTs,
&principal.Type,
&principal.Name,
@@ -243,7 +243,7 @@ func findPrincipalList(ctx context.Context, tx *Tx, find *api.PrincipalFind) (_
// patchPrincipal updates a principal by ID. Returns the new state of the principal after update.
func patchPrincipal(ctx context.Context, tx *Tx, patch *api.PrincipalPatch) (*api.Principal, error) {
- set, args := []string{"updater_id = ?"}, []interface{}{patch.UpdaterId}
+ set, args := []string{"updater_id = ?"}, []interface{}{patch.UpdaterID}
if v := patch.Name; v != nil {
set, args = append(set, "name = ?"), append(args, *v)
}
@@ -271,9 +271,9 @@ func patchPrincipal(ctx context.Context, tx *Tx, patch *api.PrincipalPatch) (*ap
var principal api.Principal
if err := row.Scan(
&principal.ID,
- &principal.CreatorId,
+ &principal.CreatorID,
&principal.CreatedTs,
- &principal.UpdaterId,
+ &principal.UpdaterID,
&principal.UpdatedTs,
&principal.Type,
&principal.Name,
diff --git a/store/project.go b/store/project.go
index ead43239dd..a771c1c4ff 100644
--- a/store/project.go
+++ b/store/project.go
@@ -169,8 +169,8 @@ func createProject(ctx context.Context, tx *Tx, create *api.ProjectCreate) (*api
VALUES (?, ?, ?, ?, 'UI', 'PUBLIC')
RETURNING id, row_status, creator_id, created_ts, updater_id, updated_ts, name, `+"`key`, workflow_type, visibility"+`
`,
- create.CreatorId,
- create.CreatorId,
+ create.CreatorID,
+ create.CreatorID,
create.Name,
strings.ToUpper(create.Key),
)
@@ -185,9 +185,9 @@ func createProject(ctx context.Context, tx *Tx, create *api.ProjectCreate) (*api
if err := row.Scan(
&project.ID,
&project.RowStatus,
- &project.CreatorId,
+ &project.CreatorID,
&project.CreatedTs,
- &project.UpdaterId,
+ &project.UpdaterID,
&project.UpdatedTs,
&project.Name,
&project.Key,
@@ -209,7 +209,7 @@ func findProjectList(ctx context.Context, tx *Tx, find *api.ProjectFind) (_ []*a
if v := find.RowStatus; v != nil {
where, args = append(where, "row_status = ?"), append(args, *v)
}
- if v := find.PrincipalId; v != nil {
+ if v := find.PrincipalID; v != nil {
where, args = append(where, "id IN (SELECT project_id FROM project_member WHERE principal_id = ?)"), append(args, *v)
}
@@ -241,9 +241,9 @@ func findProjectList(ctx context.Context, tx *Tx, find *api.ProjectFind) (_ []*a
if err := rows.Scan(
&project.ID,
&project.RowStatus,
- &project.CreatorId,
+ &project.CreatorID,
&project.CreatedTs,
- &project.UpdaterId,
+ &project.UpdaterID,
&project.UpdatedTs,
&project.Name,
&project.Key,
@@ -265,7 +265,7 @@ func findProjectList(ctx context.Context, tx *Tx, find *api.ProjectFind) (_ []*a
// patchProject updates a project by ID. Returns the new state of the project after update.
func patchProject(ctx context.Context, tx *sql.Tx, patch *api.ProjectPatch) (*api.Project, error) {
// Build UPDATE clause.
- set, args := []string{"updater_id = ?"}, []interface{}{patch.UpdaterId}
+ set, args := []string{"updater_id = ?"}, []interface{}{patch.UpdaterID}
if v := patch.RowStatus; v != nil {
set, args = append(set, "row_status = ?"), append(args, api.RowStatus(*v))
}
@@ -300,9 +300,9 @@ func patchProject(ctx context.Context, tx *sql.Tx, patch *api.ProjectPatch) (*ap
if err := row.Scan(
&project.ID,
&project.RowStatus,
- &project.CreatorId,
+ &project.CreatorID,
&project.CreatedTs,
- &project.UpdaterId,
+ &project.UpdaterID,
&project.UpdatedTs,
&project.Name,
&project.Key,
diff --git a/store/project_member.go b/store/project_member.go
index 9e16b98a66..4ff9eb1af7 100644
--- a/store/project_member.go
+++ b/store/project_member.go
@@ -135,11 +135,11 @@ func createProjectMember(ctx context.Context, tx *Tx, create *api.ProjectMemberC
VALUES (?, ?, ?, ?, ?)
RETURNING id, creator_id, created_ts, updater_id, updated_ts, project_id, role, principal_id
`,
- create.CreatorId,
- create.CreatorId,
- create.ProjectId,
+ create.CreatorID,
+ create.CreatorID,
+ create.ProjectID,
create.Role,
- create.PrincipalId,
+ create.PrincipalID,
)
if err != nil {
@@ -151,13 +151,13 @@ func createProjectMember(ctx context.Context, tx *Tx, create *api.ProjectMemberC
var projectMember api.ProjectMember
if err := row.Scan(
&projectMember.ID,
- &projectMember.CreatorId,
+ &projectMember.CreatorID,
&projectMember.CreatedTs,
- &projectMember.UpdaterId,
+ &projectMember.UpdaterID,
&projectMember.UpdatedTs,
- &projectMember.ProjectId,
+ &projectMember.ProjectID,
&projectMember.Role,
- &projectMember.PrincipalId,
+ &projectMember.PrincipalID,
); err != nil {
return nil, FormatError(err)
}
@@ -171,7 +171,7 @@ func findProjectMemberList(ctx context.Context, tx *Tx, find *api.ProjectMemberF
if v := find.ID; v != nil {
where, args = append(where, "id = ?"), append(args, *v)
}
- if v := find.ProjectId; v != nil {
+ if v := find.ProjectID; v != nil {
where, args = append(where, "project_id = ?"), append(args, *v)
}
@@ -200,13 +200,13 @@ func findProjectMemberList(ctx context.Context, tx *Tx, find *api.ProjectMemberF
var projectMember api.ProjectMember
if err := rows.Scan(
&projectMember.ID,
- &projectMember.CreatorId,
+ &projectMember.CreatorID,
&projectMember.CreatedTs,
- &projectMember.UpdaterId,
+ &projectMember.UpdaterID,
&projectMember.UpdatedTs,
- &projectMember.ProjectId,
+ &projectMember.ProjectID,
&projectMember.Role,
- &projectMember.PrincipalId,
+ &projectMember.PrincipalID,
); err != nil {
return nil, FormatError(err)
}
@@ -223,7 +223,7 @@ func findProjectMemberList(ctx context.Context, tx *Tx, find *api.ProjectMemberF
// patchProjectMember updates a projectMember by ID. Returns the new state of the projectMember after update.
func patchProjectMember(ctx context.Context, tx *Tx, patch *api.ProjectMemberPatch) (*api.ProjectMember, error) {
// Build UPDATE clause.
- set, args := []string{"updater_id = ?"}, []interface{}{patch.UpdaterId}
+ set, args := []string{"updater_id = ?"}, []interface{}{patch.UpdaterID}
if v := patch.Role; v != nil {
set, args = append(set, "role = ?"), append(args, api.Role(*v))
}
@@ -248,13 +248,13 @@ func patchProjectMember(ctx context.Context, tx *Tx, patch *api.ProjectMemberPat
var projectMember api.ProjectMember
if err := row.Scan(
&projectMember.ID,
- &projectMember.CreatorId,
+ &projectMember.CreatorID,
&projectMember.CreatedTs,
- &projectMember.UpdaterId,
+ &projectMember.UpdaterID,
&projectMember.UpdatedTs,
- &projectMember.ProjectId,
+ &projectMember.ProjectID,
&projectMember.Role,
- &projectMember.PrincipalId,
+ &projectMember.PrincipalID,
); err != nil {
return nil, FormatError(err)
}
diff --git a/store/project_webhook.go b/store/project_webhook.go
index 0a8a343127..ccc67c6ab6 100644
--- a/store/project_webhook.go
+++ b/store/project_webhook.go
@@ -140,9 +140,9 @@ func createProjectWebhook(ctx context.Context, tx *Tx, create *api.ProjectWebhoo
VALUES (?, ?, ?, ?, ?, ?, ?)
RETURNING id, creator_id, created_ts, updater_id, updated_ts, project_id, type, name, url, activity_list
`,
- create.CreatorId,
- create.CreatorId,
- create.ProjectId,
+ create.CreatorID,
+ create.CreatorID,
+ create.ProjectID,
create.Type,
create.Name,
create.URL,
@@ -159,11 +159,11 @@ func createProjectWebhook(ctx context.Context, tx *Tx, create *api.ProjectWebhoo
var activityList string
if err := row.Scan(
&projectWebhook.ID,
- &projectWebhook.CreatorId,
+ &projectWebhook.CreatorID,
&projectWebhook.CreatedTs,
- &projectWebhook.UpdaterId,
+ &projectWebhook.UpdaterID,
&projectWebhook.UpdatedTs,
- &projectWebhook.ProjectId,
+ &projectWebhook.ProjectID,
&projectWebhook.Type,
&projectWebhook.Name,
&projectWebhook.URL,
@@ -182,7 +182,7 @@ func findProjectWebhookList(ctx context.Context, tx *Tx, find *api.ProjectWebhoo
if v := find.ID; v != nil {
where, args = append(where, "id = ?"), append(args, *v)
}
- if v := find.ProjectId; v != nil {
+ if v := find.ProjectID; v != nil {
where, args = append(where, "project_id = ?"), append(args, *v)
}
@@ -214,11 +214,11 @@ func findProjectWebhookList(ctx context.Context, tx *Tx, find *api.ProjectWebhoo
var activityList string
if err := rows.Scan(
&projectWebhook.ID,
- &projectWebhook.CreatorId,
+ &projectWebhook.CreatorID,
&projectWebhook.CreatedTs,
- &projectWebhook.UpdaterId,
+ &projectWebhook.UpdaterID,
&projectWebhook.UpdatedTs,
- &projectWebhook.ProjectId,
+ &projectWebhook.ProjectID,
&projectWebhook.Type,
&projectWebhook.Name,
&projectWebhook.URL,
@@ -249,7 +249,7 @@ func findProjectWebhookList(ctx context.Context, tx *Tx, find *api.ProjectWebhoo
// patchProjectWebhook updates a projectWebhook by ID. Returns the new state of the projectWebhook after update.
func patchProjectWebhook(ctx context.Context, tx *Tx, patch *api.ProjectWebhookPatch) (*api.ProjectWebhook, error) {
// Build UPDATE clause.
- set, args := []string{"updater_id = ?"}, []interface{}{patch.UpdaterId}
+ set, args := []string{"updater_id = ?"}, []interface{}{patch.UpdaterID}
if v := patch.Name; v != nil {
set, args = append(set, "name = ?"), append(args, *v)
}
@@ -281,11 +281,11 @@ func patchProjectWebhook(ctx context.Context, tx *Tx, patch *api.ProjectWebhookP
var activityList string
if err := row.Scan(
&projectWebhook.ID,
- &projectWebhook.CreatorId,
+ &projectWebhook.CreatorID,
&projectWebhook.CreatedTs,
- &projectWebhook.UpdaterId,
+ &projectWebhook.UpdaterID,
&projectWebhook.UpdatedTs,
- &projectWebhook.ProjectId,
+ &projectWebhook.ProjectID,
&projectWebhook.Type,
&projectWebhook.Name,
&projectWebhook.URL,
diff --git a/store/repository.go b/store/repository.go
index 710145ca68..3f4c463976 100644
--- a/store/repository.go
+++ b/store/repository.go
@@ -131,8 +131,8 @@ func (s *RepositoryService) createRepository(ctx context.Context, tx *Tx, create
// Updates the project workflow_type to "VCS"
workflowType := api.VCS_WORKFLOW
projectPatch := api.ProjectPatch{
- ID: create.ProjectId,
- UpdaterId: create.CreatorId,
+ ID: create.ProjectID,
+ UpdaterID: create.CreatorID,
WorkflowType: &workflowType,
}
if _, err := s.projectService.PatchProjectTx(ctx, tx.Tx, &projectPatch); err != nil {
@@ -165,10 +165,10 @@ func (s *RepositoryService) createRepository(ctx context.Context, tx *Tx, create
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
RETURNING id, creator_id, created_ts, updater_id, updated_ts, vcs_id, project_id, name, full_path, web_url, branch_filter, base_directory, file_path_template, schema_path_template, external_id, external_webhook_id, webhook_url_host, webhook_endpoint_id, webhook_secret_token, access_token, expires_ts, refresh_token
`,
- create.CreatorId,
- create.CreatorId,
- create.VCSId,
- create.ProjectId,
+ create.CreatorID,
+ create.CreatorID,
+ create.VCSID,
+ create.ProjectID,
create.Name,
create.FullPath,
create.WebURL,
@@ -176,10 +176,10 @@ func (s *RepositoryService) createRepository(ctx context.Context, tx *Tx, create
create.BaseDirectory,
create.FilePathTemplate,
create.SchemaPathTemplate,
- create.ExternalId,
- create.ExternalWebhookId,
+ create.ExternalID,
+ create.ExternalWebhookID,
create.WebhookURLHost,
- create.WebhookEndpointId,
+ create.WebhookEndpointID,
create.WebhookSecretToken,
create.AccessToken,
create.ExpiresTs,
@@ -195,12 +195,12 @@ func (s *RepositoryService) createRepository(ctx context.Context, tx *Tx, create
var repository api.Repository
if err := row.Scan(
&repository.ID,
- &repository.CreatorId,
+ &repository.CreatorID,
&repository.CreatedTs,
- &repository.UpdaterId,
+ &repository.UpdaterID,
&repository.UpdatedTs,
- &repository.VCSId,
- &repository.ProjectId,
+ &repository.VCSID,
+ &repository.ProjectID,
&repository.Name,
&repository.FullPath,
&repository.WebURL,
@@ -208,10 +208,10 @@ func (s *RepositoryService) createRepository(ctx context.Context, tx *Tx, create
&repository.BaseDirectory,
&repository.FilePathTemplate,
&repository.SchemaPathTemplate,
- &repository.ExternalId,
- &repository.ExternalWebhookId,
+ &repository.ExternalID,
+ &repository.ExternalWebhookID,
&repository.WebhookURLHost,
- &repository.WebhookEndpointId,
+ &repository.WebhookEndpointID,
&repository.WebhookSecretToken,
&repository.AccessToken,
&repository.ExpiresTs,
@@ -229,13 +229,13 @@ func findRepositoryList(ctx context.Context, tx *Tx, find *api.RepositoryFind) (
if v := find.ID; v != nil {
where, args = append(where, "id = ?"), append(args, *v)
}
- if v := find.VCSId; v != nil {
+ if v := find.VCSID; v != nil {
where, args = append(where, "vcs_id = ?"), append(args, *v)
}
- if v := find.ProjectId; v != nil {
+ if v := find.ProjectID; v != nil {
where, args = append(where, "project_id = ?"), append(args, *v)
}
- if v := find.WebhookEndpointId; v != nil {
+ if v := find.WebhookEndpointID; v != nil {
where, args = append(where, "webhook_endpoint_id = ?"), append(args, *v)
}
@@ -278,12 +278,12 @@ func findRepositoryList(ctx context.Context, tx *Tx, find *api.RepositoryFind) (
var repository api.Repository
if err := rows.Scan(
&repository.ID,
- &repository.CreatorId,
+ &repository.CreatorID,
&repository.CreatedTs,
- &repository.UpdaterId,
+ &repository.UpdaterID,
&repository.UpdatedTs,
- &repository.VCSId,
- &repository.ProjectId,
+ &repository.VCSID,
+ &repository.ProjectID,
&repository.Name,
&repository.FullPath,
&repository.WebURL,
@@ -291,10 +291,10 @@ func findRepositoryList(ctx context.Context, tx *Tx, find *api.RepositoryFind) (
&repository.BaseDirectory,
&repository.FilePathTemplate,
&repository.SchemaPathTemplate,
- &repository.ExternalId,
- &repository.ExternalWebhookId,
+ &repository.ExternalID,
+ &repository.ExternalWebhookID,
&repository.WebhookURLHost,
- &repository.WebhookEndpointId,
+ &repository.WebhookEndpointID,
&repository.WebhookSecretToken,
&repository.AccessToken,
&repository.ExpiresTs,
@@ -315,7 +315,7 @@ func findRepositoryList(ctx context.Context, tx *Tx, find *api.RepositoryFind) (
// patchRepository updates a repository by ID. Returns the new state of the repository after update.
func patchRepository(ctx context.Context, tx *Tx, patch *api.RepositoryPatch) (*api.Repository, error) {
// Build UPDATE clause.
- set, args := []string{"updater_id = ?"}, []interface{}{patch.UpdaterId}
+ set, args := []string{"updater_id = ?"}, []interface{}{patch.UpdaterID}
if v := patch.BranchFilter; v != nil {
set, args = append(set, "branch_filter = ?"), append(args, *v)
}
@@ -349,12 +349,12 @@ func patchRepository(ctx context.Context, tx *Tx, patch *api.RepositoryPatch) (*
var repository api.Repository
if err := row.Scan(
&repository.ID,
- &repository.CreatorId,
+ &repository.CreatorID,
&repository.CreatedTs,
- &repository.UpdaterId,
+ &repository.UpdaterID,
&repository.UpdatedTs,
- &repository.VCSId,
- &repository.ProjectId,
+ &repository.VCSID,
+ &repository.ProjectID,
&repository.Name,
&repository.FullPath,
&repository.WebURL,
@@ -362,10 +362,10 @@ func patchRepository(ctx context.Context, tx *Tx, patch *api.RepositoryPatch) (*
&repository.BaseDirectory,
&repository.FilePathTemplate,
&repository.SchemaPathTemplate,
- &repository.ExternalId,
- &repository.ExternalWebhookId,
+ &repository.ExternalID,
+ &repository.ExternalWebhookID,
&repository.WebhookURLHost,
- &repository.WebhookEndpointId,
+ &repository.WebhookEndpointID,
&repository.WebhookSecretToken,
&repository.AccessToken,
&repository.ExpiresTs,
@@ -385,8 +385,8 @@ func (s *RepositoryService) deleteRepository(ctx context.Context, tx *Tx, delete
// Updates the project workflow_type to "UI"
workflowType := api.UI_WORKFLOW
projectPatch := api.ProjectPatch{
- ID: delete.ProjectId,
- UpdaterId: delete.DeleterId,
+ ID: delete.ProjectID,
+ UpdaterID: delete.DeleterID,
WorkflowType: &workflowType,
}
if _, err := s.projectService.PatchProjectTx(ctx, tx.Tx, &projectPatch); err != nil {
@@ -394,14 +394,14 @@ func (s *RepositoryService) deleteRepository(ctx context.Context, tx *Tx, delete
}
// Remove row from database.
- result, err := tx.ExecContext(ctx, `DELETE FROM repository WHERE project_id = ?`, delete.ProjectId)
+ result, err := tx.ExecContext(ctx, `DELETE FROM repository WHERE project_id = ?`, delete.ProjectID)
if err != nil {
return FormatError(err)
}
rows, _ := result.RowsAffected()
if rows == 0 {
- return &common.Error{Code: common.NotFound, Err: fmt.Errorf("repository not found for project ID: %d", delete.ProjectId)}
+ return &common.Error{Code: common.NotFound, Err: fmt.Errorf("repository not found for project ID: %d", delete.ProjectID)}
}
return nil
diff --git a/store/seed/test/10110__task.sql b/store/seed/test/10110__task.sql
index 8ba95a1444..ae791af7b3 100644
--- a/store/seed/test/10110__task.sql
+++ b/store/seed/test/10110__task.sql
@@ -60,7 +60,7 @@ VALUES
'Add initial schema',
'bb.task.database.schema.update',
'DONE',
- '{"migrationType":"BASELINE","statement":"CREATE TABLE product (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\tdescription TEXT NOT NULL\n);\n","pushEvent":{"vcsType":"GITLAB_SELF_HOST","baseDir":"bytebase","ref":"refs/heads/master","repositoryId":"14","repositoryUrl":"http://gitlab.bytebase.com/bytebase-demo/shop","repositoryFullPath":"bytebase-demo/shop","authorName":"tianzhou","fileCommit":{"id":"c80352facbaefcde0c1c82340381be3286e5438d","title":"Create product table","message":"Create product table","createdTs":1624873354,"url":"http://gitlab.bytebase.com/bytebase-demo/shop/-/commit/c80352facbaefcde0c1c82340381be3286e5438d","authorName":"tianzhou","added":"bytebase/shop__v1__baseline__add_initial_schema.sql"}}}'
+ '{"migrationType":"BASELINE","statement":"CREATE TABLE product (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\tdescription TEXT NOT NULL\n);\n","pushEvent":{"vcsType":"GITLAB_SELF_HOST","baseDir":"bytebase","ref":"refs/heads/master","repositoryID":"14","repositoryUrl":"http://gitlab.bytebase.com/bytebase-demo/shop","repositoryFullPath":"bytebase-demo/shop","authorName":"tianzhou","fileCommit":{"id":"c80352facbaefcde0c1c82340381be3286e5438d","title":"Create product table","message":"Create product table","createdTs":1624873354,"url":"http://gitlab.bytebase.com/bytebase-demo/shop/-/commit/c80352facbaefcde0c1c82340381be3286e5438d","authorName":"tianzhou","added":"bytebase/shop__v1__baseline__add_initial_schema.sql"}}}'
);
-- Task for stage 10003 "Integration" to update database 7007 'shop'
@@ -94,7 +94,7 @@ VALUES
'Add initial schema',
'bb.task.database.schema.update',
'DONE',
- '{"migrationType":"BASELINE","statement":"CREATE TABLE product (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\tdescription TEXT NOT NULL\n);\n","pushEvent":{"vcsType":"GITLAB_SELF_HOST","baseDir":"bytebase","ref":"refs/heads/master","repositoryId":"14","repositoryUrl":"http://gitlab.bytebase.com/bytebase-demo/shop","repositoryFullPath":"bytebase-demo/shop","authorName":"tianzhou","fileCommit":{"id":"c80352facbaefcde0c1c82340381be3286e5438d","title":"Create product table","message":"Create product table","createdTs":1624873354,"url":"http://gitlab.bytebase.com/bytebase-demo/shop/-/commit/c80352facbaefcde0c1c82340381be3286e5438d","authorName":"tianzhou","added":"bytebase/shop__v1__baseline__add_initial_schema.sql"}}}'
+ '{"migrationType":"BASELINE","statement":"CREATE TABLE product (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\tdescription TEXT NOT NULL\n);\n","pushEvent":{"vcsType":"GITLAB_SELF_HOST","baseDir":"bytebase","ref":"refs/heads/master","repositoryID":"14","repositoryUrl":"http://gitlab.bytebase.com/bytebase-demo/shop","repositoryFullPath":"bytebase-demo/shop","authorName":"tianzhou","fileCommit":{"id":"c80352facbaefcde0c1c82340381be3286e5438d","title":"Create product table","message":"Create product table","createdTs":1624873354,"url":"http://gitlab.bytebase.com/bytebase-demo/shop/-/commit/c80352facbaefcde0c1c82340381be3286e5438d","authorName":"tianzhou","added":"bytebase/shop__v1__baseline__add_initial_schema.sql"}}}'
);
-- Task for stage 10004 "Staging" to update database 7011 'shop'
@@ -128,7 +128,7 @@ VALUES
'Add initial schema',
'bb.task.database.schema.update',
'PENDING_APPROVAL',
- '{"migrationType":"BASELINE","statement":"CREATE TABLE product (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\tdescription TEXT NOT NULL\n);\n","pushEvent":{"vcsType":"GITLAB_SELF_HOST","baseDir":"bytebase","ref":"refs/heads/master","repositoryId":"14","repositoryUrl":"http://gitlab.bytebase.com/bytebase-demo/shop","repositoryFullPath":"bytebase-demo/shop","authorName":"tianzhou","fileCommit":{"id":"c80352facbaefcde0c1c82340381be3286e5438d","title":"Create product table","message":"Create product table","createdTs":1624873354,"url":"http://gitlab.bytebase.com/bytebase-demo/shop/-/commit/c80352facbaefcde0c1c82340381be3286e5438d","authorName":"tianzhou","added":"bytebase/shop__v1__baseline__add_initial_schema.sql"}}}'
+ '{"migrationType":"BASELINE","statement":"CREATE TABLE product (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\tdescription TEXT NOT NULL\n);\n","pushEvent":{"vcsType":"GITLAB_SELF_HOST","baseDir":"bytebase","ref":"refs/heads/master","repositoryID":"14","repositoryUrl":"http://gitlab.bytebase.com/bytebase-demo/shop","repositoryFullPath":"bytebase-demo/shop","authorName":"tianzhou","fileCommit":{"id":"c80352facbaefcde0c1c82340381be3286e5438d","title":"Create product table","message":"Create product table","createdTs":1624873354,"url":"http://gitlab.bytebase.com/bytebase-demo/shop/-/commit/c80352facbaefcde0c1c82340381be3286e5438d","authorName":"tianzhou","added":"bytebase/shop__v1__baseline__add_initial_schema.sql"}}}'
);
-- Task for stage 10005 "Prod" to update database 7015 'proddb1'
@@ -162,7 +162,7 @@ VALUES
'Add initial schema',
'bb.task.database.schema.update',
'PENDING_APPROVAL',
- '{"migrationType":"BASELINE","statement":"CREATE TABLE product (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\tdescription TEXT NOT NULL\n);\n","pushEvent":{"vcsType":"GITLAB_SELF_HOST","baseDir":"bytebase","ref":"refs/heads/master","repositoryId":"14","repositoryUrl":"http://gitlab.bytebase.com/bytebase-demo/shop","repositoryFullPath":"bytebase-demo/shop","authorName":"tianzhou","fileCommit":{"id":"c80352facbaefcde0c1c82340381be3286e5438d","title":"Create product table","message":"Create product table","createdTs":1624873354,"url":"http://gitlab.bytebase.com/bytebase-demo/shop/-/commit/c80352facbaefcde0c1c82340381be3286e5438d","authorName":"tianzhou","added":"bytebase/shop__v1__baseline__add_initial_schema.sql"}}}'
+ '{"migrationType":"BASELINE","statement":"CREATE TABLE product (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\tdescription TEXT NOT NULL\n);\n","pushEvent":{"vcsType":"GITLAB_SELF_HOST","baseDir":"bytebase","ref":"refs/heads/master","repositoryID":"14","repositoryUrl":"http://gitlab.bytebase.com/bytebase-demo/shop","repositoryFullPath":"bytebase-demo/shop","authorName":"tianzhou","fileCommit":{"id":"c80352facbaefcde0c1c82340381be3286e5438d","title":"Create product table","message":"Create product table","createdTs":1624873354,"url":"http://gitlab.bytebase.com/bytebase-demo/shop/-/commit/c80352facbaefcde0c1c82340381be3286e5438d","authorName":"tianzhou","added":"bytebase/shop__v1__baseline__add_initial_schema.sql"}}}'
);
-- Task for Pipeline 9003 create table
@@ -257,7 +257,7 @@ VALUES
'Add initial schema',
'bb.task.database.schema.update',
'DONE',
- '{"migrationType":"BASELINE","statement":"CREATE TABLE `user` (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\temail TEXT NOT NULL\n);\n\nCREATE TABLE post (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\tcontent TEXT NOT NULL,\n\tauthor_id INTEGER NOT NULL,\n\tFOREIGN KEY (author_id) REFERENCES `user` (id) ON DELETE RESTRICT\n);\n\nCREATE TABLE comment (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tcontent TEXT NOT NULL,\n\tpost_id INTEGER NOT NULL,\n\tauthor_id INTEGER NOT NULL,\n\tFOREIGN KEY (post_id) REFERENCES post (id) ON DELETE CASCADE,\n\tFOREIGN KEY (author_id) REFERENCES `user` (id) ON DELETE RESTRICT\n);\n","pushEvent":{"vcsType":"GITLAB_SELF_HOST","baseDir":"bytebase","ref":"refs/heads/master","repositoryId":"13","repositoryUrl":"http://gitlab.bytebase.com/bytebase-demo/blog","repositoryFullPath":"bytebase-demo/blog","authorName":"tianzhou","fileCommit":{"id":"d7f3b88b93c4d7f57b710980cdf92f72dcc4cd1e","title":"Create user, post, comment table for dev environment","message":"Create user, post, comment table for dev environment","createdTs":1624865383,"url":"http://gitlab.bytebase.com/bytebase-demo/blog/-/commit/8f578d53e821c46421d69fd0aabd29921190a6c0","authorName":"tianzhou","added":"bytebase/dev/blog__202106280000__baseline__add_initial_schema.sql"}}}'
+ '{"migrationType":"BASELINE","statement":"CREATE TABLE `user` (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\temail TEXT NOT NULL\n);\n\nCREATE TABLE post (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\tcontent TEXT NOT NULL,\n\tauthor_id INTEGER NOT NULL,\n\tFOREIGN KEY (author_id) REFERENCES `user` (id) ON DELETE RESTRICT\n);\n\nCREATE TABLE comment (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tcontent TEXT NOT NULL,\n\tpost_id INTEGER NOT NULL,\n\tauthor_id INTEGER NOT NULL,\n\tFOREIGN KEY (post_id) REFERENCES post (id) ON DELETE CASCADE,\n\tFOREIGN KEY (author_id) REFERENCES `user` (id) ON DELETE RESTRICT\n);\n","pushEvent":{"vcsType":"GITLAB_SELF_HOST","baseDir":"bytebase","ref":"refs/heads/master","repositoryID":"13","repositoryUrl":"http://gitlab.bytebase.com/bytebase-demo/blog","repositoryFullPath":"bytebase-demo/blog","authorName":"tianzhou","fileCommit":{"id":"d7f3b88b93c4d7f57b710980cdf92f72dcc4cd1e","title":"Create user, post, comment table for dev environment","message":"Create user, post, comment table for dev environment","createdTs":1624865383,"url":"http://gitlab.bytebase.com/bytebase-demo/blog/-/commit/8f578d53e821c46421d69fd0aabd29921190a6c0","authorName":"tianzhou","added":"bytebase/dev/blog__202106280000__baseline__add_initial_schema.sql"}}}'
);
-- Task for stage 10009 simulating webhook push event
@@ -291,7 +291,7 @@ VALUES
'Add initial schema',
'bb.task.database.schema.update',
'DONE',
- '{"migrationType":"BASELINE","statement":"CREATE TABLE `user` (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\temail TEXT NOT NULL\n);\n\nCREATE TABLE post (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\tcontent TEXT NOT NULL,\n\tauthor_id INTEGER NOT NULL,\n\tFOREIGN KEY (author_id) REFERENCES `user` (id) ON DELETE RESTRICT\n);\n\nCREATE TABLE comment (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tcontent TEXT NOT NULL,\n\tpost_id INTEGER NOT NULL,\n\tauthor_id INTEGER NOT NULL,\n\tFOREIGN KEY (post_id) REFERENCES post (id) ON DELETE CASCADE,\n\tFOREIGN KEY (author_id) REFERENCES `user` (id) ON DELETE RESTRICT\n);\n","pushEvent":{"vcsType":"GITLAB_SELF_HOST","baseDir":"bytebase","ref":"refs/heads/master","repositoryId":"13","repositoryUrl":"http://gitlab.bytebase.com/bytebase-demo/blog","repositoryFullPath":"bytebase-demo/blog","authorName":"tianzhou","fileCommit":{"id":"0765950c28c50dd07217aa0a133e8239e64f0ea1","title":"Create user, post, comment table for integration environment","message":"Create user, post, comment table for integration environment","createdTs":1624866787,"url":"http://gitlab.bytebase.com/bytebase-demo/blog/-/commit/0765950c28c50dd07217aa0a133e8239e64f0ea1","authorName":"tianzhou","added":"bytebase/integration/blog__202106280000__baseline__add_initial_schema.sql"}}}'
+ '{"migrationType":"BASELINE","statement":"CREATE TABLE `user` (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\temail TEXT NOT NULL\n);\n\nCREATE TABLE post (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\tcontent TEXT NOT NULL,\n\tauthor_id INTEGER NOT NULL,\n\tFOREIGN KEY (author_id) REFERENCES `user` (id) ON DELETE RESTRICT\n);\n\nCREATE TABLE comment (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tcontent TEXT NOT NULL,\n\tpost_id INTEGER NOT NULL,\n\tauthor_id INTEGER NOT NULL,\n\tFOREIGN KEY (post_id) REFERENCES post (id) ON DELETE CASCADE,\n\tFOREIGN KEY (author_id) REFERENCES `user` (id) ON DELETE RESTRICT\n);\n","pushEvent":{"vcsType":"GITLAB_SELF_HOST","baseDir":"bytebase","ref":"refs/heads/master","repositoryID":"13","repositoryUrl":"http://gitlab.bytebase.com/bytebase-demo/blog","repositoryFullPath":"bytebase-demo/blog","authorName":"tianzhou","fileCommit":{"id":"0765950c28c50dd07217aa0a133e8239e64f0ea1","title":"Create user, post, comment table for integration environment","message":"Create user, post, comment table for integration environment","createdTs":1624866787,"url":"http://gitlab.bytebase.com/bytebase-demo/blog/-/commit/0765950c28c50dd07217aa0a133e8239e64f0ea1","authorName":"tianzhou","added":"bytebase/integration/blog__202106280000__baseline__add_initial_schema.sql"}}}'
);
-- Task for stage 10010 simulating webhook push event
@@ -325,7 +325,7 @@ VALUES
'Add initial schema',
'bb.task.database.schema.update',
'DONE',
- '{"migrationType":"BASELINE","statement":"CREATE TABLE `user` (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\temail TEXT NOT NULL\n);\n\nCREATE TABLE post (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\tcontent TEXT NOT NULL,\n\tauthor_id INTEGER NOT NULL,\n\tFOREIGN KEY (author_id) REFERENCES `user` (id) ON DELETE RESTRICT\n);\n\nCREATE TABLE comment (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tcontent TEXT NOT NULL,\n\tpost_id INTEGER NOT NULL,\n\tauthor_id INTEGER NOT NULL,\n\tFOREIGN KEY (post_id) REFERENCES post (id) ON DELETE CASCADE,\n\tFOREIGN KEY (author_id) REFERENCES `user` (id) ON DELETE RESTRICT\n);\n","pushEvent":{"vcsType":"GITLAB_SELF_HOST","baseDir":"bytebase","ref":"refs/heads/master","repositoryId":"13","repositoryUrl":"http://gitlab.bytebase.com/bytebase-demo/blog","repositoryFullPath":"bytebase-demo/blog","authorName":"tianzhou","fileCommit":{"id":"149f18b8d94805be4b92e256ef1dc9f4a27d5157","title":"Create user, post, comment table for staging environment","message":"Create user, post, comment table for staging environment","createdTs":1624868403,"url":"http://gitlab.bytebase.com/bytebase-demo/blog/-/commit/149f18b8d94805be4b92e256ef1dc9f4a27d5157","authorName":"tianzhou","added":"bytebase/bytebase/staging/blog__202106280000__baseline__add_initial_schema.sql"}}}'
+ '{"migrationType":"BASELINE","statement":"CREATE TABLE `user` (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\temail TEXT NOT NULL\n);\n\nCREATE TABLE post (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\tcontent TEXT NOT NULL,\n\tauthor_id INTEGER NOT NULL,\n\tFOREIGN KEY (author_id) REFERENCES `user` (id) ON DELETE RESTRICT\n);\n\nCREATE TABLE comment (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tcontent TEXT NOT NULL,\n\tpost_id INTEGER NOT NULL,\n\tauthor_id INTEGER NOT NULL,\n\tFOREIGN KEY (post_id) REFERENCES post (id) ON DELETE CASCADE,\n\tFOREIGN KEY (author_id) REFERENCES `user` (id) ON DELETE RESTRICT\n);\n","pushEvent":{"vcsType":"GITLAB_SELF_HOST","baseDir":"bytebase","ref":"refs/heads/master","repositoryID":"13","repositoryUrl":"http://gitlab.bytebase.com/bytebase-demo/blog","repositoryFullPath":"bytebase-demo/blog","authorName":"tianzhou","fileCommit":{"id":"149f18b8d94805be4b92e256ef1dc9f4a27d5157","title":"Create user, post, comment table for staging environment","message":"Create user, post, comment table for staging environment","createdTs":1624868403,"url":"http://gitlab.bytebase.com/bytebase-demo/blog/-/commit/149f18b8d94805be4b92e256ef1dc9f4a27d5157","authorName":"tianzhou","added":"bytebase/bytebase/staging/blog__202106280000__baseline__add_initial_schema.sql"}}}'
);
-- Task for stage 10011 simulating webhook push event
@@ -359,7 +359,7 @@ VALUES
'Add initial schema',
'bb.task.database.schema.update',
'DONE',
- '{"migrationType":"BASELINE","statement":"CREATE TABLE `user` (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\temail TEXT NOT NULL\n);\n\nCREATE TABLE post (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\tcontent TEXT NOT NULL,\n\tauthor_id INTEGER NOT NULL,\n\tFOREIGN KEY (author_id) REFERENCES `user` (id) ON DELETE RESTRICT\n);\n\nCREATE TABLE comment (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tcontent TEXT NOT NULL,\n\tpost_id INTEGER NOT NULL,\n\tauthor_id INTEGER NOT NULL,\n\tFOREIGN KEY (post_id) REFERENCES post (id) ON DELETE CASCADE,\n\tFOREIGN KEY (author_id) REFERENCES `user` (id) ON DELETE RESTRICT\n);\n","pushEvent":{"vcsType":"GITLAB_SELF_HOST","baseDir":"bytebase","ref":"refs/heads/master","repositoryId":"13","repositoryUrl":"http://gitlab.bytebase.com/bytebase-demo/blog","repositoryFullPath":"bytebase-demo/blog","authorName":"tianzhou","fileCommit":{"id":"ec17d38d6581015feb49b341cc3da56cb0e354fb","title":"Create user, post, comment table for prod environment","message":"Create user, post, comment table for prod environment","createdTs":1624868676,"url":"http://gitlab.bytebase.com/bytebase-demo/blog/-/commit/ec17d38d6581015feb49b341cc3da56cb0e354fb","authorName":"tianzhou","added":"bytebase/prod/blog__202106280000__baseline__add_initial_schema.sql"}}}'
+ '{"migrationType":"BASELINE","statement":"CREATE TABLE `user` (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\temail TEXT NOT NULL\n);\n\nCREATE TABLE post (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\tcontent TEXT NOT NULL,\n\tauthor_id INTEGER NOT NULL,\n\tFOREIGN KEY (author_id) REFERENCES `user` (id) ON DELETE RESTRICT\n);\n\nCREATE TABLE comment (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tcontent TEXT NOT NULL,\n\tpost_id INTEGER NOT NULL,\n\tauthor_id INTEGER NOT NULL,\n\tFOREIGN KEY (post_id) REFERENCES post (id) ON DELETE CASCADE,\n\tFOREIGN KEY (author_id) REFERENCES `user` (id) ON DELETE RESTRICT\n);\n","pushEvent":{"vcsType":"GITLAB_SELF_HOST","baseDir":"bytebase","ref":"refs/heads/master","repositoryID":"13","repositoryUrl":"http://gitlab.bytebase.com/bytebase-demo/blog","repositoryFullPath":"bytebase-demo/blog","authorName":"tianzhou","fileCommit":{"id":"ec17d38d6581015feb49b341cc3da56cb0e354fb","title":"Create user, post, comment table for prod environment","message":"Create user, post, comment table for prod environment","createdTs":1624868676,"url":"http://gitlab.bytebase.com/bytebase-demo/blog/-/commit/ec17d38d6581015feb49b341cc3da56cb0e354fb","authorName":"tianzhou","added":"bytebase/prod/blog__202106280000__baseline__add_initial_schema.sql"}}}'
);
-- Task for stage 10012 simulating webhook push event
@@ -393,7 +393,7 @@ VALUES
'Add created at column',
'bb.task.database.schema.update',
'FAILED',
- '{"migrationType":"MIGRATE","statement":"ALTER TABLE `user` ADD COLUMN `created_at` DATETIME NOT NULL;\n\nALTER TABLE post ADD COLUMN `created_at` DATETIME NOT NULL;\n\nALTER TABLE comment ADD COLUMN `created_at` DATETIME NOT NULL;\n","pushEvent":{"vcsType":"GITLAB_SELF_HOST","baseDir":"bytebase","ref":"refs/heads/master","repositoryId":"13","repositoryUrl":"http://gitlab.bytebase.com/bytebase-demo/blog","repositoryFullPath":"bytebase-demo/blog","authorName":"tianzhou","fileCommit":{"id":"8ff6482998059a861e1faa14658c65244577b54e","title":"Add created_at column to user,post,comment table for dev environment","message":"Add created_at column to user,post,comment table for dev environment","createdTs":1624869938,"url":"http://gitlab.bytebase.com/bytebase-demo/blog/-/commit/8ff6482998059a861e1faa14658c65244577b54e","authorName":"tianzhou","added":"bytebase/dev/blog__202106280100__migrate__add_created_at_column.sql"}}}'
+ '{"migrationType":"MIGRATE","statement":"ALTER TABLE `user` ADD COLUMN `created_at` DATETIME NOT NULL;\n\nALTER TABLE post ADD COLUMN `created_at` DATETIME NOT NULL;\n\nALTER TABLE comment ADD COLUMN `created_at` DATETIME NOT NULL;\n","pushEvent":{"vcsType":"GITLAB_SELF_HOST","baseDir":"bytebase","ref":"refs/heads/master","repositoryID":"13","repositoryUrl":"http://gitlab.bytebase.com/bytebase-demo/blog","repositoryFullPath":"bytebase-demo/blog","authorName":"tianzhou","fileCommit":{"id":"8ff6482998059a861e1faa14658c65244577b54e","title":"Add created_at column to user,post,comment table for dev environment","message":"Add created_at column to user,post,comment table for dev environment","createdTs":1624869938,"url":"http://gitlab.bytebase.com/bytebase-demo/blog/-/commit/8ff6482998059a861e1faa14658c65244577b54e","authorName":"tianzhou","added":"bytebase/dev/blog__202106280100__migrate__add_created_at_column.sql"}}}'
);
-- Task for Pipeline 9009 multi-stage create table UI workflow
diff --git a/store/seed/test/10120__task_run.sql b/store/seed/test/10120__task_run.sql
index 88ede687d2..c5ca6818d1 100644
--- a/store/seed/test/10120__task_run.sql
+++ b/store/seed/test/10120__task_run.sql
@@ -24,8 +24,8 @@ VALUES
'DONE',
'bb.task.database.schema.update',
0,
- '{"detail":"Established baseline version 202106280000 for database ''shop''","migrationId":1,"version":"202106280000"}',
- '{"migrationType":"BASELINE","statement":"CREATE TABLE product (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\tdescription TEXT NOT NULL\n);\n","pushEvent":{"vcsType":"GITLAB_SELF_HOST","baseDir":"bytebase","ref":"refs/heads/master","repositoryId":"14","repositoryUrl":"http://gitlab.bytebase.com/bytebase-demo/shop","repositoryFullPath":"bytebase-demo/shop","authorName":"tianzhou","fileCommit":{"id":"c80352facbaefcde0c1c82340381be3286e5438d","title":"Create product table","message":"Create product table","createdTs":1624873354,"url":"http://gitlab.bytebase.com/bytebase-demo/shop/-/commit/c80352facbaefcde0c1c82340381be3286e5438d","authorName":"tianzhou","added":"bytebase/shop__v1__baseline__add_initial_schema.sql"}}}'
+ '{"detail":"Established baseline version 202106280000 for database ''shop''","migrationID":1,"version":"202106280000"}',
+ '{"migrationType":"BASELINE","statement":"CREATE TABLE product (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\tdescription TEXT NOT NULL\n);\n","pushEvent":{"vcsType":"GITLAB_SELF_HOST","baseDir":"bytebase","ref":"refs/heads/master","repositoryID":"14","repositoryUrl":"http://gitlab.bytebase.com/bytebase-demo/shop","repositoryFullPath":"bytebase-demo/shop","authorName":"tianzhou","fileCommit":{"id":"c80352facbaefcde0c1c82340381be3286e5438d","title":"Create product table","message":"Create product table","createdTs":1624873354,"url":"http://gitlab.bytebase.com/bytebase-demo/shop/-/commit/c80352facbaefcde0c1c82340381be3286e5438d","authorName":"tianzhou","added":"bytebase/shop__v1__baseline__add_initial_schema.sql"}}}'
);
-- Task run for task 11003
@@ -54,8 +54,8 @@ VALUES
'DONE',
'bb.task.database.schema.update',
0,
- '{"detail":"Established baseline version 202106280000 for database ''shop''","migrationId":1,"version":"202106280000"}',
- '{"migrationType":"BASELINE","statement":"CREATE TABLE product (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\tdescription TEXT NOT NULL\n);\n","pushEvent":{"vcsType":"GITLAB_SELF_HOST","baseDir":"bytebase","ref":"refs/heads/master","repositoryId":"14","repositoryUrl":"http://gitlab.bytebase.com/bytebase-demo/shop","repositoryFullPath":"bytebase-demo/shop","authorName":"tianzhou","fileCommit":{"id":"c80352facbaefcde0c1c82340381be3286e5438d","title":"Create product table","message":"Create product table","createdTs":1624873354,"url":"http://gitlab.bytebase.com/bytebase-demo/shop/-/commit/c80352facbaefcde0c1c82340381be3286e5438d","authorName":"tianzhou","added":"bytebase/shop__v1__baseline__add_initial_schema.sql"}}}'
+ '{"detail":"Established baseline version 202106280000 for database ''shop''","migrationID":1,"version":"202106280000"}',
+ '{"migrationType":"BASELINE","statement":"CREATE TABLE product (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\tdescription TEXT NOT NULL\n);\n","pushEvent":{"vcsType":"GITLAB_SELF_HOST","baseDir":"bytebase","ref":"refs/heads/master","repositoryID":"14","repositoryUrl":"http://gitlab.bytebase.com/bytebase-demo/shop","repositoryFullPath":"bytebase-demo/shop","authorName":"tianzhou","fileCommit":{"id":"c80352facbaefcde0c1c82340381be3286e5438d","title":"Create product table","message":"Create product table","createdTs":1624873354,"url":"http://gitlab.bytebase.com/bytebase-demo/shop/-/commit/c80352facbaefcde0c1c82340381be3286e5438d","authorName":"tianzhou","added":"bytebase/shop__v1__baseline__add_initial_schema.sql"}}}'
);
-- Failed task run for task 11006 create table
@@ -110,8 +110,8 @@ VALUES
'DONE',
'bb.task.database.schema.update',
0,
- '{"detail":"Established baseline version 202106280000 for database ''blog''","migrationId":1,"version":"202106280000"}',
- '{"migrationType":"BASELINE","statement":"CREATE TABLE `user` (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\temail TEXT NOT NULL\n);\n\nCREATE TABLE post (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\tcontent TEXT NOT NULL,\n\tauthor_id INTEGER NOT NULL,\n\tFOREIGN KEY (author_id) REFERENCES `user` (id) ON DELETE RESTRICT\n);\n\nCREATE TABLE comment (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tcontent TEXT NOT NULL,\n\tpost_id INTEGER NOT NULL,\n\tauthor_id INTEGER NOT NULL,\n\tFOREIGN KEY (post_id) REFERENCES post (id) ON DELETE CASCADE,\n\tFOREIGN KEY (author_id) REFERENCES `user` (id) ON DELETE RESTRICT\n);\n","pushEvent":{"vcsType":"GITLAB_SELF_HOST","baseDir":"bytebase","ref":"refs/heads/master","repositoryId":"13","repositoryUrl":"http://gitlab.bytebase.com/bytebase-demo/blog","repositoryFullPath":"bytebase-demo/blog","authorName":"tianzhou","fileCommit":{"id":"d7f3b88b93c4d7f57b710980cdf92f72dcc4cd1e","title":"Create user, post, comment table for dev environment","message":"Create user, post, comment table for dev environment","createdTs":1624865383,"url":"http://gitlab.bytebase.com/bytebase-demo/blog/-/commit/d7f3b88b93c4d7f57b710980cdf92f72dcc4cd1e","authorName":"tianzhou","added":"bytebase/dev/blog__202106280000__baseline__add_initial_schema.sql"}}}'
+ '{"detail":"Established baseline version 202106280000 for database ''blog''","migrationID":1,"version":"202106280000"}',
+ '{"migrationType":"BASELINE","statement":"CREATE TABLE `user` (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\temail TEXT NOT NULL\n);\n\nCREATE TABLE post (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\tcontent TEXT NOT NULL,\n\tauthor_id INTEGER NOT NULL,\n\tFOREIGN KEY (author_id) REFERENCES `user` (id) ON DELETE RESTRICT\n);\n\nCREATE TABLE comment (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tcontent TEXT NOT NULL,\n\tpost_id INTEGER NOT NULL,\n\tauthor_id INTEGER NOT NULL,\n\tFOREIGN KEY (post_id) REFERENCES post (id) ON DELETE CASCADE,\n\tFOREIGN KEY (author_id) REFERENCES `user` (id) ON DELETE RESTRICT\n);\n","pushEvent":{"vcsType":"GITLAB_SELF_HOST","baseDir":"bytebase","ref":"refs/heads/master","repositoryID":"13","repositoryUrl":"http://gitlab.bytebase.com/bytebase-demo/blog","repositoryFullPath":"bytebase-demo/blog","authorName":"tianzhou","fileCommit":{"id":"d7f3b88b93c4d7f57b710980cdf92f72dcc4cd1e","title":"Create user, post, comment table for dev environment","message":"Create user, post, comment table for dev environment","createdTs":1624865383,"url":"http://gitlab.bytebase.com/bytebase-demo/blog/-/commit/d7f3b88b93c4d7f57b710980cdf92f72dcc4cd1e","authorName":"tianzhou","added":"bytebase/dev/blog__202106280000__baseline__add_initial_schema.sql"}}}'
);
-- Task run for task 11009
@@ -140,8 +140,8 @@ VALUES
'DONE',
'bb.task.database.schema.update',
0,
- '{"detail":"Established baseline version 202106280000 for database ''blog''","migrationId":1,"version":"202106280000"}',
- '{"migrationType":"BASELINE","statement":"CREATE TABLE `user` (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\temail TEXT NOT NULL\n);\n\nCREATE TABLE post (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\tcontent TEXT NOT NULL,\n\tauthor_id INTEGER NOT NULL,\n\tFOREIGN KEY (author_id) REFERENCES `user` (id) ON DELETE RESTRICT\n);\n\nCREATE TABLE comment (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tcontent TEXT NOT NULL,\n\tpost_id INTEGER NOT NULL,\n\tauthor_id INTEGER NOT NULL,\n\tFOREIGN KEY (post_id) REFERENCES post (id) ON DELETE CASCADE,\n\tFOREIGN KEY (author_id) REFERENCES `user` (id) ON DELETE RESTRICT\n);\n","pushEvent":{"vcsType":"GITLAB_SELF_HOST","baseDir":"bytebase","ref":"refs/heads/master","repositoryId":"13","repositoryUrl":"http://gitlab.bytebase.com/bytebase-demo/blog","repositoryFullPath":"bytebase-demo/blog","authorName":"tianzhou","fileCommit":{"id":"8f578d53e821c46421d69fd0aabd29921190a6c0","title":"Create user, post, comment table for dev environment","message":"Create user, post, comment table for dev environment","createdTs":1624865383,"url":"http://gitlab.bytebase.com/bytebase-demo/blog/-/commit/8f578d53e821c46421d69fd0aabd29921190a6c0","authorName":"tianzhou","added":"bytebase/dev/blog__202106280000__baseline__add_initial_schema.sql"}}}'
+ '{"detail":"Established baseline version 202106280000 for database ''blog''","migrationID":1,"version":"202106280000"}',
+ '{"migrationType":"BASELINE","statement":"CREATE TABLE `user` (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\temail TEXT NOT NULL\n);\n\nCREATE TABLE post (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\tcontent TEXT NOT NULL,\n\tauthor_id INTEGER NOT NULL,\n\tFOREIGN KEY (author_id) REFERENCES `user` (id) ON DELETE RESTRICT\n);\n\nCREATE TABLE comment (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tcontent TEXT NOT NULL,\n\tpost_id INTEGER NOT NULL,\n\tauthor_id INTEGER NOT NULL,\n\tFOREIGN KEY (post_id) REFERENCES post (id) ON DELETE CASCADE,\n\tFOREIGN KEY (author_id) REFERENCES `user` (id) ON DELETE RESTRICT\n);\n","pushEvent":{"vcsType":"GITLAB_SELF_HOST","baseDir":"bytebase","ref":"refs/heads/master","repositoryID":"13","repositoryUrl":"http://gitlab.bytebase.com/bytebase-demo/blog","repositoryFullPath":"bytebase-demo/blog","authorName":"tianzhou","fileCommit":{"id":"8f578d53e821c46421d69fd0aabd29921190a6c0","title":"Create user, post, comment table for dev environment","message":"Create user, post, comment table for dev environment","createdTs":1624865383,"url":"http://gitlab.bytebase.com/bytebase-demo/blog/-/commit/8f578d53e821c46421d69fd0aabd29921190a6c0","authorName":"tianzhou","added":"bytebase/dev/blog__202106280000__baseline__add_initial_schema.sql"}}}'
);
-- Task run for task 11010
@@ -170,8 +170,8 @@ VALUES
'DONE',
'bb.task.database.schema.update',
0,
- '{"detail":"Established baseline version 202106280000 for database ''blog''","migrationId":1,"version":"202106280000"}',
- '{"migrationType":"BASELINE","statement":"CREATE TABLE `user` (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\temail TEXT NOT NULL\n);\n\nCREATE TABLE post (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\tcontent TEXT NOT NULL,\n\tauthor_id INTEGER NOT NULL,\n\tFOREIGN KEY (author_id) REFERENCES `user` (id) ON DELETE RESTRICT\n);\n\nCREATE TABLE comment (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tcontent TEXT NOT NULL,\n\tpost_id INTEGER NOT NULL,\n\tauthor_id INTEGER NOT NULL,\n\tFOREIGN KEY (post_id) REFERENCES post (id) ON DELETE CASCADE,\n\tFOREIGN KEY (author_id) REFERENCES `user` (id) ON DELETE RESTRICT\n);\n","pushEvent":{"vcsType":"GITLAB_SELF_HOST","baseDir":"bytebase","ref":"refs/heads/master","repositoryId":"13","repositoryUrl":"http://gitlab.bytebase.com/bytebase-demo/blog","repositoryFullPath":"bytebase-demo/blog","authorName":"tianzhou","fileCommit":{"id":"8f578d53e821c46421d69fd0aabd29921190a6c0","title":"Create user, post, comment table for dev environment","message":"Create user, post, comment table for dev environment","createdTs":1624865383,"url":"http://gitlab.bytebase.com/bytebase-demo/blog/-/commit/8f578d53e821c46421d69fd0aabd29921190a6c0","authorName":"tianzhou","added":"bytebase/dev/blog__202106280000__baseline__add_initial_schema.sql"}}}'
+ '{"detail":"Established baseline version 202106280000 for database ''blog''","migrationID":1,"version":"202106280000"}',
+ '{"migrationType":"BASELINE","statement":"CREATE TABLE `user` (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\temail TEXT NOT NULL\n);\n\nCREATE TABLE post (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\tcontent TEXT NOT NULL,\n\tauthor_id INTEGER NOT NULL,\n\tFOREIGN KEY (author_id) REFERENCES `user` (id) ON DELETE RESTRICT\n);\n\nCREATE TABLE comment (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tcontent TEXT NOT NULL,\n\tpost_id INTEGER NOT NULL,\n\tauthor_id INTEGER NOT NULL,\n\tFOREIGN KEY (post_id) REFERENCES post (id) ON DELETE CASCADE,\n\tFOREIGN KEY (author_id) REFERENCES `user` (id) ON DELETE RESTRICT\n);\n","pushEvent":{"vcsType":"GITLAB_SELF_HOST","baseDir":"bytebase","ref":"refs/heads/master","repositoryID":"13","repositoryUrl":"http://gitlab.bytebase.com/bytebase-demo/blog","repositoryFullPath":"bytebase-demo/blog","authorName":"tianzhou","fileCommit":{"id":"8f578d53e821c46421d69fd0aabd29921190a6c0","title":"Create user, post, comment table for dev environment","message":"Create user, post, comment table for dev environment","createdTs":1624865383,"url":"http://gitlab.bytebase.com/bytebase-demo/blog/-/commit/8f578d53e821c46421d69fd0aabd29921190a6c0","authorName":"tianzhou","added":"bytebase/dev/blog__202106280000__baseline__add_initial_schema.sql"}}}'
);
-- Task run for task 11011
@@ -200,8 +200,8 @@ VALUES
'DONE',
'bb.task.database.schema.update',
0,
- '{"detail":"Established baseline version 202106280000 for database ''blog''","migrationId":1,"version":"202106280000"}',
- '{"migrationType":"BASELINE","statement":"CREATE TABLE `user` (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\temail TEXT NOT NULL\n);\n\nCREATE TABLE post (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\tcontent TEXT NOT NULL,\n\tauthor_id INTEGER NOT NULL,\n\tFOREIGN KEY (author_id) REFERENCES `user` (id) ON DELETE RESTRICT\n);\n\nCREATE TABLE comment (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tcontent TEXT NOT NULL,\n\tpost_id INTEGER NOT NULL,\n\tauthor_id INTEGER NOT NULL,\n\tFOREIGN KEY (post_id) REFERENCES post (id) ON DELETE CASCADE,\n\tFOREIGN KEY (author_id) REFERENCES `user` (id) ON DELETE RESTRICT\n);\n","pushEvent":{"vcsType":"GITLAB_SELF_HOST","baseDir":"bytebase","ref":"refs/heads/master","repositoryId":"13","repositoryUrl":"http://gitlab.bytebase.com/bytebase-demo/blog","repositoryFullPath":"bytebase-demo/blog","authorName":"tianzhou","fileCommit":{"id":"8f578d53e821c46421d69fd0aabd29921190a6c0","title":"Create user, post, comment table for dev environment","message":"Create user, post, comment table for dev environment","createdTs":1624865383,"url":"http://gitlab.bytebase.com/bytebase-demo/blog/-/commit/8f578d53e821c46421d69fd0aabd29921190a6c0","authorName":"tianzhou","added":"bytebase/dev/blog__202106280000__baseline__add_initial_schema.sql"}}}'
+ '{"detail":"Established baseline version 202106280000 for database ''blog''","migrationID":1,"version":"202106280000"}',
+ '{"migrationType":"BASELINE","statement":"CREATE TABLE `user` (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\temail TEXT NOT NULL\n);\n\nCREATE TABLE post (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tname TEXT NOT NULL,\n\tcontent TEXT NOT NULL,\n\tauthor_id INTEGER NOT NULL,\n\tFOREIGN KEY (author_id) REFERENCES `user` (id) ON DELETE RESTRICT\n);\n\nCREATE TABLE comment (\n\tid INTEGER PRIMARY KEY AUTO_INCREMENT,\n\tcontent TEXT NOT NULL,\n\tpost_id INTEGER NOT NULL,\n\tauthor_id INTEGER NOT NULL,\n\tFOREIGN KEY (post_id) REFERENCES post (id) ON DELETE CASCADE,\n\tFOREIGN KEY (author_id) REFERENCES `user` (id) ON DELETE RESTRICT\n);\n","pushEvent":{"vcsType":"GITLAB_SELF_HOST","baseDir":"bytebase","ref":"refs/heads/master","repositoryID":"13","repositoryUrl":"http://gitlab.bytebase.com/bytebase-demo/blog","repositoryFullPath":"bytebase-demo/blog","authorName":"tianzhou","fileCommit":{"id":"8f578d53e821c46421d69fd0aabd29921190a6c0","title":"Create user, post, comment table for dev environment","message":"Create user, post, comment table for dev environment","createdTs":1624865383,"url":"http://gitlab.bytebase.com/bytebase-demo/blog/-/commit/8f578d53e821c46421d69fd0aabd29921190a6c0","authorName":"tianzhou","added":"bytebase/dev/blog__202106280000__baseline__add_initial_schema.sql"}}}'
);
-- Failed task run for task 11012 create table
@@ -231,7 +231,7 @@ VALUES
'bb.task.database.schema.update',
201,
'{"detail":"database ''blog'' has already applied version 202106280100"}',
- '{"migrationType":"MIGRATE","statement":"ALTER TABLE `user` ADD COLUMN `created_at` DATETIME NOT NULL;\n\nALTER TABLE post ADD COLUMN `created_at` DATETIME NOT NULL;\n\nALTER TABLE comment ADD COLUMN `created_at` DATETIME NOT NULL;\n","pushEvent":{"vcsType":"GITLAB_SELF_HOST","baseDir":"bytebase","ref":"refs/heads/master","repositoryId":"13","repositoryUrl":"http://gitlab.bytebase.com/bytebase-demo/blog","repositoryFullPath":"bytebase-demo/blog","authorName":"tianzhou","fileCommit":{"id":"8ff6482998059a861e1faa14658c65244577b54e","title":"Add created_at column to user,post,comment table for dev environment","message":"Add created_at column to user,post,comment table for dev environment","createdTs":1624869938,"url":"http://gitlab.bytebase.com/bytebase-demo/blog/-/commit/8ff6482998059a861e1faa14658c65244577b54e","authorName":"tianzhou","added":"bytebase/dev/blog__202106280100__migrate__add_created_at_column.sql"}}}'
+ '{"migrationType":"MIGRATE","statement":"ALTER TABLE `user` ADD COLUMN `created_at` DATETIME NOT NULL;\n\nALTER TABLE post ADD COLUMN `created_at` DATETIME NOT NULL;\n\nALTER TABLE comment ADD COLUMN `created_at` DATETIME NOT NULL;\n","pushEvent":{"vcsType":"GITLAB_SELF_HOST","baseDir":"bytebase","ref":"refs/heads/master","repositoryID":"13","repositoryUrl":"http://gitlab.bytebase.com/bytebase-demo/blog","repositoryFullPath":"bytebase-demo/blog","authorName":"tianzhou","fileCommit":{"id":"8ff6482998059a861e1faa14658c65244577b54e","title":"Add created_at column to user,post,comment table for dev environment","message":"Add created_at column to user,post,comment table for dev environment","createdTs":1624869938,"url":"http://gitlab.bytebase.com/bytebase-demo/blog/-/commit/8ff6482998059a861e1faa14658c65244577b54e","authorName":"tianzhou","added":"bytebase/dev/blog__202106280100__migrate__add_created_at_column.sql"}}}'
);
-- Successful task run for task 10013 create table
@@ -260,7 +260,7 @@ VALUES
'DONE',
'bb.task.database.schema.update',
0,
- '{"detail":"Applied migration version 20210830011437.11013 to database \"testdb_dev\"","migrationId":1,"version":"20210830011437.11013"}',
+ '{"detail":"Applied migration version 20210830011437.11013 to database \"testdb_dev\"","migrationID":1,"version":"20210830011437.11013"}',
'{"migrationType":"MIGRATE","statement":"CREATE TABLE testdb_dev.tbl2 (name TEXT)"}'
);
@@ -288,7 +288,7 @@ VALUES
'Update testdb_integration task run',
'DONE',
'bb.task.database.schema.update',
- '{"detail":"Applied migration version 20210830011437.11014 to database \"testdb_integration\"","migrationId":1,"version":"20210830011437.11014"}',
+ '{"detail":"Applied migration version 20210830011437.11014 to database \"testdb_integration\"","migrationID":1,"version":"20210830011437.11014"}',
'{"migrationType":"MIGRATE","statement":"CREATE TABLE testdb_integration.tbl2 (name TEXT)"}'
);
diff --git a/store/seed/test/10140__activity.sql b/store/seed/test/10140__activity.sql
index 703677bc0c..3f09c0b2d4 100644
--- a/store/seed/test/10140__activity.sql
+++ b/store/seed/test/10140__activity.sql
@@ -139,7 +139,7 @@ VALUES
'bb.pipeline.task.status.update',
'INFO',
'',
- '{"taskId":11002,"oldStatus":"PENDING","newStatus":"RUNNING","issueName":"Create product table","taskName":"Add initial schema"}'
+ '{"taskID":11002,"oldStatus":"PENDING","newStatus":"RUNNING","issueName":"Create product table","taskName":"Add initial schema"}'
);
INSERT INTO
@@ -166,7 +166,7 @@ VALUES
'bb.pipeline.task.status.update',
'INFO',
'Established baseline version 202106280000 for database ''shop''',
- '{"taskId":11002,"oldStatus":"RUNNING","newStatus":"DONE"}'
+ '{"taskID":11002,"oldStatus":"RUNNING","newStatus":"DONE"}'
);
INSERT INTO
@@ -193,7 +193,7 @@ VALUES
'bb.pipeline.task.status.update',
'INFO',
'',
- '{"taskId":11003,"oldStatus":"PENDING","newStatus":"RUNNING"}'
+ '{"taskID":11003,"oldStatus":"PENDING","newStatus":"RUNNING"}'
);
INSERT INTO
@@ -220,7 +220,7 @@ VALUES
'bb.pipeline.task.status.update',
'INFO',
'Established baseline version 202106280000 for database ''shop''',
- '{"taskId":11003,"oldStatus":"RUNNING","newStatus":"DONE"}'
+ '{"taskID":11003,"oldStatus":"RUNNING","newStatus":"DONE"}'
);
INSERT INTO
@@ -245,7 +245,7 @@ VALUES
13002,
'bb.issue.field.update',
'INFO',
- '{"fieldId":"3","oldValue":"1","newValue":"101","issueName":"Create product table"}'
+ '{"fieldID":"3","oldValue":"1","newValue":"101","issueName":"Create product table"}'
);
-- Activity for issue 13003
@@ -295,7 +295,7 @@ VALUES
'bb.pipeline.task.status.update',
'ERROR',
'table "tbl1" already exists',
- '{"taskId":11006,"oldStatus":"RUNNING","newStatus":"FAILED","issueName":"Create a new table ''tbl1''","taskName":"Update testdb_dev"}'
+ '{"taskID":11006,"oldStatus":"RUNNING","newStatus":"FAILED","issueName":"Create a new table ''tbl1''","taskName":"Update testdb_dev"}'
);
INSERT INTO
@@ -367,7 +367,7 @@ VALUES
'bb.pipeline.task.status.update',
'INFO',
'',
- '{"taskId":11008,"oldStatus":"PENDING","newStatus":"RUNNING"}'
+ '{"taskID":11008,"oldStatus":"PENDING","newStatus":"RUNNING"}'
);
INSERT INTO
@@ -392,7 +392,7 @@ VALUES
'bb.pipeline.task.status.update',
'INFO',
'Established baseline version 202106280000 for database ''blog''',
- '{"taskId":11008,"oldStatus":"RUNNING","newStatus":"DONE"}'
+ '{"taskID":11008,"oldStatus":"RUNNING","newStatus":"DONE"}'
);
INSERT INTO
@@ -468,7 +468,7 @@ VALUES
'bb.pipeline.task.status.update',
'INFO',
'',
- '{"taskId":11009,"oldStatus":"PENDING","newStatus":"RUNNING"}'
+ '{"taskID":11009,"oldStatus":"PENDING","newStatus":"RUNNING"}'
);
INSERT INTO
@@ -493,7 +493,7 @@ VALUES
'bb.pipeline.task.status.update',
'INFO',
'Established baseline version 202106280000 for database ''blog''',
- '{"taskId":11009,"oldStatus":"RUNNING","newStatus":"DONE"}'
+ '{"taskID":11009,"oldStatus":"RUNNING","newStatus":"DONE"}'
);
INSERT INTO
@@ -569,7 +569,7 @@ VALUES
'bb.pipeline.task.status.update',
'INFO',
'',
- '{"taskId":11010,"oldStatus":"PENDING","newStatus":"RUNNING"}'
+ '{"taskID":11010,"oldStatus":"PENDING","newStatus":"RUNNING"}'
);
INSERT INTO
@@ -594,7 +594,7 @@ VALUES
'bb.pipeline.task.status.update',
'INFO',
'Established baseline version 202106280000 for database ''blog''',
- '{"taskId":11010,"oldStatus":"RUNNING","newStatus":"DONE"}'
+ '{"taskID":11010,"oldStatus":"RUNNING","newStatus":"DONE"}'
);
INSERT INTO
@@ -670,7 +670,7 @@ VALUES
'bb.pipeline.task.status.update',
'INFO',
'',
- '{"taskId":11011,"oldStatus":"PENDING","newStatus":"RUNNING"}'
+ '{"taskID":11011,"oldStatus":"PENDING","newStatus":"RUNNING"}'
);
INSERT INTO
@@ -695,7 +695,7 @@ VALUES
'bb.pipeline.task.status.update',
'INFO',
'Established baseline version 202106280000 for database ''blog''',
- '{"taskId":11011,"oldStatus":"RUNNING","newStatus":"DONE"}'
+ '{"taskID":11011,"oldStatus":"RUNNING","newStatus":"DONE"}'
);
INSERT INTO
@@ -771,7 +771,7 @@ VALUES
'bb.pipeline.task.status.update',
'INFO',
'',
- '{"taskId":11012,"oldStatus":"PENDING","newStatus":"RUNNING"}'
+ '{"taskID":11012,"oldStatus":"PENDING","newStatus":"RUNNING"}'
);
INSERT INTO
@@ -796,7 +796,7 @@ VALUES
'bb.pipeline.task.status.update',
'ERROR',
'database ''blog'' has already applied version 202106280100',
- '{"taskId":11012,"oldStatus":"RUNNING","newStatus":"FAILED"}'
+ '{"taskID":11012,"oldStatus":"RUNNING","newStatus":"FAILED"}'
);
-- Activity for issue 13009
@@ -847,7 +847,7 @@ VALUES
'bb.pipeline.task.status.update',
'INFO',
'',
- '{"taskId":11015,"oldStatus":"PENDING","newStatus":"RUNNING","issueName":"Create a new table ''tbl2'' using multi-stage SQL review workflow","taskName":"Update testdb_dev"}'
+ '{"taskID":11015,"oldStatus":"PENDING","newStatus":"RUNNING","issueName":"Create a new table ''tbl2'' using multi-stage SQL review workflow","taskName":"Update testdb_dev"}'
);
INSERT INTO
@@ -872,7 +872,7 @@ VALUES
'bb.pipeline.task.status.update',
'INFO',
'Applied migration version 20210830011437.11013 to database "testdb_dev"',
- '{"taskId":11013,"oldStatus":"RUNNING","newStatus":"DONE","issueName":"Create a new table ''tbl2'' using multi-stage SQL review workflow","taskName":"Update testdb_dev"}'
+ '{"taskID":11013,"oldStatus":"RUNNING","newStatus":"DONE","issueName":"Create a new table ''tbl2'' using multi-stage SQL review workflow","taskName":"Update testdb_dev"}'
);
INSERT INTO
@@ -897,7 +897,7 @@ VALUES
'bb.pipeline.task.status.update',
'INFO',
'',
- '{"taskId":11014,"oldStatus":"PENDING","newStatus":"RUNNING","issueName":"Create a new table ''tbl2'' using multi-stage SQL review workflow","taskName":"Update testdb_integration"}'
+ '{"taskID":11014,"oldStatus":"PENDING","newStatus":"RUNNING","issueName":"Create a new table ''tbl2'' using multi-stage SQL review workflow","taskName":"Update testdb_integration"}'
);
INSERT INTO
@@ -922,7 +922,7 @@ VALUES
'bb.pipeline.task.status.update',
'INFO',
'Applied migration version 20210830011437.11014 to database "testdb_integration"',
- '{"taskId":11014,"oldStatus":"RUNNING","newStatus":"DONE","issueName":"Create a new table ''tbl2'' using multi-stage SQL review workflow","taskName":"Update testdb_integration"}'
+ '{"taskID":11014,"oldStatus":"RUNNING","newStatus":"DONE","issueName":"Create a new table ''tbl2'' using multi-stage SQL review workflow","taskName":"Update testdb_integration"}'
);
INSERT INTO
@@ -947,7 +947,7 @@ VALUES
'bb.pipeline.task.status.update',
'INFO',
'',
- '{"taskId":11015,"oldStatus":"PENDING","newStatus":"RUNNING","issueName":"Create a new table ''tbl2'' using multi-stage SQL review workflow","taskName":"Update testdb_staging"}'
+ '{"taskID":11015,"oldStatus":"PENDING","newStatus":"RUNNING","issueName":"Create a new table ''tbl2'' using multi-stage SQL review workflow","taskName":"Update testdb_staging"}'
);
INSERT INTO
@@ -972,7 +972,7 @@ VALUES
'bb.pipeline.task.status.update',
'ERROR',
'table "tbl2" already exists',
- '{"taskId":11015,"oldStatus":"RUNNING","newStatus":"FAILED","issueName":"Create a new table ''tbl2'' using multi-stage SQL review workflow","taskName":"Update testdb_staging"}'
+ '{"taskID":11015,"oldStatus":"RUNNING","newStatus":"FAILED","issueName":"Create a new table ''tbl2'' using multi-stage SQL review workflow","taskName":"Update testdb_staging"}'
);
-- Project activity for 3001
@@ -1049,7 +1049,7 @@ VALUES
'bb.project.repository.push',
'INFO',
'Created issue "Create product table using multi-stage VCS workflow".',
- '{"pushEvent":{"vcsType":"GITLAB_SELF_HOST","baseDir":"bytebase","ref":"refs/heads/master","repositoryId":"14","repositoryUrl":"http://gitlab.bytebase.com/bytebase-demo/shop","repositoryFullPath":"bytebase-demo/shop","authorName":"tianzhou","fileCommit":{"id":"c80352facbaefcde0c1c82340381be3286e5438d","title":"Create product table","message":"Create product table","createdTs": 1630940811,"url":"https://gitlab.bytebase.com/bytebase-demo/shop/-/commit/c80352facbaefcde0c1c82340381be3286e5438d","authorName":"tianzhou","added":"bytebase/shop__v1__baseline__add_initial_schema.sql"}},"issueId":13002,"issueName":"Create product table using multi-stage VCS workflow"}'
+ '{"pushEvent":{"vcsType":"GITLAB_SELF_HOST","baseDir":"bytebase","ref":"refs/heads/master","repositoryID":"14","repositoryUrl":"http://gitlab.bytebase.com/bytebase-demo/shop","repositoryFullPath":"bytebase-demo/shop","authorName":"tianzhou","fileCommit":{"id":"c80352facbaefcde0c1c82340381be3286e5438d","title":"Create product table","message":"Create product table","createdTs": 1630940811,"url":"https://gitlab.bytebase.com/bytebase-demo/shop/-/commit/c80352facbaefcde0c1c82340381be3286e5438d","authorName":"tianzhou","added":"bytebase/shop__v1__baseline__add_initial_schema.sql"}},"issueID":13002,"issueName":"Create product table using multi-stage VCS workflow"}'
);
-- Project activity for 3003
@@ -1100,7 +1100,7 @@ VALUES
'bb.project.repository.push',
'INFO',
'Created issue "Add created_at column to user,post,comment table for dev environment".',
- '{"pushEvent":{"vcsType":"GITLAB_SELF_HOST","baseDir":"bytebase","ref":"refs/heads/master","repositoryId":"13","repositoryUrl":"http://gitlab.bytebase.com/bytebase-demo/blog","repositoryFullPath":"bytebase-demo/blog","authorName":"tianzhou","fileCommit":{"id":"8ff6482998059a861e1faa14658c65244577b54e","title":"Add created_at column to user,post,comment table for dev environment","message":"Add created_at column to user,post,comment table for dev environment","createdTs":1630943211,"url":"https://gitlab.bytebase.com/bytebase-demo/blog/-/commit/8ff6482998059a861e1faa14658c65244577b54e","authorName":"tianzhou","added":"bytebase/dev/blog__202106280100__migrate__add_created_at_column.sql"}},"issueId":13008,"issueName":"Add created_at column to user,post,comment table for dev environment"}'
+ '{"pushEvent":{"vcsType":"GITLAB_SELF_HOST","baseDir":"bytebase","ref":"refs/heads/master","repositoryID":"13","repositoryUrl":"http://gitlab.bytebase.com/bytebase-demo/blog","repositoryFullPath":"bytebase-demo/blog","authorName":"tianzhou","fileCommit":{"id":"8ff6482998059a861e1faa14658c65244577b54e","title":"Add created_at column to user,post,comment table for dev environment","message":"Add created_at column to user,post,comment table for dev environment","createdTs":1630943211,"url":"https://gitlab.bytebase.com/bytebase-demo/blog/-/commit/8ff6482998059a861e1faa14658c65244577b54e","authorName":"tianzhou","added":"bytebase/dev/blog__202106280100__migrate__add_created_at_column.sql"}},"issueID":13008,"issueName":"Add created_at column to user,post,comment table for dev environment"}'
);
INSERT INTO
@@ -1125,7 +1125,7 @@ VALUES
'bb.project.repository.push',
'INFO',
'Created issue "Create user, post, comment table for dev environment".',
- '{"pushEvent":{"vcsType":"GITLAB_SELF_HOST","baseDir":"bytebase","ref":"refs/heads/master","repositoryId":"13","repositoryUrl":"http://gitlab.bytebase.com/bytebase-demo/blog","repositoryFullPath":"bytebase-demo/blog","authorName":"tianzhou","fileCommit":{"id":"8f578d53e821c46421d69fd0aabd29921190a6c0","title":"Create user, post, comment table for dev environment","message":"Create user, post, comment table for dev environment","createdTs": 1630941711,"url":"https://gitlab.bytebase.com/bytebase-demo/blog/-/commit/8f578d53e821c46421d69fd0aabd29921190a6c0","authorName":"tianzhou","added":"bytebase/dev/blog__202106280000__baseline__add_initial_schema.sql"}},"issueId":13004,"issueName":"Create user, post, comment table for dev environment"}'
+ '{"pushEvent":{"vcsType":"GITLAB_SELF_HOST","baseDir":"bytebase","ref":"refs/heads/master","repositoryID":"13","repositoryUrl":"http://gitlab.bytebase.com/bytebase-demo/blog","repositoryFullPath":"bytebase-demo/blog","authorName":"tianzhou","fileCommit":{"id":"8f578d53e821c46421d69fd0aabd29921190a6c0","title":"Create user, post, comment table for dev environment","message":"Create user, post, comment table for dev environment","createdTs": 1630941711,"url":"https://gitlab.bytebase.com/bytebase-demo/blog/-/commit/8f578d53e821c46421d69fd0aabd29921190a6c0","authorName":"tianzhou","added":"bytebase/dev/blog__202106280000__baseline__add_initial_schema.sql"}},"issueID":13004,"issueName":"Create user, post, comment table for dev environment"}'
);
INSERT INTO
@@ -1150,7 +1150,7 @@ VALUES
'bb.project.repository.push',
'INFO',
'Created issue "Create user, post, comment table for integration environment".',
- '{"pushEvent":{"vcsType":"GITLAB_SELF_HOST","baseDir":"bytebase","ref":"refs/heads/master","repositoryId":"13","repositoryUrl":"http://gitlab.bytebase.com/bytebase-demo/blog","repositoryFullPath":"bytebase-demo/blog","authorName":"tianzhou","fileCommit":{"id":"0765950c28c50dd07217aa0a133e8239e64f0ea1","title":"Create user, post, comment table for integration environment","message":"Create user, post, comment table for integration environment","createdTs": 1630941711,"url":"https://gitlab.bytebase.com/bytebase-demo/blog/-/commit/0765950c28c50dd07217aa0a133e8239e64f0ea1","authorName":"tianzhou","added":"bytebase/integration/blog__202106280000__baseline__add_initial_schema.sql"}},"issueId":13005,"issueName":"Create user, post, comment table for integration environment"}'
+ '{"pushEvent":{"vcsType":"GITLAB_SELF_HOST","baseDir":"bytebase","ref":"refs/heads/master","repositoryID":"13","repositoryUrl":"http://gitlab.bytebase.com/bytebase-demo/blog","repositoryFullPath":"bytebase-demo/blog","authorName":"tianzhou","fileCommit":{"id":"0765950c28c50dd07217aa0a133e8239e64f0ea1","title":"Create user, post, comment table for integration environment","message":"Create user, post, comment table for integration environment","createdTs": 1630941711,"url":"https://gitlab.bytebase.com/bytebase-demo/blog/-/commit/0765950c28c50dd07217aa0a133e8239e64f0ea1","authorName":"tianzhou","added":"bytebase/integration/blog__202106280000__baseline__add_initial_schema.sql"}},"issueID":13005,"issueName":"Create user, post, comment table for integration environment"}'
);
INSERT INTO
@@ -1175,7 +1175,7 @@ VALUES
'bb.project.repository.push',
'INFO',
'Created issue "Create user, post, comment table for staging environment".',
- '{"pushEvent":{"vcsType":"GITLAB_SELF_HOST","baseDir":"bytebase","ref":"refs/heads/master","repositoryId":"13","repositoryUrl":"http://gitlab.bytebase.com/bytebase-demo/blog","repositoryFullPath":"bytebase-demo/blog","authorName":"tianzhou","fileCommit":{"id":"149f18b8d94805be4b92e256ef1dc9f4a27d5157","title":"Create user, post, comment table for staging environment","message":"Create user, post, comment table for staging environment","createdTs": 1630941711,"url":"https://gitlab.bytebase.com/bytebase-demo/blog/-/commit/149f18b8d94805be4b92e256ef1dc9f4a27d5157","authorName":"tianzhou","added":"bytebase/staging/blog__202106280000__baseline__add_initial_schema.sql"}},"issueId":13006,"issueName":"Create user, post, comment table for staging environment"}'
+ '{"pushEvent":{"vcsType":"GITLAB_SELF_HOST","baseDir":"bytebase","ref":"refs/heads/master","repositoryID":"13","repositoryUrl":"http://gitlab.bytebase.com/bytebase-demo/blog","repositoryFullPath":"bytebase-demo/blog","authorName":"tianzhou","fileCommit":{"id":"149f18b8d94805be4b92e256ef1dc9f4a27d5157","title":"Create user, post, comment table for staging environment","message":"Create user, post, comment table for staging environment","createdTs": 1630941711,"url":"https://gitlab.bytebase.com/bytebase-demo/blog/-/commit/149f18b8d94805be4b92e256ef1dc9f4a27d5157","authorName":"tianzhou","added":"bytebase/staging/blog__202106280000__baseline__add_initial_schema.sql"}},"issueID":13006,"issueName":"Create user, post, comment table for staging environment"}'
);
INSERT INTO
@@ -1200,5 +1200,5 @@ VALUES
'bb.project.repository.push',
'INFO',
'Created issue "Create user, post, comment table for prod environment".',
- '{"pushEvent":{"vcsType":"GITLAB_SELF_HOST","baseDir":"bytebase","ref":"refs/heads/master","repositoryId":"13","repositoryUrl":"http://gitlab.bytebase.com/bytebase-demo/blog","repositoryFullPath":"bytebase-demo/blog","authorName":"tianzhou","fileCommit":{"id":"ec17d38d6581015feb49b341cc3da56cb0e354fb","title":"Create user, post, comment table for prod environment","message":"Create user, post, comment table for prod environment","createdTs": 1630941711,"url":"https://gitlab.bytebase.com/bytebase-demo/blog/-/commit/ec17d38d6581015feb49b341cc3da56cb0e354fb","authorName":"tianzhou","added":"bytebase/prod/blog__202106280000__baseline__add_initial_schema.sql"}},"issueId":13006,"issueName":"Create user, post, comment table for prod environment"}'
+ '{"pushEvent":{"vcsType":"GITLAB_SELF_HOST","baseDir":"bytebase","ref":"refs/heads/master","repositoryID":"13","repositoryUrl":"http://gitlab.bytebase.com/bytebase-demo/blog","repositoryFullPath":"bytebase-demo/blog","authorName":"tianzhou","fileCommit":{"id":"ec17d38d6581015feb49b341cc3da56cb0e354fb","title":"Create user, post, comment table for prod environment","message":"Create user, post, comment table for prod environment","createdTs": 1630941711,"url":"https://gitlab.bytebase.com/bytebase-demo/blog/-/commit/ec17d38d6581015feb49b341cc3da56cb0e354fb","authorName":"tianzhou","added":"bytebase/prod/blog__202106280000__baseline__add_initial_schema.sql"}},"issueID":13006,"issueName":"Create user, post, comment table for prod environment"}'
);
\ No newline at end of file
diff --git a/store/seed/test/10190__anomaly.sql b/store/seed/test/10190__anomaly.sql
index a8172835be..ce66228472 100644
--- a/store/seed/test/10190__anomaly.sql
+++ b/store/seed/test/10190__anomaly.sql
@@ -36,7 +36,7 @@ VALUES
6004,
7014,
'bb.anomaly.database.backup.policy-violation',
- '{"environmentId":5004,"expectedSchedule":"DAILY","actualSchedule":"UNSET"}'
+ '{"environmentID":5004,"expectedSchedule":"DAILY","actualSchedule":"UNSET"}'
);
INSERT INTO
@@ -74,7 +74,7 @@ VALUES
6003,
7012,
'bb.anomaly.database.backup.policy-violation',
- '{"environmentId":5003,"expectedSchedule":"WEEKLY","actualSchedule":"UNSET"}'
+ '{"environmentID":5003,"expectedSchedule":"WEEKLY","actualSchedule":"UNSET"}'
);
-- Instance anomalies
diff --git a/store/setting.go b/store/setting.go
index 63bad2db49..67a944396a 100644
--- a/store/setting.go
+++ b/store/setting.go
@@ -129,8 +129,8 @@ func createSetting(ctx context.Context, tx *Tx, create *api.SettingCreate) (*api
VALUES (?, ?, ?, ?, ?)
RETURNING name, value, description
`,
- create.CreatorId,
- create.CreatorId,
+ create.CreatorID,
+ create.CreatorID,
create.Name,
create.Value,
create.Description,
@@ -184,9 +184,9 @@ func findSettingList(ctx context.Context, tx *Tx, find *api.SettingFind) (_ []*a
for rows.Next() {
var setting api.Setting
if err := rows.Scan(
- &setting.CreatorId,
+ &setting.CreatorID,
&setting.CreatedTs,
- &setting.UpdaterId,
+ &setting.UpdaterID,
&setting.UpdatedTs,
&setting.Name,
&setting.Value,
@@ -207,7 +207,7 @@ func findSettingList(ctx context.Context, tx *Tx, find *api.SettingFind) (_ []*a
// patchSetting updates a setting by name. Returns the new state of the setting after update.
func patchSetting(ctx context.Context, tx *Tx, patch *api.SettingPatch) (*api.Setting, error) {
// Build UPDATE clause.
- set, args := []string{"updater_id = ?"}, []interface{}{patch.UpdaterId}
+ set, args := []string{"updater_id = ?"}, []interface{}{patch.UpdaterID}
set, args = append(set, "value = ?"), append(args, patch.Value)
args = append(args, patch.Name)
@@ -229,9 +229,9 @@ func patchSetting(ctx context.Context, tx *Tx, patch *api.SettingPatch) (*api.Se
if row.Next() {
var setting api.Setting
if err := row.Scan(
- &setting.CreatorId,
+ &setting.CreatorID,
&setting.CreatedTs,
- &setting.UpdaterId,
+ &setting.UpdaterID,
&setting.UpdatedTs,
&setting.Name,
&setting.Value,
diff --git a/store/stage.go b/store/stage.go
index b56d271c3e..f310c066a7 100644
--- a/store/stage.go
+++ b/store/stage.go
@@ -95,10 +95,10 @@ func (s *StageService) createStage(ctx context.Context, tx *Tx, create *api.Stag
VALUES (?, ?, ?, ?, ?)
RETURNING id, creator_id, created_ts, updater_id, updated_ts, pipeline_id, environment_id, name`+`
`,
- create.CreatorId,
- create.CreatorId,
- create.PipelineId,
- create.EnvironmentId,
+ create.CreatorID,
+ create.CreatorID,
+ create.PipelineID,
+ create.EnvironmentID,
create.Name,
)
@@ -111,12 +111,12 @@ func (s *StageService) createStage(ctx context.Context, tx *Tx, create *api.Stag
var stage api.Stage
if err := row.Scan(
&stage.ID,
- &stage.CreatorId,
+ &stage.CreatorID,
&stage.CreatedTs,
- &stage.UpdaterId,
+ &stage.UpdaterID,
&stage.UpdatedTs,
- &stage.PipelineId,
- &stage.EnvironmentId,
+ &stage.PipelineID,
+ &stage.EnvironmentID,
&stage.Name,
); err != nil {
return nil, FormatError(err)
@@ -131,7 +131,7 @@ func (s *StageService) findStageList(ctx context.Context, tx *Tx, find *api.Stag
if v := find.ID; v != nil {
where, args = append(where, "id = ?"), append(args, *v)
}
- if v := find.PipelineId; v != nil {
+ if v := find.PipelineID; v != nil {
where, args = append(where, "pipeline_id = ?"), append(args, *v)
}
@@ -160,12 +160,12 @@ func (s *StageService) findStageList(ctx context.Context, tx *Tx, find *api.Stag
var stage api.Stage
if err := rows.Scan(
&stage.ID,
- &stage.CreatorId,
+ &stage.CreatorID,
&stage.CreatedTs,
- &stage.UpdaterId,
+ &stage.UpdaterID,
&stage.UpdatedTs,
- &stage.PipelineId,
- &stage.EnvironmentId,
+ &stage.PipelineID,
+ &stage.EnvironmentID,
&stage.Name,
); err != nil {
return nil, FormatError(err)
diff --git a/store/table.go b/store/table.go
index 37fa65e9a2..006e8698ce 100644
--- a/store/table.go
+++ b/store/table.go
@@ -127,11 +127,11 @@ func (s *TableService) createTable(ctx context.Context, tx *Tx, create *api.Tabl
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
RETURNING id, creator_id, created_ts, updater_id, updated_ts, database_id, name, `+"`type`, engine, collation, row_count, data_size, index_size, data_free, create_options, comment"+`
`,
- create.CreatorId,
+ create.CreatorID,
create.CreatedTs,
- create.CreatorId,
+ create.CreatorID,
create.UpdatedTs,
- create.DatabaseId,
+ create.DatabaseID,
create.Name,
create.Type,
create.Engine,
@@ -153,11 +153,11 @@ func (s *TableService) createTable(ctx context.Context, tx *Tx, create *api.Tabl
var table api.Table
if err := row.Scan(
&table.ID,
- &table.CreatorId,
+ &table.CreatorID,
&table.CreatedTs,
- &table.UpdaterId,
+ &table.UpdaterID,
&table.UpdatedTs,
- &table.DatabaseId,
+ &table.DatabaseID,
&table.Name,
&table.Type,
&table.Engine,
@@ -181,7 +181,7 @@ func (s *TableService) findTableList(ctx context.Context, tx *Tx, find *api.Tabl
if v := find.ID; v != nil {
where, args = append(where, "id = ?"), append(args, *v)
}
- if v := find.DatabaseId; v != nil {
+ if v := find.DatabaseID; v != nil {
where, args = append(where, "database_id = ?"), append(args, *v)
}
if v := find.Name; v != nil {
@@ -221,11 +221,11 @@ func (s *TableService) findTableList(ctx context.Context, tx *Tx, find *api.Tabl
var table api.Table
if err := rows.Scan(
&table.ID,
- &table.CreatorId,
+ &table.CreatorID,
&table.CreatedTs,
- &table.UpdaterId,
+ &table.UpdaterID,
&table.UpdatedTs,
- &table.DatabaseId,
+ &table.DatabaseID,
&table.Name,
&table.Type,
&table.Engine,
@@ -252,7 +252,7 @@ func (s *TableService) findTableList(ctx context.Context, tx *Tx, find *api.Tabl
// deleteTable permanently deletes tables from a database.
func deleteTable(ctx context.Context, tx *Tx, delete *api.TableDelete) error {
// Remove row from database.
- _, err := tx.ExecContext(ctx, `DELETE FROM tbl WHERE database_id = ?`, delete.DatabaseId)
+ _, err := tx.ExecContext(ctx, `DELETE FROM tbl WHERE database_id = ?`, delete.DatabaseID)
if err != nil {
return FormatError(err)
}
diff --git a/store/table_index.go b/store/table_index.go
index 6ba4c2e0b6..882017fb05 100644
--- a/store/table_index.go
+++ b/store/table_index.go
@@ -102,10 +102,10 @@ func (s *IndexService) createIndex(ctx context.Context, tx *Tx, create *api.Inde
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`+
"RETURNING id, creator_id, created_ts, updater_id, updated_ts, database_id, table_id, name, expression, position, `type`, `unique`, visible, comment"+`
`,
- create.CreatorId,
- create.CreatorId,
- create.DatabaseId,
- create.TableId,
+ create.CreatorID,
+ create.CreatorID,
+ create.DatabaseID,
+ create.TableID,
create.Name,
create.Expression,
create.Position,
@@ -124,12 +124,12 @@ func (s *IndexService) createIndex(ctx context.Context, tx *Tx, create *api.Inde
var index api.Index
if err := row.Scan(
&index.ID,
- &index.CreatorId,
+ &index.CreatorID,
&index.CreatedTs,
- &index.UpdaterId,
+ &index.UpdaterID,
&index.UpdatedTs,
- &index.DatabaseId,
- &index.TableId,
+ &index.DatabaseID,
+ &index.TableID,
&index.Name,
&index.Expression,
&index.Position,
@@ -150,10 +150,10 @@ func (s *IndexService) findIndexList(ctx context.Context, tx *Tx, find *api.Inde
if v := find.ID; v != nil {
where, args = append(where, "id = ?"), append(args, *v)
}
- if v := find.DatabaseId; v != nil {
+ if v := find.DatabaseID; v != nil {
where, args = append(where, "database_id = ?"), append(args, *v)
}
- if v := find.TableId; v != nil {
+ if v := find.TableID; v != nil {
where, args = append(where, "table_id = ?"), append(args, *v)
}
if v := find.Name; v != nil {
@@ -195,12 +195,12 @@ func (s *IndexService) findIndexList(ctx context.Context, tx *Tx, find *api.Inde
var index api.Index
if err := rows.Scan(
&index.ID,
- &index.CreatorId,
+ &index.CreatorID,
&index.CreatedTs,
- &index.UpdaterId,
+ &index.UpdaterID,
&index.UpdatedTs,
- &index.DatabaseId,
- &index.TableId,
+ &index.DatabaseID,
+ &index.TableID,
&index.Name,
&index.Expression,
&index.Position,
diff --git a/store/task.go b/store/task.go
index b564c1664e..cb11b4fd3a 100644
--- a/store/task.go
+++ b/store/task.go
@@ -126,7 +126,7 @@ func (s *TaskService) createTask(ctx context.Context, tx *Tx, create *api.TaskCr
var row *sql.Rows
var err error
- if create.DatabaseId == nil {
+ if create.DatabaseID == nil {
row, err = tx.QueryContext(ctx, `
INSERT INTO task (
creator_id,
@@ -142,11 +142,11 @@ func (s *TaskService) createTask(ctx context.Context, tx *Tx, create *api.TaskCr
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
RETURNING id, creator_id, created_ts, updater_id, updated_ts, pipeline_id, stage_id, instance_id, database_id, name, `+"`status`, `type`, payload"+`
`,
- create.CreatorId,
- create.CreatorId,
- create.PipelineId,
- create.StageId,
- create.InstanceId,
+ create.CreatorID,
+ create.CreatorID,
+ create.PipelineID,
+ create.StageID,
+ create.InstanceID,
create.Name,
create.Status,
create.Type,
@@ -169,12 +169,12 @@ func (s *TaskService) createTask(ctx context.Context, tx *Tx, create *api.TaskCr
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
RETURNING id, creator_id, created_ts, updater_id, updated_ts, pipeline_id, stage_id, instance_id, database_id, name, `+"`status`, `type`, payload"+`
`,
- create.CreatorId,
- create.CreatorId,
- create.PipelineId,
- create.StageId,
- create.InstanceId,
- create.DatabaseId,
+ create.CreatorID,
+ create.CreatorID,
+ create.PipelineID,
+ create.StageID,
+ create.InstanceID,
+ create.DatabaseID,
create.Name,
create.Status,
create.Type,
@@ -189,19 +189,19 @@ func (s *TaskService) createTask(ctx context.Context, tx *Tx, create *api.TaskCr
row.Next()
var task api.Task
- var databaseId sql.NullInt32
+ var databaseID sql.NullInt32
task.TaskRunList = []*api.TaskRun{}
task.TaskCheckRunList = []*api.TaskCheckRun{}
if err := row.Scan(
&task.ID,
- &task.CreatorId,
+ &task.CreatorID,
&task.CreatedTs,
- &task.UpdaterId,
+ &task.UpdaterID,
&task.UpdatedTs,
- &task.PipelineId,
- &task.StageId,
- &task.InstanceId,
- &databaseId,
+ &task.PipelineID,
+ &task.StageID,
+ &task.InstanceID,
+ &databaseID,
&task.Name,
&task.Status,
&task.Type,
@@ -210,9 +210,9 @@ func (s *TaskService) createTask(ctx context.Context, tx *Tx, create *api.TaskCr
return nil, FormatError(err)
}
- if databaseId.Valid {
- val := int(databaseId.Int32)
- task.DatabaseId = &val
+ if databaseID.Valid {
+ val := int(databaseID.Int32)
+ task.DatabaseID = &val
}
return &task, nil
@@ -236,10 +236,10 @@ func (s *TaskService) findTaskList(ctx context.Context, tx *Tx, find *api.TaskFi
if v := find.ID; v != nil {
where, args = append(where, "id = ?"), append(args, *v)
}
- if v := find.PipelineId; v != nil {
+ if v := find.PipelineID; v != nil {
where, args = append(where, "pipeline_id = ?"), append(args, *v)
}
- if v := find.StageId; v != nil {
+ if v := find.StageID; v != nil {
where, args = append(where, "stage_id = ?"), append(args, *v)
}
if v := find.StatusList; v != nil {
@@ -281,14 +281,14 @@ func (s *TaskService) findTaskList(ctx context.Context, tx *Tx, find *api.TaskFi
var task api.Task
if err := rows.Scan(
&task.ID,
- &task.CreatorId,
+ &task.CreatorID,
&task.CreatedTs,
- &task.UpdaterId,
+ &task.UpdaterID,
&task.UpdatedTs,
- &task.PipelineId,
- &task.StageId,
- &task.InstanceId,
- &task.DatabaseId,
+ &task.PipelineID,
+ &task.StageID,
+ &task.InstanceID,
+ &task.DatabaseID,
&task.Name,
&task.Status,
&task.Type,
@@ -298,7 +298,7 @@ func (s *TaskService) findTaskList(ctx context.Context, tx *Tx, find *api.TaskFi
}
taskRunFind := &api.TaskRunFind{
- TaskId: &task.ID,
+ TaskID: &task.ID,
}
task.TaskRunList, err = s.TaskRunService.FindTaskRunListTx(ctx, tx.Tx, taskRunFind)
if err != nil {
@@ -306,7 +306,7 @@ func (s *TaskService) findTaskList(ctx context.Context, tx *Tx, find *api.TaskFi
}
taskCheckRunFind := &api.TaskCheckRunFind{
- TaskId: &task.ID,
+ TaskID: &task.ID,
}
task.TaskCheckRunList, err = s.TaskCheckRunService.FindTaskCheckRunListTx(ctx, tx.Tx, taskCheckRunFind)
if err != nil {
@@ -324,7 +324,7 @@ func (s *TaskService) findTaskList(ctx context.Context, tx *Tx, find *api.TaskFi
// patchTask updates a task by ID. Returns the new state of the task after update.
func (s *TaskService) patchTask(ctx context.Context, tx *Tx, patch *api.TaskPatch) (*api.Task, error) {
// Build UPDATE clause.
- set, args := []string{"updater_id = ?"}, []interface{}{patch.UpdaterId}
+ set, args := []string{"updater_id = ?"}, []interface{}{patch.UpdaterID}
if v := patch.Payload; v != nil {
set, args = append(set, "payload = ?"), append(args, *v)
}
@@ -348,14 +348,14 @@ func (s *TaskService) patchTask(ctx context.Context, tx *Tx, patch *api.TaskPatc
var task api.Task
if err := row.Scan(
&task.ID,
- &task.CreatorId,
+ &task.CreatorID,
&task.CreatedTs,
- &task.UpdaterId,
+ &task.UpdaterID,
&task.UpdatedTs,
- &task.PipelineId,
- &task.StageId,
- &task.InstanceId,
- &task.DatabaseId,
+ &task.PipelineID,
+ &task.StageID,
+ &task.InstanceID,
+ &task.DatabaseID,
&task.Name,
&task.Status,
&task.Type,
@@ -385,7 +385,7 @@ func (s *TaskService) patchTaskStatus(ctx context.Context, tx *Tx, patch *api.Ta
if !(task.Status == api.TaskPendingApproval && patch.Status == api.TaskPending) {
taskRunFind := &api.TaskRunFind{
- TaskId: &task.ID,
+ TaskID: &task.ID,
StatusList: &[]api.TaskRunStatus{
api.TaskRunRunning,
},
@@ -405,8 +405,8 @@ func (s *TaskService) patchTaskStatus(ctx context.Context, tx *Tx, patch *api.Ta
if patch.Status == api.TaskRunning {
taskRunCreate := &api.TaskRunCreate{
- CreatorId: patch.UpdaterId,
- TaskId: task.ID,
+ CreatorID: patch.UpdaterID,
+ TaskID: task.ID,
Name: fmt.Sprintf("%s %d", task.Name, time.Now().Unix()),
Type: task.Type,
Payload: task.Payload,
@@ -417,8 +417,8 @@ func (s *TaskService) patchTaskStatus(ctx context.Context, tx *Tx, patch *api.Ta
} else {
taskRunStatusPatch := &api.TaskRunStatusPatch{
ID: &taskRun.ID,
- UpdaterId: patch.UpdaterId,
- TaskId: &patch.ID,
+ UpdaterID: patch.UpdaterID,
+ TaskID: &patch.ID,
Code: patch.Code,
Result: patch.Result,
Comment: patch.Comment,
@@ -441,7 +441,7 @@ func (s *TaskService) patchTaskStatus(ctx context.Context, tx *Tx, patch *api.Ta
// Updates the task
// Build UPDATE clause.
- set, args := []string{"updater_id = ?"}, []interface{}{patch.UpdaterId}
+ set, args := []string{"updater_id = ?"}, []interface{}{patch.UpdaterID}
set, args = append(set, "`status` = ?"), append(args, patch.Status)
args = append(args, patch.ID)
@@ -463,14 +463,14 @@ func (s *TaskService) patchTaskStatus(ctx context.Context, tx *Tx, patch *api.Ta
var task api.Task
if err := row.Scan(
&task.ID,
- &task.CreatorId,
+ &task.CreatorID,
&task.CreatedTs,
- &task.UpdaterId,
+ &task.UpdaterID,
&task.UpdatedTs,
- &task.PipelineId,
- &task.StageId,
- &task.InstanceId,
- &task.DatabaseId,
+ &task.PipelineID,
+ &task.StageID,
+ &task.InstanceID,
+ &task.DatabaseID,
&task.Name,
&task.Status,
&task.Type,
@@ -480,7 +480,7 @@ func (s *TaskService) patchTaskStatus(ctx context.Context, tx *Tx, patch *api.Ta
}
taskRunFind := &api.TaskRunFind{
- TaskId: &task.ID,
+ TaskID: &task.ID,
}
task.TaskRunList, err = s.TaskRunService.FindTaskRunListTx(ctx, tx.Tx, taskRunFind)
if err != nil {
@@ -488,7 +488,7 @@ func (s *TaskService) patchTaskStatus(ctx context.Context, tx *Tx, patch *api.Ta
}
taskCheckRunFind := &api.TaskCheckRunFind{
- TaskId: &task.ID,
+ TaskID: &task.ID,
}
task.TaskCheckRunList, err = s.TaskCheckRunService.FindTaskCheckRunListTx(ctx, tx.Tx, taskCheckRunFind)
if err != nil {
diff --git a/store/task_check_run.go b/store/task_check_run.go
index c9f2de4c1d..39e20a6a38 100644
--- a/store/task_check_run.go
+++ b/store/task_check_run.go
@@ -41,7 +41,7 @@ func (s *TaskCheckRunService) CreateTaskCheckRunIfNeeded(ctx context.Context, cr
statusList = append(statusList, api.TaskCheckRunCanceled)
}
taskCheckRunFind := &api.TaskCheckRunFind{
- TaskId: &create.TaskId,
+ TaskID: &create.TaskID,
Type: &create.Type,
StatusList: &statusList,
}
@@ -70,7 +70,7 @@ func (s *TaskCheckRunService) CreateTaskCheckRunIfNeeded(ctx context.Context, cr
if runningCount > 1 {
// Normally, this should not happen, if it occurs, emit a warning
s.l.Warn(fmt.Sprintf("Found %d task check run, expect at most 1", len(taskCheckRunList)),
- zap.Int("task_id", create.TaskId),
+ zap.Int("task_id", create.TaskID),
zap.String("task_check_type", string(create.Type)),
)
}
@@ -104,9 +104,9 @@ func (s *TaskCheckRunService) CreateTaskCheckRunTx(ctx context.Context, tx *sql.
VALUES (?, ?, ?, 'RUNNING', ?, ?, ?)
RETURNING id, creator_id, created_ts, updater_id, updated_ts, task_id, `+"`status`, `type`, code, comment, result, payload"+`
`,
- create.CreatorId,
- create.CreatorId,
- create.TaskId,
+ create.CreatorID,
+ create.CreatorID,
+ create.TaskID,
create.Type,
create.Comment,
create.Payload,
@@ -121,11 +121,11 @@ func (s *TaskCheckRunService) CreateTaskCheckRunTx(ctx context.Context, tx *sql.
var taskCheckRun api.TaskCheckRun
if err := row.Scan(
&taskCheckRun.ID,
- &taskCheckRun.CreatorId,
+ &taskCheckRun.CreatorID,
&taskCheckRun.CreatedTs,
- &taskCheckRun.UpdaterId,
+ &taskCheckRun.UpdaterID,
&taskCheckRun.UpdatedTs,
- &taskCheckRun.TaskId,
+ &taskCheckRun.TaskID,
&taskCheckRun.Status,
&taskCheckRun.Type,
&taskCheckRun.Code,
@@ -203,7 +203,7 @@ func (s *TaskCheckRunService) PatchTaskCheckRunStatus(ctx context.Context, patch
// PatchTaskCheckRunStatusTx updates a taskCheckRun status. Returns the new state of the taskCheckRun after update.
func (s *TaskCheckRunService) PatchTaskCheckRunStatusTx(ctx context.Context, tx *sql.Tx, patch *api.TaskCheckRunStatusPatch) (*api.TaskCheckRun, error) {
// Build UPDATE clause.
- set, args := []string{"updater_id = ?"}, []interface{}{patch.UpdaterId}
+ set, args := []string{"updater_id = ?"}, []interface{}{patch.UpdaterID}
set, args = append(set, "`status` = ?"), append(args, patch.Status)
set, args = append(set, "code = ?"), append(args, patch.Code)
set, args = append(set, "result = ?"), append(args, patch.Result)
@@ -232,11 +232,11 @@ func (s *TaskCheckRunService) PatchTaskCheckRunStatusTx(ctx context.Context, tx
var taskCheckRun api.TaskCheckRun
if err := row.Scan(
&taskCheckRun.ID,
- &taskCheckRun.CreatorId,
+ &taskCheckRun.CreatorID,
&taskCheckRun.CreatedTs,
- &taskCheckRun.UpdaterId,
+ &taskCheckRun.UpdaterID,
&taskCheckRun.UpdatedTs,
- &taskCheckRun.TaskId,
+ &taskCheckRun.TaskID,
&taskCheckRun.Status,
&taskCheckRun.Type,
&taskCheckRun.Code,
@@ -256,7 +256,7 @@ func (s *TaskCheckRunService) findTaskCheckRunList(ctx context.Context, tx *sql.
if v := find.ID; v != nil {
where, args = append(where, "id = ?"), append(args, *v)
}
- if v := find.TaskId; v != nil {
+ if v := find.TaskID; v != nil {
where, args = append(where, "task_id = ?"), append(args, *v)
}
if v := find.Type; v != nil {
@@ -305,11 +305,11 @@ func (s *TaskCheckRunService) findTaskCheckRunList(ctx context.Context, tx *sql.
var taskCheckRun api.TaskCheckRun
if err := rows.Scan(
&taskCheckRun.ID,
- &taskCheckRun.CreatorId,
+ &taskCheckRun.CreatorID,
&taskCheckRun.CreatedTs,
- &taskCheckRun.UpdaterId,
+ &taskCheckRun.UpdaterID,
&taskCheckRun.UpdatedTs,
- &taskCheckRun.TaskId,
+ &taskCheckRun.TaskID,
&taskCheckRun.Status,
&taskCheckRun.Type,
&taskCheckRun.Code,
diff --git a/store/task_run.go b/store/task_run.go
index 4f574a5113..db84bb84f1 100644
--- a/store/task_run.go
+++ b/store/task_run.go
@@ -41,9 +41,9 @@ func (s *TaskRunService) CreateTaskRunTx(ctx context.Context, tx *sql.Tx, create
VALUES (?, ?, ?, ?, 'RUNNING', ?, ?)
RETURNING id, creator_id, created_ts, updater_id, updated_ts, task_id, name, `+"`status`, `type`, code, comment, result, payload"+`
`,
- create.CreatorId,
- create.CreatorId,
- create.TaskId,
+ create.CreatorID,
+ create.CreatorID,
+ create.TaskID,
create.Name,
create.Type,
create.Payload,
@@ -58,11 +58,11 @@ func (s *TaskRunService) CreateTaskRunTx(ctx context.Context, tx *sql.Tx, create
var taskRun api.TaskRun
if err := row.Scan(
&taskRun.ID,
- &taskRun.CreatorId,
+ &taskRun.CreatorID,
&taskRun.CreatedTs,
- &taskRun.UpdaterId,
+ &taskRun.UpdaterID,
&taskRun.UpdatedTs,
- &taskRun.TaskId,
+ &taskRun.TaskID,
&taskRun.Name,
&taskRun.Status,
&taskRun.Type,
@@ -105,7 +105,7 @@ func (s *TaskRunService) FindTaskRunTx(ctx context.Context, tx *sql.Tx, find *ap
// PatchTaskRunStatusTx updates a taskRun status. Returns the new state of the taskRun after update.
func (s *TaskRunService) PatchTaskRunStatusTx(ctx context.Context, tx *sql.Tx, patch *api.TaskRunStatusPatch) (*api.TaskRun, error) {
// Build UPDATE clause.
- set, args := []string{"updater_id = ?"}, []interface{}{patch.UpdaterId}
+ set, args := []string{"updater_id = ?"}, []interface{}{patch.UpdaterID}
set, args = append(set, "`status` = ?"), append(args, patch.Status)
if v := patch.Code; v != nil {
set, args = append(set, "code = ?"), append(args, *v)
@@ -122,7 +122,7 @@ func (s *TaskRunService) PatchTaskRunStatusTx(ctx context.Context, tx *sql.Tx, p
if v := patch.ID; v != nil {
where, args = append(where, "id = ?"), append(args, *v)
}
- if v := patch.TaskId; v != nil {
+ if v := patch.TaskID; v != nil {
where, args = append(where, "task_id = ?"), append(args, *v)
}
@@ -144,11 +144,11 @@ func (s *TaskRunService) PatchTaskRunStatusTx(ctx context.Context, tx *sql.Tx, p
var taskRun api.TaskRun
if err := row.Scan(
&taskRun.ID,
- &taskRun.CreatorId,
+ &taskRun.CreatorID,
&taskRun.CreatedTs,
- &taskRun.UpdaterId,
+ &taskRun.UpdaterID,
&taskRun.UpdatedTs,
- &taskRun.TaskId,
+ &taskRun.TaskID,
&taskRun.Name,
&taskRun.Status,
&taskRun.Type,
@@ -169,7 +169,7 @@ func (s *TaskRunService) findTaskRunList(ctx context.Context, tx *sql.Tx, find *
if v := find.ID; v != nil {
where, args = append(where, "id = ?"), append(args, *v)
}
- if v := find.TaskId; v != nil {
+ if v := find.TaskID; v != nil {
where, args = append(where, "task_id = ?"), append(args, *v)
}
@@ -212,11 +212,11 @@ func (s *TaskRunService) findTaskRunList(ctx context.Context, tx *sql.Tx, find *
var taskRun api.TaskRun
if err := rows.Scan(
&taskRun.ID,
- &taskRun.CreatorId,
+ &taskRun.CreatorID,
&taskRun.CreatedTs,
- &taskRun.UpdaterId,
+ &taskRun.UpdaterID,
&taskRun.UpdatedTs,
- &taskRun.TaskId,
+ &taskRun.TaskID,
&taskRun.Name,
&taskRun.Status,
&taskRun.Type,
diff --git a/store/vcs.go b/store/vcs.go
index e97df18083..0d51c4e8b5 100644
--- a/store/vcs.go
+++ b/store/vcs.go
@@ -141,13 +141,13 @@ func createVCS(ctx context.Context, tx *Tx, create *api.VCSCreate) (*api.VCS, er
VALUES (?, ?, ?, ?, ?, ?, ?, ?)
RETURNING id, creator_id, created_ts, updater_id, updated_ts, name, `+"`type`, instance_url, api_url, application_id, secret"+`
`,
- create.CreatorId,
- create.CreatorId,
+ create.CreatorID,
+ create.CreatorID,
create.Name,
create.Type,
create.InstanceURL,
create.ApiURL,
- create.ApplicationId,
+ create.ApplicationID,
create.Secret,
)
@@ -160,15 +160,15 @@ func createVCS(ctx context.Context, tx *Tx, create *api.VCSCreate) (*api.VCS, er
var vcs api.VCS
if err := row.Scan(
&vcs.ID,
- &vcs.CreatorId,
+ &vcs.CreatorID,
&vcs.CreatedTs,
- &vcs.UpdaterId,
+ &vcs.UpdaterID,
&vcs.UpdatedTs,
&vcs.Name,
&vcs.Type,
&vcs.InstanceURL,
&vcs.ApiURL,
- &vcs.ApplicationId,
+ &vcs.ApplicationID,
&vcs.Secret,
); err != nil {
return nil, FormatError(err)
@@ -212,15 +212,15 @@ func findVCSList(ctx context.Context, tx *Tx, find *api.VCSFind) (_ []*api.VCS,
var vcs api.VCS
if err := rows.Scan(
&vcs.ID,
- &vcs.CreatorId,
+ &vcs.CreatorID,
&vcs.CreatedTs,
- &vcs.UpdaterId,
+ &vcs.UpdaterID,
&vcs.UpdatedTs,
&vcs.Name,
&vcs.Type,
&vcs.InstanceURL,
&vcs.ApiURL,
- &vcs.ApplicationId,
+ &vcs.ApplicationID,
&vcs.Secret,
); err != nil {
return nil, FormatError(err)
@@ -238,11 +238,11 @@ func findVCSList(ctx context.Context, tx *Tx, find *api.VCSFind) (_ []*api.VCS,
// patchVCS updates a vcs by ID. Returns the new state of the vcs after update.
func patchVCS(ctx context.Context, tx *Tx, patch *api.VCSPatch) (*api.VCS, error) {
// Build UPDATE clause.
- set, args := []string{"updater_id = ?"}, []interface{}{patch.UpdaterId}
+ set, args := []string{"updater_id = ?"}, []interface{}{patch.UpdaterID}
if v := patch.Name; v != nil {
set, args = append(set, "name = ?"), append(args, *v)
}
- if v := patch.ApplicationId; v != nil {
+ if v := patch.ApplicationID; v != nil {
set, args = append(set, "application_id = ?"), append(args, *v)
}
if v := patch.Secret; v != nil {
@@ -268,15 +268,15 @@ func patchVCS(ctx context.Context, tx *Tx, patch *api.VCSPatch) (*api.VCS, error
var vcs api.VCS
if err := row.Scan(
&vcs.ID,
- &vcs.CreatorId,
+ &vcs.CreatorID,
&vcs.CreatedTs,
- &vcs.UpdaterId,
+ &vcs.UpdaterID,
&vcs.UpdatedTs,
&vcs.Name,
&vcs.Type,
&vcs.InstanceURL,
&vcs.ApiURL,
- &vcs.ApplicationId,
+ &vcs.ApplicationID,
&vcs.Secret,
); err != nil {
return nil, FormatError(err)
diff --git a/store/view.go b/store/view.go
index 58d0d36162..1c1643c950 100644
--- a/store/view.go
+++ b/store/view.go
@@ -120,11 +120,11 @@ func (s *ViewService) createView(ctx context.Context, tx *Tx, create *api.ViewCr
VALUES (?, ?, ?, ?, ?, ?, ?, ?)`+
"RETURNING id, creator_id, created_ts, updater_id, updated_ts, database_id, name, definition, comment"+`
`,
- create.CreatorId,
+ create.CreatorID,
create.CreatedTs,
- create.CreatorId,
+ create.CreatorID,
create.UpdatedTs,
- create.DatabaseId,
+ create.DatabaseID,
create.Name,
create.Definition,
create.Comment,
@@ -139,11 +139,11 @@ func (s *ViewService) createView(ctx context.Context, tx *Tx, create *api.ViewCr
var view api.View
if err := row.Scan(
&view.ID,
- &view.CreatorId,
+ &view.CreatorID,
&view.CreatedTs,
- &view.UpdaterId,
+ &view.UpdaterID,
&view.UpdatedTs,
- &view.DatabaseId,
+ &view.DatabaseID,
&view.Name,
&view.Definition,
&view.Comment,
@@ -160,7 +160,7 @@ func (s *ViewService) findViewList(ctx context.Context, tx *Tx, find *api.ViewFi
if v := find.ID; v != nil {
where, args = append(where, "id = ?"), append(args, *v)
}
- if v := find.DatabaseId; v != nil {
+ if v := find.DatabaseID; v != nil {
where, args = append(where, "database_id = ?"), append(args, *v)
}
if v := find.Name; v != nil {
@@ -194,11 +194,11 @@ func (s *ViewService) findViewList(ctx context.Context, tx *Tx, find *api.ViewFi
var view api.View
if err := rows.Scan(
&view.ID,
- &view.CreatorId,
+ &view.CreatorID,
&view.CreatedTs,
- &view.UpdaterId,
+ &view.UpdaterID,
&view.UpdatedTs,
- &view.DatabaseId,
+ &view.DatabaseID,
&view.Name,
&view.Definition,
&view.Comment,
@@ -218,7 +218,7 @@ func (s *ViewService) findViewList(ctx context.Context, tx *Tx, find *api.ViewFi
// deleteView permanently deletes views from a database.
func deleteView(ctx context.Context, tx *Tx, delete *api.ViewDelete) error {
// Remove row from database.
- _, err := tx.ExecContext(ctx, `DELETE FROM vw WHERE database_id = ?`, delete.DatabaseId)
+ _, err := tx.ExecContext(ctx, `DELETE FROM vw WHERE database_id = ?`, delete.DatabaseID)
if err != nil {
return FormatError(err)
}