From a21bff3ffb8497d6e1b6c3bb50d9a9b2469f4eb0 Mon Sep 17 00:00:00 2001 From: kolaente Date: Tue, 14 Mar 2023 15:35:03 +0100 Subject: [PATCH] fix: compile errors --- pkg/models/events.go | 41 +------------------ pkg/models/project.go | 2 +- .../migration/create_from_structure.go | 5 ++- pkg/modules/migration/ticktick/ticktick.go | 34 +++++++-------- pkg/user/users_project.go | 2 +- 5 files changed, 24 insertions(+), 60 deletions(-) diff --git a/pkg/models/events.go b/pkg/models/events.go index 8ca249d16c7..2953c566ef6 100644 --- a/pkg/models/events.go +++ b/pkg/models/events.go @@ -166,46 +166,9 @@ func (t *TaskRelationDeletedEvent) Name() string { return "task.relation.deleted" } -////////////////////// -// Namespace Events // -////////////////////// - -// NamespaceCreatedEvent represents an event where a namespace has been created -type NamespaceCreatedEvent struct { - Namespace *Namespace - Doer web.Auth -} - -// Name defines the name for NamespaceCreatedEvent -func (n *NamespaceCreatedEvent) Name() string { - return "namespace.created" -} - -// NamespaceUpdatedEvent represents an event where a namespace has been updated -type NamespaceUpdatedEvent struct { - Namespace *Namespace - Doer web.Auth -} - -// Name defines the name for NamespaceUpdatedEvent -func (n *NamespaceUpdatedEvent) Name() string { - return "namespace.updated" -} - -// NamespaceDeletedEvent represents a NamespaceDeletedEvent event -type NamespaceDeletedEvent struct { - Namespace *Namespace - Doer web.Auth -} - -// TopicName defines the name for NamespaceDeletedEvent -func (t *NamespaceDeletedEvent) Name() string { - return "namespace.deleted" -} - -///////////////// +//////////////////// // Project Events // -///////////////// +//////////////////// // ProjectCreatedEvent represents an event where a project has been created type ProjectCreatedEvent struct { diff --git a/pkg/models/project.go b/pkg/models/project.go index af15b311c58..3e1bb21c7a9 100644 --- a/pkg/models/project.go +++ b/pkg/models/project.go @@ -874,7 +874,7 @@ func (p *Project) Create(s *xorm.Session, a web.Auth) (err error) { // @Router /projects/{id} [delete] func (p *Project) Delete(s *xorm.Session, a web.Auth) (err error) { - fullList, err := GetProjectSimpleByID(s, l.ID) + fullList, err := GetProjectSimpleByID(s, p.ID) if err != nil { return } diff --git a/pkg/modules/migration/create_from_structure.go b/pkg/modules/migration/create_from_structure.go index 9275134db73..eda0fcd40f8 100644 --- a/pkg/modules/migration/create_from_structure.go +++ b/pkg/modules/migration/create_from_structure.go @@ -248,8 +248,9 @@ func createProjectWithEverything(s *xorm.Session, project *models.ProjectWithTas var lb *models.Label var exists bool if label == nil { - continue - }lb, exists = labels[label.Title+label.HexColor] + continue + } + lb, exists = labels[label.Title+label.HexColor] if !exists { err = label.Create(s, user) if err != nil { diff --git a/pkg/modules/migration/ticktick/ticktick.go b/pkg/modules/migration/ticktick/ticktick.go index 3b33e6f7f8a..9987a45576f 100644 --- a/pkg/modules/migration/ticktick/ticktick.go +++ b/pkg/modules/migration/ticktick/ticktick.go @@ -39,26 +39,26 @@ type Migrator struct { } type tickTickTask struct { - FolderName string`csv:"Folder Name"` - ProjectName string`csv:"List Name"` - Title string`csv:"Title"` + FolderName string `csv:"Folder Name"` + ProjectName string `csv:"List Name"` + Title string `csv:"Title"` TagsList string `csv:"Tags"` - Tags []string`csv:"-"` - Content string`csv:"Content"` + Tags []string `csv:"-"` + Content string `csv:"Content"` IsChecklistString string `csv:"Is Check list"` - IsCheckproject bool`csv:"-"` - StartDate tickTickTime `csv:"Start Date"` - DueDate tickTickTime `csv:"Due Date"` + IsChecklist bool `csv:"-"` + StartDate tickTickTime `csv:"Start Date"` + DueDate tickTickTime `csv:"Due Date"` ReminderDuration string `csv:"Reminder"` - Reminder time.Duration`csv:"-"` - Repeat string`csv:"Repeat"` - Priority int`csv:"Priority"` - Status string`csv:"Status"` - CreatedTime tickTickTime `csv:"Created Time"` - CompletedTime tickTickTime `csv:"Completed Time"` - Order float64`csv:"Order"` - TaskID int64`csv:"taskId"` - ParentID int64`csv:"parentId"` + Reminder time.Duration `csv:"-"` + Repeat string `csv:"Repeat"` + Priority int `csv:"Priority"` + Status string `csv:"Status"` + CreatedTime tickTickTime `csv:"Created Time"` + CompletedTime tickTickTime `csv:"Completed Time"` + Order float64 `csv:"Order"` + TaskID int64 `csv:"taskId"` + ParentID int64 `csv:"parentId"` } type tickTickTime struct { diff --git a/pkg/user/users_project.go b/pkg/user/users_project.go index 97fe25c8c17..299a50c0137 100644 --- a/pkg/user/users_project.go +++ b/pkg/user/users_project.go @@ -33,7 +33,7 @@ type ProjectUserOpts struct { } // ListUsers returns a list with all users, filtered by an optional search string -func ProjectUsers(s *xorm.Session, search string, opts *ProjectUserOpts) (users []*User, err error) { +func ListUsers(s *xorm.Session, search string, opts *ProjectUserOpts) (users []*User, err error) { if opts == nil { opts = &ProjectUserOpts{} }