diff --git a/sam/channel.request.go b/sam/channel.request.go index 099b1df9d..07619a555 100644 --- a/sam/channel.request.go +++ b/sam/channel.request.go @@ -33,6 +33,7 @@ func (channelCreateRequest) new() *channelCreateRequest { } func (c *channelCreateRequest) Fill(r *http.Request) error { + r.ParseForm() get := map[string]string{} post := map[string]string{} urlQuery := r.URL.Query() @@ -66,6 +67,7 @@ func (channelEditRequest) new() *channelEditRequest { } func (c *channelEditRequest) Fill(r *http.Request) error { + r.ParseForm() get := map[string]string{} post := map[string]string{} urlQuery := r.URL.Query() @@ -101,6 +103,7 @@ func (channelRemoveRequest) new() *channelRemoveRequest { } func (c *channelRemoveRequest) Fill(r *http.Request) error { + r.ParseForm() get := map[string]string{} post := map[string]string{} urlQuery := r.URL.Query() @@ -128,6 +131,7 @@ func (channelReadRequest) new() *channelReadRequest { } func (c *channelReadRequest) Fill(r *http.Request) error { + r.ParseForm() get := map[string]string{} post := map[string]string{} urlQuery := r.URL.Query() @@ -155,6 +159,7 @@ func (channelSearchRequest) new() *channelSearchRequest { } func (c *channelSearchRequest) Fill(r *http.Request) error { + r.ParseForm() get := map[string]string{} post := map[string]string{} urlQuery := r.URL.Query() diff --git a/sam/channel.structs.go b/sam/channel.structs.go index c8a08b252..20165689d 100644 --- a/sam/channel.structs.go +++ b/sam/channel.structs.go @@ -23,13 +23,13 @@ import ( type ( // Channels Channel struct { - ID uint64 - Name string - Topic string - Meta json.RawMessage - LastMessageId uint64 `json:",omitempty" db:"rel_last_message"` - ArchivedAt *time.Time `json:",omitempty" db:"archived_at"` - DeletedAt *time.Time `json:",omitempty" db:"deleted_at"` + ID uint64 `db:"id"` + Name string `db:"name"` + Topic string `db:"-"` + Meta json.RawMessage `db:"meta"` + LastMessageId uint64 `json:",omitempty" db:"rel_last_message"` + ArchivedAt *time.Time `json:",omitempty" db:"archived_at"` + DeletedAt *time.Time `json:",omitempty" db:"deleted_at"` changed []string } diff --git a/sam/docs/src/spec.json b/sam/docs/src/spec.json index 362b9dc19..e4e8ceab8 100644 --- a/sam/docs/src/spec.json +++ b/sam/docs/src/spec.json @@ -184,11 +184,11 @@ "fields": [ { "type": "uint64", "name": "ID" }, { "type": "string", "name": "Name" }, - { "type": "string", "name": "Topic" }, + { "type": "string", "name": "Topic", "dbname": "-" }, { "type": "json.RawMessage", "name": "Meta", "complex": true}, { "type": "uint64", "name": "LastMessageId", "tag": "json:\",omitempty\"", "dbname": "rel_last_message" }, - { "type": "*time.Time", "name": "ArchivedAt", "tag": "json:\",omitempty\" db:\"archived_at\"", "complex": true }, - { "type": "*time.Time", "name": "DeletedAt", "tag": "json:\",omitempty\" db:\"deleted_at\"", "complex": true } + { "type": "*time.Time", "name": "ArchivedAt", "tag": "json:\",omitempty\"", "complex": true }, + { "type": "*time.Time", "name": "DeletedAt", "tag": "json:\",omitempty\"", "complex": true } ] } ], @@ -200,7 +200,7 @@ "parameters": { "post": [ { "type": "string", "name": "name", "required": true, "title": "Name of Channel" }, - { "type": "string", "name": "topic", "required": true, "title": "Subject of Channel" } + { "type": "string", "name": "topic", "required": false, "title": "Subject of Channel" } ] } }, @@ -210,9 +210,9 @@ "title": "Update channel details", "parameters": { "post": [ - { "type": "uint64", "name": "id", "required": false, "title": "Channel ID" }, - { "type": "string", "name": "name", "required": true, "title": "Name of Channel" }, - { "type": "string", "name": "topic", "required": true, "title": "Subject of Channel" }, + { "type": "uint64", "name": "id", "required": true, "title": "Channel ID" }, + { "type": "string", "name": "name", "required": false, "title": "Name of Channel" }, + { "type": "string", "name": "topic", "required": false, "title": "Subject of Channel" }, { "type": "bool", "name": "archive", "required": false, "title": "Request channel to be archived or unarchived" }, { "type": "uint64", "name": "organisationId", "required": false, "title": "Move channel to different organisation" } ] diff --git a/sam/docs/src/spec/channel.json b/sam/docs/src/spec/channel.json index faac80310..bae327f8c 100644 --- a/sam/docs/src/spec/channel.json +++ b/sam/docs/src/spec/channel.json @@ -15,6 +15,7 @@ "type": "string" }, { + "dbname": "-", "name": "Topic", "type": "string" }, @@ -32,13 +33,13 @@ { "complex": true, "name": "ArchivedAt", - "tag": "json:\",omitempty\" db:\"archived_at\"", + "tag": "json:\",omitempty\"", "type": "*time.Time" }, { "complex": true, "name": "DeletedAt", - "tag": "json:\",omitempty\" db:\"deleted_at\"", + "tag": "json:\",omitempty\"", "type": "*time.Time" } ], @@ -71,7 +72,7 @@ }, { "name": "topic", - "required": true, + "required": false, "title": "Subject of Channel", "type": "string" } @@ -87,19 +88,19 @@ "post": [ { "name": "id", - "required": false, + "required": true, "title": "Channel ID", "type": "uint64" }, { "name": "name", - "required": true, + "required": false, "title": "Name of Channel", "type": "string" }, { "name": "topic", - "required": true, + "required": false, "title": "Subject of Channel", "type": "string" }, diff --git a/sam/message.request.go b/sam/message.request.go index 2055e0cb9..14dd1443c 100644 --- a/sam/message.request.go +++ b/sam/message.request.go @@ -34,6 +34,7 @@ func (messageEditRequest) new() *messageEditRequest { } func (m *messageEditRequest) Fill(r *http.Request) error { + r.ParseForm() get := map[string]string{} post := map[string]string{} urlQuery := r.URL.Query() @@ -64,6 +65,7 @@ func (messageAttachRequest) new() *messageAttachRequest { } func (m *messageAttachRequest) Fill(r *http.Request) error { + r.ParseForm() get := map[string]string{} post := map[string]string{} urlQuery := r.URL.Query() @@ -89,6 +91,7 @@ func (messageRemoveRequest) new() *messageRemoveRequest { } func (m *messageRemoveRequest) Fill(r *http.Request) error { + r.ParseForm() get := map[string]string{} post := map[string]string{} urlQuery := r.URL.Query() @@ -116,6 +119,7 @@ func (messageReadRequest) new() *messageReadRequest { } func (m *messageReadRequest) Fill(r *http.Request) error { + r.ParseForm() get := map[string]string{} post := map[string]string{} urlQuery := r.URL.Query() @@ -144,6 +148,7 @@ func (messageSearchRequest) new() *messageSearchRequest { } func (m *messageSearchRequest) Fill(r *http.Request) error { + r.ParseForm() get := map[string]string{} post := map[string]string{} urlQuery := r.URL.Query() @@ -173,6 +178,7 @@ func (messagePinRequest) new() *messagePinRequest { } func (m *messagePinRequest) Fill(r *http.Request) error { + r.ParseForm() get := map[string]string{} post := map[string]string{} urlQuery := r.URL.Query() @@ -200,6 +206,7 @@ func (messageFlagRequest) new() *messageFlagRequest { } func (m *messageFlagRequest) Fill(r *http.Request) error { + r.ParseForm() get := map[string]string{} post := map[string]string{} urlQuery := r.URL.Query() diff --git a/sam/message.structs.go b/sam/message.structs.go index f1a4a10cb..f77f2ff7d 100644 --- a/sam/message.structs.go +++ b/sam/message.structs.go @@ -18,15 +18,15 @@ package sam type ( // Messages Message struct { - Service string - Channel string - UserName string - UserID uint64 - User *User - UserAvatar string - Message string - MessageID string - Type MessageType + Service string `db:"service"` + Channel string `db:"channel"` + UserName string `db:"user_name"` + UserID uint64 `db:"user_id"` + User *User `db:"user"` + UserAvatar string `db:"user_avatar"` + Message string `db:"message"` + MessageID string `db:"message_id"` + Type MessageType `db:"type"` changed []string } diff --git a/sam/organisation.request.go b/sam/organisation.request.go index 228cbf9cd..6e17dfe3b 100644 --- a/sam/organisation.request.go +++ b/sam/organisation.request.go @@ -33,6 +33,7 @@ func (organisationEditRequest) new() *organisationEditRequest { } func (o *organisationEditRequest) Fill(r *http.Request) error { + r.ParseForm() get := map[string]string{} post := map[string]string{} urlQuery := r.URL.Query() @@ -62,6 +63,7 @@ func (organisationRemoveRequest) new() *organisationRemoveRequest { } func (o *organisationRemoveRequest) Fill(r *http.Request) error { + r.ParseForm() get := map[string]string{} post := map[string]string{} urlQuery := r.URL.Query() @@ -89,6 +91,7 @@ func (organisationReadRequest) new() *organisationReadRequest { } func (o *organisationReadRequest) Fill(r *http.Request) error { + r.ParseForm() get := map[string]string{} post := map[string]string{} urlQuery := r.URL.Query() @@ -116,6 +119,7 @@ func (organisationSearchRequest) new() *organisationSearchRequest { } func (o *organisationSearchRequest) Fill(r *http.Request) error { + r.ParseForm() get := map[string]string{} post := map[string]string{} urlQuery := r.URL.Query() @@ -143,6 +147,7 @@ func (organisationArchiveRequest) new() *organisationArchiveRequest { } func (o *organisationArchiveRequest) Fill(r *http.Request) error { + r.ParseForm() get := map[string]string{} post := map[string]string{} urlQuery := r.URL.Query() diff --git a/sam/organisation.structs.go b/sam/organisation.structs.go index fd63627cf..067928aab 100644 --- a/sam/organisation.structs.go +++ b/sam/organisation.structs.go @@ -22,10 +22,10 @@ import ( type ( // Organisations Organisation struct { - ID uint64 - Name string - ArchivedAt *time.Time `json:",omitempty"` - DeletedAt *time.Time `json:",omitempty"` + ID uint64 `db:"id"` + Name string `db:"name"` + ArchivedAt *time.Time `json:",omitempty" db:"archived_at"` + DeletedAt *time.Time `json:",omitempty" db:"deleted_at"` changed []string } diff --git a/sam/team.request.go b/sam/team.request.go index 732b0b5c8..9ac41188e 100644 --- a/sam/team.request.go +++ b/sam/team.request.go @@ -34,6 +34,7 @@ func (teamEditRequest) new() *teamEditRequest { } func (t *teamEditRequest) Fill(r *http.Request) error { + r.ParseForm() get := map[string]string{} post := map[string]string{} urlQuery := r.URL.Query() @@ -63,6 +64,7 @@ func (teamRemoveRequest) new() *teamRemoveRequest { } func (t *teamRemoveRequest) Fill(r *http.Request) error { + r.ParseForm() get := map[string]string{} post := map[string]string{} urlQuery := r.URL.Query() @@ -90,6 +92,7 @@ func (teamReadRequest) new() *teamReadRequest { } func (t *teamReadRequest) Fill(r *http.Request) error { + r.ParseForm() get := map[string]string{} post := map[string]string{} urlQuery := r.URL.Query() @@ -117,6 +120,7 @@ func (teamSearchRequest) new() *teamSearchRequest { } func (t *teamSearchRequest) Fill(r *http.Request) error { + r.ParseForm() get := map[string]string{} post := map[string]string{} urlQuery := r.URL.Query() @@ -144,6 +148,7 @@ func (teamArchiveRequest) new() *teamArchiveRequest { } func (t *teamArchiveRequest) Fill(r *http.Request) error { + r.ParseForm() get := map[string]string{} post := map[string]string{} urlQuery := r.URL.Query() @@ -172,6 +177,7 @@ func (teamMoveRequest) new() *teamMoveRequest { } func (t *teamMoveRequest) Fill(r *http.Request) error { + r.ParseForm() get := map[string]string{} post := map[string]string{} urlQuery := r.URL.Query() @@ -202,6 +208,7 @@ func (teamMergeRequest) new() *teamMergeRequest { } func (t *teamMergeRequest) Fill(r *http.Request) error { + r.ParseForm() get := map[string]string{} post := map[string]string{} urlQuery := r.URL.Query() diff --git a/sam/team.structs.go b/sam/team.structs.go index cff87cf7a..9722e1efc 100644 --- a/sam/team.structs.go +++ b/sam/team.structs.go @@ -22,12 +22,12 @@ import ( type ( // Teams Team struct { - ID uint64 - Name string - MemberIDs []uint64 `json:"-"` - Members []User `json:",omitempty"` - ArchivedAt *time.Time `json:",omitempty"` - DeletedAt *time.Time `json:",omitempty"` + ID uint64 `db:"id"` + Name string `db:"name"` + MemberIDs []uint64 `json:"-" db:"member_i_ds"` + Members []User `json:",omitempty" db:"members"` + ArchivedAt *time.Time `json:",omitempty" db:"archived_at"` + DeletedAt *time.Time `json:",omitempty" db:"deleted_at"` changed []string } diff --git a/sam/user.request.go b/sam/user.request.go index f81c62d24..137d32100 100644 --- a/sam/user.request.go +++ b/sam/user.request.go @@ -33,6 +33,7 @@ func (userLoginRequest) new() *userLoginRequest { } func (u *userLoginRequest) Fill(r *http.Request) error { + r.ParseForm() get := map[string]string{} post := map[string]string{} urlQuery := r.URL.Query() @@ -62,6 +63,7 @@ func (userSearchRequest) new() *userSearchRequest { } func (u *userSearchRequest) Fill(r *http.Request) error { + r.ParseForm() get := map[string]string{} post := map[string]string{} urlQuery := r.URL.Query() diff --git a/sam/user.structs.go b/sam/user.structs.go index 3f8978c4c..31846270e 100644 --- a/sam/user.structs.go +++ b/sam/user.structs.go @@ -22,11 +22,11 @@ import ( type ( // Users User struct { - ID uint64 - Username string - Password []byte `json:"-"` - SuspendedAt *time.Time `json:",omitempty"` - DeletedAt *time.Time `json:",omitempty"` + ID uint64 `db:"id"` + Username string `db:"username"` + Password []byte `json:"-" db:"password"` + SuspendedAt *time.Time `json:",omitempty" db:"suspended_at"` + DeletedAt *time.Time `json:",omitempty" db:"deleted_at"` changed []string } diff --git a/sam/websocket.request.go b/sam/websocket.request.go index ea8dd4737..55e7dab01 100644 --- a/sam/websocket.request.go +++ b/sam/websocket.request.go @@ -31,6 +31,7 @@ func (websocketClientRequest) new() *websocketClientRequest { } func (w *websocketClientRequest) Fill(r *http.Request) error { + r.ParseForm() get := map[string]string{} post := map[string]string{} urlQuery := r.URL.Query() diff --git a/sam/websocket.structs.go b/sam/websocket.structs.go index 82657c870..80d175ca8 100644 --- a/sam/websocket.structs.go +++ b/sam/websocket.structs.go @@ -18,8 +18,8 @@ package sam type ( // Websocket Websocket struct { - UserID uint64 - User User + UserID uint64 `db:"user_id"` + User User `db:"user"` changed []string }