-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
89 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
src/main/groovy/au/org/ala/ecodata/graphql/mappers/OrganisationGraphQLMapper.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package au.org.ala.ecodata.graphql.mappers | ||
|
||
|
||
import au.org.ala.ecodata.Program | ||
import org.grails.gorm.graphql.entity.dsl.GraphQLMapping | ||
|
||
class OrganisationGraphQLMapper { | ||
static graphqlMapping() { | ||
GraphQLMapping.lazy { | ||
// Disable default operations, including get as we only want to expose UUIDs in the API not internal ones | ||
operations.get.enabled false | ||
operations.list.enabled false | ||
operations.count.enabled false | ||
operations.create.enabled false | ||
operations.update.enabled false | ||
operations.delete.enabled false | ||
|
||
} | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
src/main/groovy/au/org/ala/ecodata/graphql/mappers/ProgramGraphQLMapper.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package au.org.ala.ecodata.graphql.mappers | ||
|
||
|
||
import au.org.ala.ecodata.Program | ||
import org.grails.gorm.graphql.entity.dsl.GraphQLMapping | ||
|
||
class ProgramGraphQLMapper { | ||
static graphqlMapping() { | ||
GraphQLMapping.lazy { | ||
// Disable default operations, including get as we only want to expose UUIDs in the API not internal ones | ||
operations.get.enabled false | ||
operations.list.enabled false | ||
operations.count.enabled false | ||
operations.create.enabled false | ||
operations.update.enabled false | ||
operations.delete.enabled false | ||
|
||
exclude("outcomes", "priorities", "config") | ||
|
||
add("outcomes", "outcomes") { | ||
type { | ||
field("outcome", String) | ||
field("priorities", "priorities"){ | ||
field("category", String) | ||
collection(true) | ||
} | ||
field("category", String) | ||
field("shortDescription", String) | ||
collection true | ||
} | ||
dataFetcher { Program program -> | ||
program.outcomes | ||
} | ||
} | ||
|
||
add("investmentPriorities", "investmentPriorities") { | ||
type { | ||
field("category", String) | ||
field("priority", String) | ||
collection(true) | ||
} | ||
dataFetcher { Program program -> | ||
program.priorities | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters