3
0

Fix requred fields, create chan members type

This commit is contained in:
Denis Arh
2019-04-27 10:43:19 +02:00
parent 7cbfc705ae
commit eae4643274
5 changed files with 10 additions and 8 deletions
+2 -2
View File
@@ -163,7 +163,7 @@
{
"type": "string",
"name": "name",
"required": true,
"required": false,
"title": "Name of Channel"
},
{
@@ -179,7 +179,7 @@
"title": "Channel type"
},
{
"type": "[]string",
"type": "[]uint64",
"name": "members",
"required": false,
"title": "Initial members of the channel"
+2 -2
View File
@@ -36,7 +36,7 @@
"post": [
{
"name": "name",
"required": true,
"required": false,
"title": "Name of Channel",
"type": "string"
},
@@ -56,7 +56,7 @@
"name": "members",
"required": false,
"title": "Initial members of the channel",
"type": "[]string"
"type": "[]uint64"
}
]
}
+2 -2
View File
@@ -117,10 +117,10 @@ A channel is a representation of a sequence of messages. It has meta data like c
| Parameter | Type | Method | Description | Default | Required? |
| --------- | ---- | ------ | ----------- | ------- | --------- |
| name | string | POST | Name of Channel | N/A | YES |
| name | string | POST | Name of Channel | N/A | NO |
| topic | string | POST | Subject of Channel | N/A | NO |
| type | string | POST | Channel type | N/A | NO |
| members | []string | POST | Initial members of the channel | N/A | NO |
| members | []uint64 | POST | Initial members of the channel | N/A | NO |
## Update channel details
+1 -1
View File
@@ -36,7 +36,7 @@ func (ctrl *Channel) Create(ctx context.Context, r *request.ChannelCreate) (inte
Name: r.Name,
Topic: r.Topic,
Type: types.ChannelType(r.Type),
Members: payload.ParseUInt64s(r.Members),
Members: r.Members,
}
return ctrl.wrap(ctrl.svc.ch.With(ctx).Create(channel))
+3 -1
View File
@@ -81,7 +81,7 @@ type ChannelCreate struct {
Name string
Topic string
Type string
Members []string
Members []uint64 `json:",string"`
}
func NewChannelCreate() *ChannelCreate {
@@ -128,6 +128,8 @@ func (cReq *ChannelCreate) Fill(r *http.Request) (err error) {
cReq.Type = val
}
cReq.Members = parseUInt64A(r.Form["members"])
return err
}