From 52dbc4c0c368a6692749eaaa560f09f7fb8b2a41 Mon Sep 17 00:00:00 2001 From: Denis Arh Date: Thu, 26 Jul 2018 20:29:09 +0200 Subject: [PATCH] Fix naming (Id -> ID), add names to interface arguments --- crm/repository/module.go | 2 +- crm/rest/auth.go | 19 --- crm/rest/field.go | 4 +- crm/rest/module.go | 12 +- crm/service/field.go | 4 +- crm/service/module.go | 14 +- sam/rest/channel.go | 8 +- sam/rest/message.go | 22 +-- sam/rest/organisation.go | 8 +- sam/rest/rest.go | 10 +- sam/rest/server/event.go | 51 ------- sam/rest/server/event_handlers.go | 51 ------- sam/rest/server/event_requests.go | 225 ------------------------------ sam/rest/team.go | 12 +- sam/rest/user.go | 2 +- sam/service/channel.go | 8 +- sam/service/message.go | 20 +-- sam/service/organisation.go | 8 +- sam/service/service.go | 10 +- sam/service/team.go | 12 +- sam/service/user.go | 10 +- sam/websocket/websocket.go | 2 +- 22 files changed, 84 insertions(+), 430 deletions(-) delete mode 100644 crm/rest/auth.go delete mode 100644 sam/rest/server/event.go delete mode 100644 sam/rest/server/event_handlers.go delete mode 100644 sam/rest/server/event_requests.go diff --git a/crm/repository/module.go b/crm/repository/module.go index bb400c528..6f55b64a1 100644 --- a/crm/repository/module.go +++ b/crm/repository/module.go @@ -55,7 +55,7 @@ func (r module) Update(ctx context.Context, mod *types.Module) (*types.Module, e } } -func (r module) DeleteById(ctx context.Context, id uint64) error { +func (r module) DeleteByID(ctx context.Context, id uint64) error { db := factory.Database.MustGet() if _, err := db.Exec("DELETE FROM crm_module WHERE ID = ?", id); err != nil { return ErrDatabaseError diff --git a/crm/rest/auth.go b/crm/rest/auth.go deleted file mode 100644 index ca1985c58..000000000 --- a/crm/rest/auth.go +++ /dev/null @@ -1,19 +0,0 @@ -package rest - -import ( - "net/http" -) - -var pass = func(next http.Handler) http.Handler { - return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - next.ServeHTTP(w, r) - }) -} - -func (*Module) Authenticator() func(http.Handler) http.Handler { - return pass -} - -func (*Field) Authenticator() func(http.Handler) http.Handler { - return pass -} diff --git a/crm/rest/field.go b/crm/rest/field.go index 9ad3f6d60..42794e535 100644 --- a/crm/rest/field.go +++ b/crm/rest/field.go @@ -16,8 +16,8 @@ type ( } fieldService interface { - FindByName(context.Context, string) (*types.Field, error) - Find(context.Context) ([]*types.Field, error) + FindByName(ctx context.Context, name string) (*types.Field, error) + Find(ctx context.Context) ([]*types.Field, error) } ) diff --git a/crm/rest/module.go b/crm/rest/module.go index df938dee5..444ee84fb 100644 --- a/crm/rest/module.go +++ b/crm/rest/module.go @@ -18,12 +18,12 @@ type ( } moduleService interface { - FindByID(context.Context, uint64) (*types.Module, error) - Find(context.Context) ([]*types.Module, error) + FindByID(ctx context.Context, moduleID uint64) (*types.Module, error) + Find(ctx context.Context) ([]*types.Module, error) - Create(context.Context, *types.Module) (*types.Module, error) - Update(context.Context, *types.Module) (*types.Module, error) - DeleteById(context.Context, uint64) error + Create(ctx context.Context, module *types.Module) (*types.Module, error) + Update(ctx context.Context, module *types.Module) (*types.Module, error) + DeleteByID(ctx context.Context, moduleID uint64) error } ) @@ -42,7 +42,7 @@ func (c *Module) Read(ctx context.Context, r *server.ModuleReadRequest) (interfa } func (c *Module) Delete(ctx context.Context, r *server.ModuleDeleteRequest) (interface{}, error) { - return resputil.OK(), c.svc.DeleteById(ctx, r.ID) + return resputil.OK(), c.svc.DeleteByID(ctx, r.ID) } func (c *Module) Create(ctx context.Context, r *server.ModuleCreateRequest) (interface{}, error) { diff --git a/crm/service/field.go b/crm/service/field.go index e635c35ef..b2e1d2152 100644 --- a/crm/service/field.go +++ b/crm/service/field.go @@ -12,8 +12,8 @@ type ( } fieldTypeRepository interface { - FindByName(context.Context, string) (*types.Field, error) - Find(context.Context) ([]*types.Field, error) + FindByName(ctx context.Context, name string) (*types.Field, error) + Find(ctx context.Context) ([]*types.Field, error) } ) diff --git a/crm/service/module.go b/crm/service/module.go index 1224c8db2..d13fce79b 100644 --- a/crm/service/module.go +++ b/crm/service/module.go @@ -12,12 +12,12 @@ type ( } moduleRepository interface { - FindByID(context.Context, uint64) (*types.Module, error) - Find(context.Context) ([]*types.Module, error) + FindByID(ctx context.Context, moduleID uint64) (*types.Module, error) + Find(ctx context.Context) ([]*types.Module, error) - Create(context.Context, *types.Module) (*types.Module, error) - Update(context.Context, *types.Module) (*types.Module, error) - DeleteById(context.Context, uint64) error + Create(ctx context.Context, module *types.Module) (*types.Module, error) + Update(ctx context.Context, module *types.Module) (*types.Module, error) + DeleteByID(ctx context.Context, moduleID uint64) error } ) @@ -43,6 +43,6 @@ func (svc module) Update(ctx context.Context, mod *types.Module) (*types.Module, return svc.repository.Update(ctx, mod) } -func (svc module) DeleteById(ctx context.Context, id uint64) error { - return svc.repository.DeleteById(ctx, id) +func (svc module) DeleteByID(ctx context.Context, id uint64) error { + return svc.repository.DeleteByID(ctx, id) } diff --git a/sam/rest/channel.go b/sam/rest/channel.go index 55a368f80..06899b5f2 100644 --- a/sam/rest/channel.go +++ b/sam/rest/channel.go @@ -18,11 +18,11 @@ type ( } channelService interface { - FindByID(context.Context, uint64) (*types.Channel, error) - Find(context.Context, *types.ChannelFilter) ([]*types.Channel, error) + FindByID(ctx context.Context, channelID uint64) (*types.Channel, error) + Find(ctx context.Context, filter *types.ChannelFilter) ([]*types.Channel, error) - Create(context.Context, *types.Channel) (*types.Channel, error) - Update(context.Context, *types.Channel) (*types.Channel, error) + Create(ctx context.Context, channel *types.Channel) (*types.Channel, error) + Update(ctx context.Context, channel *types.Channel) (*types.Channel, error) deleter archiver diff --git a/sam/rest/message.go b/sam/rest/message.go index 324e59d2e..fec60fc56 100644 --- a/sam/rest/message.go +++ b/sam/rest/message.go @@ -15,22 +15,22 @@ type ( } messageService interface { - Find(context.Context, *types.MessageFilter) ([]*types.Message, error) + Find(ctx context.Context, filter *types.MessageFilter) ([]*types.Message, error) - Create(context.Context, *types.Message) (*types.Message, error) - Update(context.Context, *types.Message) (*types.Message, error) + Create(ctx context.Context, messages *types.Message) (*types.Message, error) + Update(ctx context.Context, messages *types.Message) (*types.Message, error) - React(context.Context, uint64, string) error - Unreact(context.Context, uint64, string) error + React(ctx context.Context, messageID uint64, reaction string) error + Unreact(ctx context.Context, messageID uint64, reaction string) error - Pin(context.Context, uint64) error - Unpin(context.Context, uint64) error + Pin(ctx context.Context, messageID uint64) error + Unpin(ctx context.Context, messageID uint64) error - Flag(context.Context, uint64) error - Unflag(context.Context, uint64) error + Flag(ctx context.Context, messageID uint64) error + Unflag(ctx context.Context, messageID uint64) error - Attach(context.Context) (*types.Attachment, error) - Detach(context.Context, uint64) error + Attach(ctx context.Context) (*types.Attachment, error) + Detach(ctx context.Context, messageID uint64) error deleter } diff --git a/sam/rest/organisation.go b/sam/rest/organisation.go index 2914e4468..425352ed2 100644 --- a/sam/rest/organisation.go +++ b/sam/rest/organisation.go @@ -15,11 +15,11 @@ type ( } organisationService interface { - FindByID(context.Context, uint64) (*types.Organisation, error) - Find(context.Context, *types.OrganisationFilter) ([]*types.Organisation, error) + FindByID(ctx context.Context, organisationID uint64) (*types.Organisation, error) + Find(ctx context.Context, filter *types.OrganisationFilter) ([]*types.Organisation, error) - Create(context.Context, *types.Organisation) (*types.Organisation, error) - Update(context.Context, *types.Organisation) (*types.Organisation, error) + Create(ctx context.Context, organisation *types.Organisation) (*types.Organisation, error) + Update(ctx context.Context, organisation *types.Organisation) (*types.Organisation, error) deleter archiver diff --git a/sam/rest/rest.go b/sam/rest/rest.go index bf051e94b..514d3f5f7 100644 --- a/sam/rest/rest.go +++ b/sam/rest/rest.go @@ -10,17 +10,17 @@ import ( type ( suspender interface { - Suspend(context.Context, uint64) error - Unsuspend(context.Context, uint64) error + Suspend(ctx context.Context, ID uint64) error + Unsuspend(ctx context.Context, ID uint64) error } archiver interface { - Archive(context.Context, uint64) error - Unarchive(context.Context, uint64) error + Archive(ctx context.Context, ID uint64) error + Unarchive(ctx context.Context, ID uint64) error } deleter interface { - Delete(context.Context, uint64) error + Delete(ctx context.Context, ID uint64) error } ) diff --git a/sam/rest/server/event.go b/sam/rest/server/event.go deleted file mode 100644 index 8c6392d3e..000000000 --- a/sam/rest/server/event.go +++ /dev/null @@ -1,51 +0,0 @@ -package server - -/* - Hello! This file is auto-generated from `docs/src/spec.json`. - - For development: - In order to update the generated files, edit this file under the location, - add your struct fields, imports, API definitions and whatever you want, and: - - 1. run [spec](https://github.com/titpetric/spec) in the same folder, - 2. run `./_gen.php` in this folder. - - You may edit `event.go`, `event.util.go` or `event_test.go` to - implement your API calls, helper functions and tests. The file `event.go` - is only generated the first time, and will not be overwritten if it exists. -*/ - -import ( - "context" - "net/http" -) - -// HTTP handlers are a superset of internal APIs -type EventHandlers struct { - Event EventAPI -} - -// Internal API interface -type EventAPI interface { - Edit(context.Context, *EventEditRequest) (interface{}, error) - Attach(context.Context, *EventAttachRequest) (interface{}, error) - Remove(context.Context, *EventRemoveRequest) (interface{}, error) - Read(context.Context, *EventReadRequest) (interface{}, error) - Search(context.Context, *EventSearchRequest) (interface{}, error) - Pin(context.Context, *EventPinRequest) (interface{}, error) - Flag(context.Context, *EventFlagRequest) (interface{}, error) - - // Authenticate API requests - Authenticator() func(http.Handler) http.Handler -} - -// HTTP API interface -type EventHandlersAPI interface { - Edit(http.ResponseWriter, *http.Request) - Attach(http.ResponseWriter, *http.Request) - Remove(http.ResponseWriter, *http.Request) - Read(http.ResponseWriter, *http.Request) - Search(http.ResponseWriter, *http.Request) - Pin(http.ResponseWriter, *http.Request) - Flag(http.ResponseWriter, *http.Request) -} diff --git a/sam/rest/server/event_handlers.go b/sam/rest/server/event_handlers.go deleted file mode 100644 index 56c93190d..000000000 --- a/sam/rest/server/event_handlers.go +++ /dev/null @@ -1,51 +0,0 @@ -package server - -/* - Hello! This file is auto-generated from `docs/src/spec.json`. - - For development: - In order to update the generated files, edit this file under the location, - add your struct fields, imports, API definitions and whatever you want, and: - - 1. run [spec](https://github.com/titpetric/spec) in the same folder, - 2. run `./_gen.php` in this folder. - - You may edit `event.go`, `event.util.go` or `event_test.go` to - implement your API calls, helper functions and tests. The file `event.go` - is only generated the first time, and will not be overwritten if it exists. -*/ - -import ( - "net/http" - - "github.com/titpetric/factory/resputil" -) - -func (eh *EventHandlers) Edit(w http.ResponseWriter, r *http.Request) { - params := EventEditRequest{}.new() - resputil.JSON(w, params.Fill(r), func() (interface{}, error) { return eh.Event.Edit(r.Context(), params) }) -} -func (eh *EventHandlers) Attach(w http.ResponseWriter, r *http.Request) { - params := EventAttachRequest{}.new() - resputil.JSON(w, params.Fill(r), func() (interface{}, error) { return eh.Event.Attach(r.Context(), params) }) -} -func (eh *EventHandlers) Remove(w http.ResponseWriter, r *http.Request) { - params := EventRemoveRequest{}.new() - resputil.JSON(w, params.Fill(r), func() (interface{}, error) { return eh.Event.Remove(r.Context(), params) }) -} -func (eh *EventHandlers) Read(w http.ResponseWriter, r *http.Request) { - params := EventReadRequest{}.new() - resputil.JSON(w, params.Fill(r), func() (interface{}, error) { return eh.Event.Read(r.Context(), params) }) -} -func (eh *EventHandlers) Search(w http.ResponseWriter, r *http.Request) { - params := EventSearchRequest{}.new() - resputil.JSON(w, params.Fill(r), func() (interface{}, error) { return eh.Event.Search(r.Context(), params) }) -} -func (eh *EventHandlers) Pin(w http.ResponseWriter, r *http.Request) { - params := EventPinRequest{}.new() - resputil.JSON(w, params.Fill(r), func() (interface{}, error) { return eh.Event.Pin(r.Context(), params) }) -} -func (eh *EventHandlers) Flag(w http.ResponseWriter, r *http.Request) { - params := EventFlagRequest{}.new() - resputil.JSON(w, params.Fill(r), func() (interface{}, error) { return eh.Event.Flag(r.Context(), params) }) -} diff --git a/sam/rest/server/event_requests.go b/sam/rest/server/event_requests.go deleted file mode 100644 index d47ee965a..000000000 --- a/sam/rest/server/event_requests.go +++ /dev/null @@ -1,225 +0,0 @@ -package server - -/* - Hello! This file is auto-generated from `docs/src/spec.json`. - - For development: - In order to update the generated files, edit this file under the location, - add your struct fields, imports, API definitions and whatever you want, and: - - 1. run [spec](https://github.com/titpetric/spec) in the same folder, - 2. run `./_gen.php` in this folder. - - You may edit `event.go`, `event.util.go` or `event_test.go` to - implement your API calls, helper functions and tests. The file `event.go` - is only generated the first time, and will not be overwritten if it exists. -*/ - -import ( - "github.com/go-chi/chi" - "net/http" -) - -var _ = chi.URLParam - -// Event edit request parameters -type EventEditRequest struct { - ID uint64 - Channel_id uint64 - Contents string -} - -func (EventEditRequest) new() *EventEditRequest { - return &EventEditRequest{} -} - -func (e *EventEditRequest) Fill(r *http.Request) error { - r.ParseForm() - get := map[string]string{} - post := map[string]string{} - urlQuery := r.URL.Query() - for name, param := range urlQuery { - get[name] = string(param[0]) - } - postVars := r.Form - for name, param := range postVars { - post[name] = string(param[0]) - } - - e.ID = parseUInt64(post["id"]) - - e.Channel_id = parseUInt64(post["channel_id"]) - - e.Contents = post["contents"] - return nil -} - -var _ RequestFiller = EventEditRequest{}.new() - -// Event attach request parameters -type EventAttachRequest struct { -} - -func (EventAttachRequest) new() *EventAttachRequest { - return &EventAttachRequest{} -} - -func (e *EventAttachRequest) Fill(r *http.Request) error { - r.ParseForm() - get := map[string]string{} - post := map[string]string{} - urlQuery := r.URL.Query() - for name, param := range urlQuery { - get[name] = string(param[0]) - } - postVars := r.Form - for name, param := range postVars { - post[name] = string(param[0]) - } - return nil -} - -var _ RequestFiller = EventAttachRequest{}.new() - -// Event remove request parameters -type EventRemoveRequest struct { - ID uint64 -} - -func (EventRemoveRequest) new() *EventRemoveRequest { - return &EventRemoveRequest{} -} - -func (e *EventRemoveRequest) Fill(r *http.Request) error { - r.ParseForm() - get := map[string]string{} - post := map[string]string{} - urlQuery := r.URL.Query() - for name, param := range urlQuery { - get[name] = string(param[0]) - } - postVars := r.Form - for name, param := range postVars { - post[name] = string(param[0]) - } - - e.ID = parseUInt64(get["id"]) - return nil -} - -var _ RequestFiller = EventRemoveRequest{}.new() - -// Event read request parameters -type EventReadRequest struct { - Channel_id uint64 -} - -func (EventReadRequest) new() *EventReadRequest { - return &EventReadRequest{} -} - -func (e *EventReadRequest) Fill(r *http.Request) error { - r.ParseForm() - get := map[string]string{} - post := map[string]string{} - urlQuery := r.URL.Query() - for name, param := range urlQuery { - get[name] = string(param[0]) - } - postVars := r.Form - for name, param := range postVars { - post[name] = string(param[0]) - } - - e.Channel_id = parseUInt64(post["channel_id"]) - return nil -} - -var _ RequestFiller = EventReadRequest{}.new() - -// Event search request parameters -type EventSearchRequest struct { - Query string - Message_type string -} - -func (EventSearchRequest) new() *EventSearchRequest { - return &EventSearchRequest{} -} - -func (e *EventSearchRequest) Fill(r *http.Request) error { - r.ParseForm() - get := map[string]string{} - post := map[string]string{} - urlQuery := r.URL.Query() - for name, param := range urlQuery { - get[name] = string(param[0]) - } - postVars := r.Form - for name, param := range postVars { - post[name] = string(param[0]) - } - - e.Query = get["query"] - - e.Message_type = get["message_type"] - return nil -} - -var _ RequestFiller = EventSearchRequest{}.new() - -// Event pin request parameters -type EventPinRequest struct { - ID uint64 -} - -func (EventPinRequest) new() *EventPinRequest { - return &EventPinRequest{} -} - -func (e *EventPinRequest) Fill(r *http.Request) error { - r.ParseForm() - get := map[string]string{} - post := map[string]string{} - urlQuery := r.URL.Query() - for name, param := range urlQuery { - get[name] = string(param[0]) - } - postVars := r.Form - for name, param := range postVars { - post[name] = string(param[0]) - } - - e.ID = parseUInt64(post["id"]) - return nil -} - -var _ RequestFiller = EventPinRequest{}.new() - -// Event flag request parameters -type EventFlagRequest struct { - ID uint64 -} - -func (EventFlagRequest) new() *EventFlagRequest { - return &EventFlagRequest{} -} - -func (e *EventFlagRequest) Fill(r *http.Request) error { - r.ParseForm() - get := map[string]string{} - post := map[string]string{} - urlQuery := r.URL.Query() - for name, param := range urlQuery { - get[name] = string(param[0]) - } - postVars := r.Form - for name, param := range postVars { - post[name] = string(param[0]) - } - - e.ID = parseUInt64(post["id"]) - return nil -} - -var _ RequestFiller = EventFlagRequest{}.new() diff --git a/sam/rest/team.go b/sam/rest/team.go index 3bc421e69..2942cdc17 100644 --- a/sam/rest/team.go +++ b/sam/rest/team.go @@ -15,13 +15,13 @@ type ( } teamService interface { - FindByID(context.Context, uint64) (*types.Team, error) - Find(context.Context, *types.TeamFilter) ([]*types.Team, error) + FindByID(ctx context.Context, teamID uint64) (*types.Team, error) + Find(ctx context.Context, filter *types.TeamFilter) ([]*types.Team, error) - Create(context.Context, *types.Team) (*types.Team, error) - Update(context.Context, *types.Team) (*types.Team, error) - Merge(ctx context.Context, id, targetTeamId uint64) error - Move(ctx context.Context, id, organisationId uint64) error + Create(ctx context.Context, team *types.Team) (*types.Team, error) + Update(ctx context.Context, team *types.Team) (*types.Team, error) + Merge(ctx context.Context, teamID, targetTeamID uint64) error + Move(ctx context.Context, teamID, organisationID uint64) error deleter archiver diff --git a/sam/rest/user.go b/sam/rest/user.go index edca6d1d9..c6eda1a70 100644 --- a/sam/rest/user.go +++ b/sam/rest/user.go @@ -16,7 +16,7 @@ type ( } userService interface { - Find(context.Context, *types.UserFilter) ([]*types.User, error) + Find(ctx context.Context, filter *types.UserFilter) ([]*types.User, error) } ) diff --git a/sam/service/channel.go b/sam/service/channel.go index 0fec8c073..d979ebfb8 100644 --- a/sam/service/channel.go +++ b/sam/service/channel.go @@ -12,11 +12,11 @@ type ( } channelRepository interface { - FindByID(context.Context, uint64) (*types.Channel, error) - Find(context.Context, *types.ChannelFilter) ([]*types.Channel, error) + FindByID(ctx context.Context, channelID uint64) (*types.Channel, error) + Find(ctx context.Context, filter *types.ChannelFilter) ([]*types.Channel, error) - Create(context.Context, *types.Channel) (*types.Channel, error) - Update(context.Context, *types.Channel) (*types.Channel, error) + Create(ctx context.Context, channel *types.Channel) (*types.Channel, error) + Update(ctx context.Context, channel *types.Channel) (*types.Channel, error) deleter archiver diff --git a/sam/service/message.go b/sam/service/message.go index 49e0b9c72..d2d2858ff 100644 --- a/sam/service/message.go +++ b/sam/service/message.go @@ -16,25 +16,25 @@ type ( } messageRepository interface { - FindByID(context.Context, uint64) (*types.Message, error) - Find(context.Context, *types.MessageFilter) ([]*types.Message, error) + FindByID(ctx context.Context, messageID uint64) (*types.Message, error) + Find(ctx context.Context, filter *types.MessageFilter) ([]*types.Message, error) - Create(context.Context, *types.Message) (*types.Message, error) - Update(context.Context, *types.Message) (*types.Message, error) + Create(ctx context.Context, message *types.Message) (*types.Message, error) + Update(ctx context.Context, message *types.Message) (*types.Message, error) deleter } messageReactionRepository interface { - FindByID(context.Context, uint64) (*types.Reaction, error) - Create(context.Context, *types.Reaction) (*types.Reaction, error) - Delete(context.Context, uint64) error + FindByID(ctx context.Context, reactionID uint64) (*types.Reaction, error) + Create(ctx context.Context, reaction *types.Reaction) (*types.Reaction, error) + Delete(ctx context.Context, reactionID uint64) error } messageAttachmentRepository interface { - FindByID(context.Context, uint64) (*types.Attachment, error) - Create(context.Context, *types.Attachment) (*types.Attachment, error) - Delete(context.Context, uint64) error + FindByID(ctx context.Context, attachmentID uint64) (*types.Attachment, error) + Create(ctx context.Context, attachment *types.Attachment) (*types.Attachment, error) + Delete(ctx context.Context, attachmentID uint64) error } ) diff --git a/sam/service/organisation.go b/sam/service/organisation.go index d8a53df9e..239ea7c9d 100644 --- a/sam/service/organisation.go +++ b/sam/service/organisation.go @@ -12,11 +12,11 @@ type ( } organisationRepository interface { - FindByID(context.Context, uint64) (*types.Organisation, error) - Find(context.Context, *types.OrganisationFilter) ([]*types.Organisation, error) + FindByID(ctx context.Context, organisationID uint64) (*types.Organisation, error) + Find(ctx context.Context, filter *types.OrganisationFilter) ([]*types.Organisation, error) - Create(context.Context, *types.Organisation) (*types.Organisation, error) - Update(context.Context, *types.Organisation) (*types.Organisation, error) + Create(ctx context.Context, organisation *types.Organisation) (*types.Organisation, error) + Update(ctx context.Context, organisation *types.Organisation) (*types.Organisation, error) deleter archiver diff --git a/sam/service/service.go b/sam/service/service.go index 75831b561..7674dfb79 100644 --- a/sam/service/service.go +++ b/sam/service/service.go @@ -6,15 +6,15 @@ import ( type ( suspender interface { - Suspend(context.Context, uint64) error - Unsuspend(context.Context, uint64) error + Suspend(ctx context.Context, ID uint64) error + Unsuspend(ctx context.Context, ID uint64) error } archiver interface { - Archive(context.Context, uint64) error - Unarchive(context.Context, uint64) error + Archive(ctx context.Context, ID uint64) error + Unarchive(ctx context.Context, ID uint64) error } deleter interface { - Delete(context.Context, uint64) error + Delete(ctx context.Context, ID uint64) error } ) diff --git a/sam/service/team.go b/sam/service/team.go index e4998f8f2..9e8f299bf 100644 --- a/sam/service/team.go +++ b/sam/service/team.go @@ -12,14 +12,14 @@ type ( } teamRepository interface { - FindByID(context.Context, uint64) (*types.Team, error) - Find(context.Context, *types.TeamFilter) ([]*types.Team, error) + FindByID(ctx context.Context, teamID uint64) (*types.Team, error) + Find(ctx context.Context, filter *types.TeamFilter) ([]*types.Team, error) - Create(context.Context, *types.Team) (*types.Team, error) - Update(context.Context, *types.Team) (*types.Team, error) + Create(ctx context.Context, team *types.Team) (*types.Team, error) + Update(ctx context.Context, team *types.Team) (*types.Team, error) - Merge(context.Context, uint64, uint64) error - Move(context.Context, uint64, uint64) error + Merge(ctx context.Context, teamID, targetTeamID uint64) error + Move(ctx context.Context, teamID, organisationID uint64) error deleter archiver diff --git a/sam/service/user.go b/sam/service/user.go index 4dab7e506..7151ef710 100644 --- a/sam/service/user.go +++ b/sam/service/user.go @@ -18,12 +18,12 @@ type ( } userRepository interface { - FindByUsername(context.Context, string) (*types.User, error) - FindByID(context.Context, uint64) (*types.User, error) - Find(context.Context, *types.UserFilter) ([]*types.User, error) + FindByUsername(ctx context.Context, username string) (*types.User, error) + FindByID(ctx context.Context, userID uint64) (*types.User, error) + Find(ctx context.Context, filter *types.UserFilter) ([]*types.User, error) - Create(context.Context, *types.User) (*types.User, error) - Update(context.Context, *types.User) (*types.User, error) + Create(ctx context.Context, user *types.User) (*types.User, error) + Update(ctx context.Context, user *types.User) (*types.User, error) deleter suspender diff --git a/sam/websocket/websocket.go b/sam/websocket/websocket.go index 420f57ea2..4d1af76ba 100644 --- a/sam/websocket/websocket.go +++ b/sam/websocket/websocket.go @@ -19,7 +19,7 @@ type ( } wsUserFinder interface { - FindByID(ctx context.Context, userId uint64) (*types.User, error) + FindByID(ctx context.Context, userID uint64) (*types.User, error) } )