File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -163,7 +163,7 @@ final class SlackAddPeopleController {
163163
164164
165165 // Check if error
166- if let errorMessage = result. data [ " errors " ] ? [ " message " ] ? . string{
166+ if let errorMessage = result. data [ " errors " ] ? . array ? . first ? [ " message " ] ? . string{
167167 return try Error . custom ( text: errorMessage)
168168 }
169169
Original file line number Diff line number Diff line change @@ -34,11 +34,13 @@ final class SlackExternalController {
3434
3535 // Compare the verifications token (Security)
3636 if vertificationTokenRequest != verificationToken{
37+ Swift . print ( " Verification tokens don't match " )
3738 throw Abort . badRequest
3839 }
3940
4041 // Check if known callback
4142 guard let slackCallback = SlackExternalCallbacks ( rawValue: name) else {
43+ Swift . print ( " Callback id with ' \( name) ' doesn't exist " )
4244 throw Abort . badRequest
4345 }
4446
Original file line number Diff line number Diff line change @@ -107,7 +107,7 @@ final class SlackProjectsController {
107107 [
108108 " title " : projectFound. name,
109109 " title_link " : projectFound. prototypeUrl,
110- " thumb_url " : projectFound. images . first? . url ?? " " ,
110+ " thumb_url " : projectFound. screens . first? . content ? . url ?? " " ,
111111 " footer " : " Marvel Prototyping " ,
112112 " fields " : [
113113 [
Original file line number Diff line number Diff line change @@ -37,41 +37,47 @@ final class GraphQueries {
3737
3838 static let projects =
3939 """
40+ fragment image on ImageScreen {
41+ filename
42+ url
43+ }
44+
4045 query {
41- user {
42- projects(first: 50) {
43- edges {
44- node {
45- pk
46- name
47- prototypeUrl
48- lastModified
49- collaborators {
46+ user {
47+ projects(first: 40) {
5048 edges {
5149 node {
5250 pk
53- username
54- email
55- }
56- }
57- }
58- images {
59- edges {
60- node {
61- displayName
62- fileName
63- url
64- width
65- height
66- uuid
51+ name
52+ prototypeUrl
53+ lastModified
54+ collaborators {
55+ edges {
56+ node {
57+ pk
58+ username
59+ email
60+ }
61+ }
62+ }
63+ screens(first: 2) {
64+ edges {
65+ node {
66+ name
67+ uuid
68+ modifiedAt
69+ content {
70+ __typename
71+ ... image
72+ }
73+ }
74+ }
75+ }
6776 }
6877 }
6978 }
7079 }
7180 }
72- }
73- }
74- }
7581 """
7682
7783 static func createProject( name: String ) -> String {
Original file line number Diff line number Diff line change 1+ //
2+ // MarvelContent.swift
3+ // App
4+ //
5+ // Created by Maxime De Greve on 06/03/2018.
6+ //
7+
8+ import Vapor
9+
10+ final class MarvelContent {
11+
12+ // Non optionals
13+ var fileName = " "
14+ var url = " "
15+
16+ init ( with node: Node ? ) {
17+ fileName = node ? [ " filename " ] ? . string ?? " "
18+ url = node ? [ " url " ] ? . string ?? " "
19+ }
20+
21+ }
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ final class MarvelProject {
1515 var name = " "
1616 var prototypeUrl = " "
1717 var lastModified = Date ( )
18- var images = [ MarvelImage ] ( )
18+ var screens = [ MarvelScreen ] ( )
1919 var collaborators = [ MarvelMember] ( )
2020
2121 init ( with node: Node ? ) {
@@ -28,10 +28,10 @@ final class MarvelProject {
2828 lastModified = date
2929 }
3030
31- if let imagesArray = node ? [ " images " ] ? [ " edges " ] ? . array {
32- for image in imagesArray {
33- let image = MarvelImage ( with: image [ " node " ] )
34- images . append ( image )
31+ if let screensArray = node ? [ " screens " ] ? [ " edges " ] ? . array {
32+ for screen in screensArray {
33+ let screen = MarvelScreen ( with: screen [ " node " ] )
34+ screens . append ( screen )
3535 }
3636 }
3737
Original file line number Diff line number Diff line change 77
88import Vapor
99
10- final class MarvelImage {
10+ final class MarvelScreen {
1111
1212 // Non optionals
1313 var uuid = " "
1414 var width = 0
1515 var height = 0
16- var displayName = " "
17- var fileName = " "
18- var url = " "
16+ var name = " "
17+ var content : MarvelContent ?
1918
2019 init ( with node: Node ? ) {
2120 uuid = node ? [ " uuid " ] ? . string ?? " "
2221 width = node ? [ " width " ] ? . int ?? 0
2322 height = node ? [ " height " ] ? . int ?? 0
24- url = node ? [ " url " ] ? . string ?? " "
25- fileName = node ? [ " fileName " ] ? . string ?? " "
26- displayName = node ? [ " displayName " ] ? . string ?? " "
23+ name = node ? [ " name " ] ? . string ?? " "
24+
25+ if let contentNode = node ? [ " content " ] {
26+ content = MarvelContent ( with: contentNode)
27+ }
28+
2729 }
2830
2931}
You can’t perform that action at this time.
0 commit comments