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
module.exports = { | |
departments: [ | |
{ id: 1, dept_name: "Lorem Ipsum" }, | |
{ id: 2, dept_name: "Sic Dolor amet" }, | |
], | |
employees: [ | |
{ | |
id: 123, | |
first_name: "John Doe", | |
last_name: "Last", |
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
[gist id="9b1307f153f4abe352a4" file="media-control-snippet.php"] |
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
@SpringBootTest(classes = { DgsAutoConfiguration.class, DateScalar.class, EmployeePhotoUploadDataFetcher.class }) | |
public class EmployeePhotoUploadDataFetcherTest { | |
@Autowired | |
DgsQueryExecutor dgsQueryExecutor; | |
@Autowired | |
EmployeePhotoUploadDataFetcher empPhotoUploader; | |
@Test |
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
scalar Upload | |
type Mutation { | |
uploadEmployeePhoto(emp_id: Int! ,inputFile : Upload!): String | |
} |
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
query GetEmployee ($id : Int){ | |
employee(id :$id){ | |
first_name | |
last_name | |
} | |
} | |
mutation createEmployee ($employee : SubmittedEmployee){ | |
createEmployee (employee : $employee) { | |
id |
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
query GetEmployee{ | |
employee(id :1){ | |
first_name | |
last_name | |
} | |
} | |
query GetEmployeeWithDept{ | |
employee(id :1){ | |
first_name |
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
query { | |
employee(id :1){ | |
first_name | |
last_name | |
} | |
} |
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
mutation { | |
createEmployee (employee :{first_name: "Alex" ,last_name : "Peak" ,gender : M ,deptId:1}) { | |
id | |
first_name | |
} | |
} |
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
@Test | |
public void test_notifyEmployeeCreation() throws JsonMappingException, JsonProcessingException { | |
ExecutionResult notifyEmployeeCreationSubscription = dgsQueryExecutor.execute( | |
"subscription { notifyEmployeeCreation { id first_name last_name gender hire_date birth_date} }"); | |
Publisher<ExecutionResult> publisher = notifyEmployeeCreationSubscription.getData(); | |
publisher.subscribe(new Subscriber<ExecutionResult>() { | |
@Override |
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
@DgsComponent | |
public class EmployeeDataFetcher { | |
private FluxSink<Employee> employeeStream; | |
private ConnectableFlux<Employee> employeePublisher; | |
@PostConstruct | |
public void init() { |
NewerOlder