Browse Source

Changed files graphql query to use a filter argument to look more like other queries.

1.0
Gisle Aune 7 years ago
parent
commit
26d7e36631
  1. 16
      graphql/resolver/queries/files.go
  2. 8
      graphql/schema/bindata.go
  3. 2
      graphql/schema/root.graphql
  4. 9
      graphql/schema/types/file.graphql
  5. 15
      model/file/file.go

16
graphql/resolver/queries/files.go

@ -10,26 +10,28 @@ import (
// FilesArgs is args for files query
type FilesArgs struct {
IncludePublic *bool
MimeTypes *[]string
Filter *struct {
Public *bool
MimeTypes *[]string
}
}
// Files resolves the file query
func (r *QueryResolver) Files(ctx context.Context, args *FilesArgs) ([]*types.FileResolver, error) {
filter := args.Filter
user := session.FromContext(ctx).User()
author := ""
if user != nil {
author = user.ID
}
public := args.IncludePublic != nil && *args.IncludePublic == true
mimeTypes := []string(nil)
if args.MimeTypes != nil {
mimeTypes = *args.MimeTypes
if filter.MimeTypes != nil {
mimeTypes = *filter.MimeTypes
}
files, err := file.List(author, public, mimeTypes)
files, err := file.List(author, filter.Public, mimeTypes)
if err != nil {
return nil, err
}

8
graphql/schema/bindata.go

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

2
graphql/schema/root.graphql

@ -33,7 +33,7 @@ type Query {
file(id: String!): File
# Files get all available files. If includePublic is set, it will return public files as well
files(includePublic: Boolean, mimeTypes: [String!]): [File!]!
files(filter: FilesFilter): [File!]!
# Find story by ID

9
graphql/schema/types/file.graphql

@ -29,6 +29,15 @@ type File {
url: String
}
# Filter for the files quiery.
input FilesFilter {
# If set, this will limit the results to either public or private files.
public: Boolean
# Limit the MIME types of the files.
mimeTypes: [String!]
}
# Input for editFile mutation
input EditFileInput {
# The file's unique ID

15
model/file/file.go

@ -168,21 +168,22 @@ func FindName(kind string, name string, author string) (File, error) {
// List lists files according to the standard lookup. By default it's just the author's own files,
// but if `public` is true it will alos include files made public by other authors. If `mimeTypes` contains
// any, it will limit the results to that. If `author` is empty, it will only list public files
func List(author string, public bool, mimeTypes []string) ([]File, error) {
func List(author string, public *bool, mimeTypes []string) ([]File, error) {
query := bson.M{}
if author != "" {
if public {
query["$or"] = []bson.M{
bson.M{"author": author},
bson.M{"public": true},
if public != nil {
if *public == false {
query["author"] = author
}
query["public"] = *public
} else {
query["author"] = author
}
} else {
if !public {
return nil, errors.New("No author specified, and public is unset")
if public != nil && *public == false {
return nil, errors.New("You cannot")
}
query["public"] = true

Loading…
Cancel
Save