Browse Source

Changed channels graphql query to use filter, added eventName and locationName filters

1.0
Gisle Aune 6 years ago
parent
commit
d8871259a1
  1. 17
      graphql/resolver/queries/channels.go
  2. 8
      graphql/schema/bindata.go
  3. 4
      graphql/schema/root.graphql
  4. 12
      graphql/schema/types/channel.graphql
  5. 15
      model/channel/channel.go

17
graphql/resolver/queries/channels.go

@ -9,15 +9,30 @@ import (
// ChannelsArgs is args for channel query // ChannelsArgs is args for channel query
type ChannelsArgs struct { type ChannelsArgs struct {
Filter *struct {
Logged *bool Logged *bool
EventName *string
LocationName *string
}
} }
// Channels resolves the channels query // Channels resolves the channels query
func (r *QueryResolver) Channels(ctx context.Context, args *ChannelsArgs) ([]*types.ChannelResolver, error) { func (r *QueryResolver) Channels(ctx context.Context, args *ChannelsArgs) ([]*types.ChannelResolver, error) {
channels, err := channel.List(args.Logged != nil && *args.Logged)
var channels []channel.Channel
var err error
filter := args.Filter
if filter != nil {
channels, err = channel.List(filter.Logged, filter.EventName, filter.LocationName)
if err != nil {
return nil, err
}
} else {
channels, err = channel.List(nil, nil, nil)
if err != nil { if err != nil {
return nil, err return nil, err
} }
}
resolvers := make([]*types.ChannelResolver, len(channels)) resolvers := make([]*types.ChannelResolver, len(channels))
for i := range channels { for i := range channels {

8
graphql/schema/bindata.go

@ -79,7 +79,7 @@ func (fi bindataFileInfo) Sys() interface{} {
return nil return nil
} }
var _rootGraphql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x9c\x57\xc1\x6e\xe3\x38\x0f\xbe\xfb\x29\x18\xcc\x61\x32\x40\x91\x07\xc8\xad\x7f\x67\x8a\x3f\x40\xba\xdb\xdd\x74\x4f\xc5\x00\xa3\xda\x8c\x4d\x54\x91\xbc\xa2\xdc\x20\x18\xcc\xbb\x2f\x28\xc9\xb6\xec\x3a\x5d\x60\x6f\xa6\x4c\x7e\xfc\x48\xd1\x1f\x93\x4f\xf0\xd4\x20\xfc\xd1\xa1\xbb\x80\xbf\xb4\x08\x0e\x5b\x87\x8c\xc6\x33\xf8\x46\x4c\x55\x01\x1a\xef\x2e\xd0\x5a\x92\x53\x32\xde\x86\x57\xb7\x8f\xbb\x4d\x11\x62\x62\xf8\xcf\x02\xe0\x13\xdc\x93\xa9\xa0\x6c\x94\x53\xa5\x47\x07\x2f\x17\x40\xf2\x0d\x3a\x50\x06\x76\x5f\xc1\x3a\x50\x60\xa8\x7c\xdd\x14\x30\xba\xad\xa9\xda\xc2\xc1\x3b\x32\xf5\x4d\x78\xdb\x5b\x5f\xb6\x70\xd7\x3b\x15\x0b\xf8\x9c\x27\x00\x4d\xec\xc1\x1e\x81\x2a\x8e\x30\x1c\xf2\x19\x50\x9d\x6f\xac\xdb\xc0\xef\x46\x5f\xc0\x1a\x84\x56\x39\x75\x42\x21\xa8\x3c\x28\xf0\x74\xc2\x9c\x0f\xaf\xa9\xe2\x2d\x3c\x47\x12\xab\xef\x09\x6d\x72\x12\x31\x33\xa2\xcf\x03\xd3\xd5\xf7\x55\x01\x30\xe5\x6b\x0c\x6a\x21\x6b\x54\x9f\x4a\x4e\xd6\x62\xf6\x18\xab\x58\xad\x9c\x67\xb1\x4a\xeb\xde\x9b\x37\x70\x68\xb1\xa4\xe3\x85\x4c\x0d\x3f\xb4\xad\x6b\xac\xb6\xe0\x5d\x87\x3f\xc0\x21\x7b\x47\x65\xba\x37\x46\xe5\xca\x06\xbc\x05\x2b\x35\x47\xd7\xcd\x98\x98\xd7\x7d\xf4\xff\xac\xd5\xa8\x4c\x2a\x40\xde\xad\xbe\xaf\x00\xa6\x05\x68\x5b\x0b\xf9\xdd\xd7\x02\xe4\x39\xbb\x2f\x21\xbd\xb7\xf5\xd4\x97\xa3\x1b\xaf\x8f\xa4\x3d\xba\xe0\xc1\xf7\xe1\x59\xf2\xec\x6d\xfd\x7f\x54\x55\x6c\x54\x16\xd9\x5a\xf6\x31\x8d\x30\x15\x6b\x96\xe8\xd1\xb2\x9f\xf9\x73\x0c\xe0\x0d\xec\xfc\x67\x86\x13\x2a\xe3\xa5\x6c\xa5\xb5\x3d\x83\x0d\x93\xd1\x2a\xe7\x59\x06\x43\x3a\xf3\xd7\x4e\x5e\x6b\x32\xaf\xc1\x0d\x4a\xdd\xb1\x0c\x82\x3d\x46\xbc\x1b\xc0\x4d\xbd\x81\x63\x98\x54\x67\xed\x09\x2a\xe4\xd2\x51\xeb\xc9\x9a\x70\xec\x1b\x0c\x1c\x1e\x54\xdb\x02\x37\xb6\xd3\x15\x90\x07\x7c\x93\x79\xc7\xd2\x9e\x50\x46\xaa\x21\x53\x6f\xe0\xa9\x21\x86\xca\x22\x83\xb1\x1e\x1a\xf5\x26\xef\x62\x57\x6e\x80\xc9\x94\x08\x34\xe1\xfd\x82\xf0\x77\x87\x8e\xb0\x02\x32\x81\xb0\x34\xf2\xb3\x5c\x6f\x6b\x0d\xe3\x67\x06\x46\x8d\x65\x60\xc3\xe8\xfb\x4e\xcd\x47\x56\xda\xf5\x2c\xfd\x9a\xf5\xf8\x48\x1a\x87\xab\x14\x63\xd6\xe2\x7b\xd2\xd8\xbb\x6b\x64\xa8\xd1\x87\x11\x54\x6f\x8a\xb4\x7a\xd1\x18\x82\xa4\xdd\x47\x20\x53\xea\xae\xc2\xc7\xee\x45\x53\x09\x24\xcc\xfc\x8d\xb4\xe2\x4c\x5a\x83\x43\xdf\x39\x03\x6d\x7c\x1b\xa2\x40\x31\x9c\x51\xeb\x94\x7a\x9c\x8f\x90\x6b\x1c\x10\x31\x67\xbc\xd9\x5b\x77\x19\x88\x07\x6b\xc6\xfc\x20\x67\xb3\x08\x42\x4e\xde\x94\x65\x3b\x44\x7b\xcc\x17\x42\x17\x13\x96\x8d\x6a\x93\x8e\x85\xc4\xc9\x9e\xa5\xbe\x8b\xa7\xc5\xec\xb3\xad\x88\x3d\x99\xd2\x83\x57\x35\x43\xc7\xf1\x4e\x47\x5e\x72\xbc\x85\xe7\x27\x55\xcf\x72\x97\x9d\x73\x68\x3c\x30\x32\x93\x35\x52\x42\x7c\xda\xc2\x21\x3e\xac\x8a\x5f\x45\x11\xc5\xfb\xa1\xf3\x2a\x4c\xc3\x5c\xbf\xcf\x8e\x3c\xfe\xab\x78\x0f\xe1\x51\xbf\x6f\xab\x4a\x14\x1a\xcf\xa3\x1a\x16\x00\xaa\xaa\xee\x46\xb1\x36\x6d\xe7\x33\x61\xbe\xad\xaa\x9d\x1c\xad\x72\xb5\x5e\x15\x03\x9c\x68\xa7\x8c\xf6\x35\xc0\xdf\xa8\x7c\x7d\x07\x2a\x87\x4b\xa8\x41\x99\x3e\xc1\x9f\x78\xb2\x6f\x18\xa1\x8f\xce\x9e\x26\xe0\x2e\xbc\xfc\x6f\xf8\x01\xfd\x5b\x45\x7e\x82\x88\x15\xf9\xeb\x0d\x10\xf7\xab\x58\x89\xa9\xfa\x88\xe1\xfb\x71\x1a\x20\xb2\x4b\x49\xd2\x3d\x74\x2f\x2c\x90\x91\x8b\x98\xb3\xab\x08\x6a\x9e\x95\x94\x63\xa4\x92\x16\x40\xe6\xe5\x64\x28\x79\x31\x09\x67\x28\xe5\xa3\x7d\x36\x2d\x44\xa6\x4b\xdb\x3a\x16\xb2\x97\x75\x12\xf3\xef\x6d\x9d\x17\xb0\xb7\xf5\x94\x7c\x8c\x11\xe2\xd3\xa0\x09\xe1\x31\x6a\x20\x1b\xe3\x22\xd1\xfd\xd2\xf6\x9a\xd2\x13\x39\x8d\xdc\x1e\xc3\x0a\x8a\x79\x6e\xa3\x39\xe4\x09\xda\x3a\xa1\x97\xe2\x84\x5f\x1e\xf8\x2d\xd9\x4b\x91\x0f\x91\x60\x8a\x14\x7e\x79\xe4\x43\xb2\x97\x22\x87\xe2\x52\x6c\xac\xee\x71\x79\x67\xf6\xf5\x25\xa2\xa2\xbd\x89\xe8\x7d\xd8\x00\x23\x51\xb1\x87\x74\x41\x86\x67\xe9\x52\x6c\x4c\x77\xbf\xbc\x3f\xa6\xed\x0c\x42\x1a\xfb\x79\x88\xb2\x1d\xd3\x05\x23\xbf\xef\xa8\xc2\xfd\x17\x9e\x05\x8b\x50\x66\x00\x4f\xaa\x9e\x60\x3c\xa9\xfa\x3a\xcc\x40\x3c\x47\x8a\xec\xaf\x81\xc5\x90\x2b\x78\xa9\x85\x7d\x51\xd2\xc3\xf7\x55\x4d\x06\xf2\x23\x3e\x53\x2e\x4b\x0b\xed\x9d\x04\x84\x75\x14\x7e\xb9\x64\x8d\xbd\xeb\xd7\xd2\xf0\x21\xb7\xef\x85\xb9\x9d\x09\xdc\x00\x37\xaa\xc1\x02\xc8\x5c\x0d\xda\x65\x69\x6b\x67\xc2\x76\x7d\x4b\xf6\x15\xed\x6d\x0d\x64\xe2\x2f\x45\x32\xeb\x8e\xd1\x4d\xd4\xe3\x06\x5a\xc5\x7c\xb6\x6e\xda\x94\x7e\xff\xa5\x7e\x0a\x8a\xed\x7c\x84\xb1\x9d\x5f\x7f\x99\xee\x48\x2e\x1b\x3c\x29\xf8\x29\xde\xf2\xc3\xea\xb2\x8d\x7f\x57\xe4\x73\x4b\x9b\x6f\x3b\xec\xc0\xe2\xd7\x3f\x01\x00\x00\xff\xff\x36\x14\x75\x84\x10\x0d\x00\x00")
var _rootGraphql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x9c\x57\xc1\x6e\xe3\x36\x10\xbd\xeb\x2b\xc6\xc8\x21\x5e\x20\xf0\x07\xf8\x16\x64\x37\xa8\x01\xa7\x75\x6b\xf7\x14\xe4\xc0\x48\x63\x89\x08\x4d\xaa\x1c\x2a\x86\xb1\xd8\x7f\x2f\x86\xa4\x24\x52\x96\x53\xa0\x37\x0f\xc9\xf7\xe6\xcd\x90\x7e\x63\xdf\xc1\xa1\x41\xf8\xb3\x43\x7b\x01\x77\x69\x11\x2c\xb6\x16\x09\xb5\x23\x70\x0d\x87\xa2\x02\xd4\xce\x5e\xa0\x35\x92\x57\xa5\x76\xc6\x6f\x3d\xee\x36\xab\xc2\x63\x02\xfc\x67\x01\x70\x07\xcf\x52\x57\x50\x36\xc2\x8a\xd2\xa1\x85\xf7\x0b\xa0\x74\x0d\x5a\x10\x1a\x36\xdf\xc1\x58\x10\xa0\x65\xf9\xb1\x2a\x60\x3c\xb6\x94\xd5\x1a\xf6\xce\x4a\x5d\x3f\xf8\xdd\x3e\xfa\xb6\x86\xa7\xfe\x50\x31\xc3\x4f\x69\x02\x50\x92\x1c\x98\x23\xc8\x8a\x02\x0d\xf9\x7c\x1a\x44\xe7\x1a\x63\x57\xf0\x87\x56\x17\x30\x1a\xa1\x15\x56\x9c\x90\x05\x0a\x07\x02\x9c\x3c\x61\xaa\x87\x96\xb2\xa2\x35\xbc\x06\x11\x8b\xb7\xc8\x96\xad\x04\xce\x44\xe8\xeb\xa0\x74\xf1\xb6\x28\x00\x72\xbd\x5a\xa3\x62\xb1\x5a\xf4\xa9\x78\x65\xc9\x61\xcf\xb1\x08\xd5\xf2\xfa\x35\x96\x46\x10\x2d\x8f\x52\x39\xb4\xc3\x69\x7a\xf6\x71\xd4\xc0\x2b\x8b\xb7\x05\x40\xae\x41\x99\x9a\xf3\x6f\xbe\x17\xc0\x9f\x93\x96\x73\xde\xad\xa9\xf3\xb3\x14\x8e\x8d\xb9\xb6\xa6\x4e\xf2\x6c\x4d\xfd\x1b\x8a\x2a\xd4\x9a\x20\x5b\x43\x2e\xa4\xe1\x0b\xe6\x68\x92\x68\x67\xc8\x4d\xce\x53\x00\xd0\x0a\x36\xee\x9e\xe0\x84\x42\x3b\x70\x06\x84\x52\xe6\x0c\xc6\x5f\x6e\x2b\xac\x23\xbe\x5b\x7e\x79\x7f\x6f\x78\x5b\x49\xfd\xe1\x8f\x41\xa9\x3a\xe2\xbb\x34\xc7\xc0\xf7\x00\xb8\xaa\x57\x70\xf4\x8f\xcd\x1a\x73\x82\x0a\xa9\xb4\xb2\x75\xd2\x68\xbf\xec\x1a\xf4\x1a\x5e\x44\xdb\x02\x35\xa6\x53\x15\x48\x07\xf8\xc9\x4f\x16\x4b\x73\x42\x7e\x15\x8d\xd4\xf5\x0a\x0e\x8d\x24\xa8\x0c\x12\x68\xe3\xa0\x11\x9f\xbc\x17\xba\xf2\x00\x24\x75\x89\x20\x33\xdd\xef\x08\xff\x74\x68\x25\x56\x20\xb5\x17\xcc\x8d\xbc\x07\x8b\xd4\x1a\x4d\x78\x4f\x40\xa8\xb0\xf4\x6a\x08\x5d\xdf\xa9\xe9\xab\xe3\x76\xbd\x72\xbf\x26\x3d\x3e\x4a\x85\xc3\x55\x72\x30\x69\xf1\xb3\x54\xd8\x1f\x57\x48\x50\xa3\xe3\x5e\x82\xf8\x14\x52\x89\x77\x85\x1e\xc4\xed\x3e\x82\xd4\xa5\xea\x2a\xdc\x75\xef\x4a\x96\x20\x59\x99\x7b\xe0\x56\x9c\xa5\x52\x60\xd1\x75\x56\x43\x1b\x76\x3d\x0a\x04\xc1\x19\x95\x8a\xa9\xc7\xf7\xe1\x73\x8d\x0f\x84\xc3\x89\x6e\x72\xc6\x5e\x06\xe1\x3e\x9a\x28\xdf\xf3\xda\x04\x21\x91\xe2\x69\x99\x64\xdb\x87\x78\xcc\xe7\xa1\xb3\x09\xcb\x46\xb4\xd1\x8a\x7c\xe2\x18\x4f\x52\x3f\x85\xd5\x14\xce\x3d\xab\x24\x39\xa9\x4b\x07\x4e\xd4\x04\x1d\x85\x3b\x1d\x75\xf1\xf2\x1a\x5e\x0f\xa2\x9e\xe4\x2e\x3b\x6b\x51\x3b\x20\x24\x92\x46\x73\x09\xe1\xd3\x1a\xf6\xe1\xc3\xa2\xf8\x55\x14\xc1\x7f\x5f\x3a\x27\xfc\x6b\x98\x5a\xf0\xd9\x4a\x87\xff\xe9\xbf\x03\x3c\x58\xf0\x63\x55\xb1\xc9\xe2\x79\x34\xb4\x02\x40\x54\xd5\xd3\xe8\xb7\xba\xed\x5c\xe2\xad\x8f\x55\xb5\xe1\xa5\x45\x6a\xb8\x8b\x62\xa0\x63\xfb\xe3\xa7\x7d\x8b\xf0\x77\x59\x7e\x5c\x91\xf2\xe2\x1c\xab\x77\xa6\x3b\xf8\x0b\x4f\xe6\x13\x03\xf5\xd1\x9a\x53\x46\x6e\xfd\xe6\xff\xe3\xf7\xec\x3f\x2a\xe9\x32\x46\xac\xa4\xbb\xdd\x00\x3e\x7e\x93\x2b\x2a\x15\x5f\x29\xbc\x7e\x4e\x03\x45\x72\x29\xd1\xc1\x87\xee\xf9\x19\x30\x6a\xe1\x70\x72\x15\xde\xcd\x93\x92\x52\x8e\x58\xd2\x0c\xc9\xb4\x9c\x84\x25\x2d\x26\xf2\x0c\xa5\x7c\x35\x92\xf2\x42\xf8\x75\x29\x53\x87\x42\xb6\x3c\x4e\x42\xfe\xad\xa9\xd3\x02\xb6\xa6\xce\xc5\x07\x0c\x0b\xcf\x41\x99\xe0\x11\x35\x88\x0d\xb8\x20\x74\x3b\x37\xbd\x72\x79\x6c\xa7\x41\xdb\xce\x8f\xa0\x90\xe7\x31\x84\x43\x1e\xef\xad\x99\xbc\x88\x63\x7d\x29\xf0\x47\x8c\xe7\x90\x2f\x41\x60\x44\xb2\xbe\x14\xf9\x12\xe3\x39\xe4\x50\x5c\xc4\x86\xea\x76\xf3\x33\xb3\xaf\x2f\x0a\x65\xef\x8d\x42\x9f\xfd\x04\x18\x85\x72\x3c\xa4\xf3\x36\x3c\x49\x17\xb1\x21\xdd\xf3\xfc\xfc\xc8\xdb\xe9\x8d\x34\xf4\x73\x1f\x6c\x3b\xa4\xf3\x41\x7a\xdf\xc1\x85\xfb\x6f\x78\x02\x66\xa3\x4c\x08\x0e\xa2\xce\x38\x0e\xa2\xbe\x4d\x33\x08\x4f\x99\x82\xfa\x5b\x64\x01\x72\x83\x2f\xb6\xb0\x2f\x8a\x7b\x78\x5d\x55\xf6\x20\xbf\xd2\x93\x6b\x99\x1b\x68\x57\x16\xe0\xc7\x91\xff\xe5\x92\x34\xf6\xa9\x1f\x4b\xc3\x17\xb9\xbd\x36\xe6\x76\x62\x70\x03\xdd\xe8\x06\x33\x24\x53\x37\x68\xe7\xad\xad\x9d\x18\xdb\xed\x29\xd9\x57\xb4\x35\x35\x48\x1d\x7e\x29\x4a\xbd\xec\x08\x6d\xe6\x1e\x0f\xd0\x0a\xa2\xb3\xb1\x79\x53\xfa\xf9\x17\xfb\xc9\x2c\xa6\x73\x81\xc6\x74\x6e\xf9\x2d\x9f\x91\x54\x36\x78\x12\xf0\x93\x4f\xf3\x0f\xab\xcb\x3a\xfc\xe3\xe0\xaf\x5b\x9c\x7c\xeb\x61\x06\x16\xbf\xfe\x0d\x00\x00\xff\xff\x1e\x5d\x4a\x27\xd3\x0c\x00\x00")
func rootGraphqlBytes() ([]byte, error) { func rootGraphqlBytes() ([]byte, error) {
return bindataRead( return bindataRead(
@ -94,7 +94,7 @@ func rootGraphql() (*asset, error) {
return nil, err return nil, err
} }
info := bindataFileInfo{name: "root.graphql", size: 3344, mode: os.FileMode(420), modTime: time.Unix(1531661626, 0)}
info := bindataFileInfo{name: "root.graphql", size: 3283, mode: os.FileMode(420), modTime: time.Unix(1531666451, 0)}
a := &asset{bytes: bytes, info: info} a := &asset{bytes: bytes, info: info}
return a, nil return a, nil
} }
@ -119,7 +119,7 @@ func typesChangeGraphql() (*asset, error) {
return a, nil return a, nil
} }
var _typesChannelGraphql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x90\x31\x4b\xc4\x40\x10\x85\xfb\xfd\x15\x4f\xae\xb0\xf1\x17\x5c\xa7\x87\x45\x1a\x0b\x15\x6c\x6f\x93\x9d\x64\x07\xf6\x66\x42\x76\x56\x10\xf1\xbf\x4b\xf6\x8c\xa7\x16\x72\x78\x95\x70\x55\xf2\xd8\x37\x8f\x8f\x6f\x85\x46\x7a\x9d\x76\xde\x58\x05\xbe\xd5\x62\xf0\x82\xe6\x7e\x83\x2e\x7a\x11\x4a\xce\x5e\x46\xc2\x66\x1f\xf0\xea\x80\x15\x1e\x23\x2d\xcf\x97\x19\xe2\x77\xe4\x50\x3f\x6b\x3c\xd8\xc4\x32\x5c\xb8\xda\x7b\x8a\x64\x91\x26\xd8\xa1\x8f\x1c\xb5\xa4\x80\x96\x90\x74\x18\x28\x38\x7c\xfc\xac\x71\xa3\x9a\xc8\xcb\x2f\xc7\x9c\xe1\x11\x4b\xfb\x09\x87\x39\xfd\xbc\x9c\xf1\xe8\x99\xc4\x2a\xd3\x15\x74\xc2\x56\x4a\x4a\x5b\x70\x0f\x51\xa1\x79\x27\x8f\xd4\x71\xcf\x15\xa0\x96\xef\xbe\xf0\x1f\x76\x92\x76\x7b\x37\x47\x4e\x2d\xfd\x6f\x6b\x6f\xce\xb1\x8c\xc5\x16\x8d\xd7\x21\x34\x35\x1f\xad\x13\x38\x41\xe8\x9f\x7d\xfe\x13\x9d\xb7\x81\xed\xec\xf3\x04\x9f\xef\x01\x00\x00\xff\xff\xed\x4a\x80\xd4\x06\x04\x00\x00")
var _typesChannelGraphql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x92\xbd\x4e\xc3\x40\x10\x84\xfb\x7b\x8a\x41\x29\x68\x78\x82\x74\x10\x81\x94\x86\x02\x90\x68\x73\x8e\xd7\xbe\x93\x2e\xbb\xe6\x7e\x90\x2c\xc4\xbb\x23\x9f\x6d\x6c\x83\x88\x22\xd2\x50\x50\xf9\x56\x9e\x1d\xcd\x7e\x9a\x15\xb6\x5c\x89\x3f\xe8\x68\x85\xa1\x0b\x49\x11\x9a\xb1\x7d\xd8\x60\x6f\x34\x33\x39\x15\xdb\x86\xb0\xe9\x07\xbc\x29\x60\x85\x27\x43\xe3\xef\xcb\x00\xd6\x07\x52\xc8\x9f\x35\x1e\xa3\xb7\x5c\x5f\xa8\xac\x7b\x36\x14\x0d\x79\xc4\x49\x8f\x60\x24\xb9\x12\x05\xc1\x49\x5d\x53\xa9\x30\x3c\xd6\xb8\x11\x71\xa4\xf9\xc8\xb2\x0d\xd0\x30\xa9\xf8\x0c\x87\x6e\xfa\xba\xd9\xc5\xa3\x57\xe2\x98\x33\x5d\x41\x3c\x76\x9c\x9c\xdb\xc1\x56\x60\x61\xea\x7c\x42\x43\x7b\x5b\xd9\x1c\x20\x8b\xef\x67\xf9\x27\x1f\x27\xfb\x9e\xcd\x89\x56\xa3\x7e\xe1\xf6\xae\xd4\x0a\x77\xd6\x45\xf2\x01\x95\x2c\x6e\x0a\x78\x49\xe4\x5b\x65\xb9\x49\x71\xe4\x1c\x7a\xf1\x80\x7b\x18\xa2\x80\x6c\x46\xd2\x03\xeb\xc2\x24\x1e\xde\xa3\xdb\x77\x9c\x6a\xee\x51\xb4\x33\x32\x3f\x5f\x3e\xa9\x17\xf7\x1f\xb9\x6f\x11\xff\xba\x2c\xb7\x79\x3e\xb9\x2e\xc0\x19\x85\xf9\x75\x5f\xfe\x6e\x5d\x16\x38\x6f\x4b\x1b\xff\x79\x9e\xc1\xf3\x23\x00\x00\xff\xff\xd0\xc0\x09\x80\xe6\x04\x00\x00")
func typesChannelGraphqlBytes() ([]byte, error) { func typesChannelGraphqlBytes() ([]byte, error) {
return bindataRead( return bindataRead(
@ -134,7 +134,7 @@ func typesChannelGraphql() (*asset, error) {
return nil, err return nil, err
} }
info := bindataFileInfo{name: "types/channel.graphql", size: 1030, mode: os.FileMode(420), modTime: time.Unix(1529172367, 0)}
info := bindataFileInfo{name: "types/channel.graphql", size: 1254, mode: os.FileMode(420), modTime: time.Unix(1531666663, 0)}
a := &asset{bytes: bytes, info: info} a := &asset{bytes: bytes, info: info}
return a, nil return a, nil
} }

4
graphql/schema/root.graphql

@ -10,8 +10,8 @@ type Query {
# Find channel by name # Find channel by name
channel(name: String!): Channel channel(name: String!): Channel
# Find all channels. Specifying `logged: true` restricts the search to only logged.
channels(logged: Boolean): [Channel!]!
# Find channels
channels(filter: ChannelsFilter): [Channel!]!
# Find log by ID # Find log by ID

12
graphql/schema/types/channel.graphql

@ -16,6 +16,18 @@ type Channel {
locationName: String locationName: String
} }
# Filters for the channels query
input ChannelsFilter {
# Filter to either logged or unlogged channels
logged: Boolean
# Filter by event name
eventName: String
# Filter by location name
locationName: String
}
input ChannelAddInput { input ChannelAddInput {
# The channel's name # The channel's name
name: String! name: String!

15
model/channel/channel.go

@ -109,13 +109,20 @@ func FindName(name string) (Channel, error) {
// List finds channels, if logged is true it will be limited to logged // List finds channels, if logged is true it will be limited to logged
// channels // channels
func List(logged bool) ([]Channel, error) {
func List(logged *bool, eventName *string, locationName *string) ([]Channel, error) {
query := bson.M{} query := bson.M{}
if logged {
query["logged"] = true
if logged != nil {
query["logged"] = *logged
}
if eventName != nil {
query["eventName"] = *eventName
}
if locationName != nil {
query["locationName"] = *locationName
} }
channels := make([]Channel, 0, 32)
channels := make([]Channel, 0, 128)
err := collection.Find(query).All(&channels) err := collection.Find(query).All(&channels)
return channels, err return channels, err

Loading…
Cancel
Save