Fix naming (Id -> ID), add names to interface arguments
This commit is contained in:
parent
d886a98740
commit
52dbc4c0c3
@ -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
|
||||
|
||||
@ -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
|
||||
}
|
||||
@ -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)
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -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)
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@ -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)
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@ -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)
|
||||
}
|
||||
@ -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) })
|
||||
}
|
||||
@ -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()
|
||||
@ -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
|
||||
|
||||
@ -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)
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
}
|
||||
)
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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)
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user