Search in sources :

Example 1 with QARequest

use of se.inera.intyg.webcert.web.web.controller.api.dto.QARequest in project webcert by sklintyg.

the class FragaSvarModuleApiControllerIT method closeQAsAsHandled.

@Test
public void closeQAsAsHandled() {
    sessionId = getAuthSession(DEFAULT_LAKARE);
    String intygId = createSignedIntyg(DEFAULT_INTYGSTYP, DEFAULT_PATIENT_PERSONNUMMER);
    int internId = createQuestion(DEFAULT_INTYGSTYP, intygId, DEFAULT_PATIENT_PERSONNUMMER);
    // Create the body of the request
    ArrayList<QARequest> requests = new ArrayList<>();
    QARequest request = new QARequest();
    request.setFragaSvarId((long) internId);
    request.setIntygsTyp(DEFAULT_INTYGSTYP);
    requests.add(request);
    given().cookie("ROUTEID", BaseRestIntegrationTest.routeId).contentType(ContentType.JSON).body(requests).expect().statusCode(200).when().put("moduleapi/fragasvar/stang").then().body(matchesJsonSchemaInClasspath("jsonschema/webcert-fragasvar-for-intyg-list-schema.json")).body("$", hasSize(requests.size()));
    deleteQuestion(internId);
}
Also used : QARequest(se.inera.intyg.webcert.web.web.controller.api.dto.QARequest) ArrayList(java.util.ArrayList) Test(org.junit.Test) BaseRestIntegrationTest(se.inera.intyg.webcert.web.web.controller.integrationtest.BaseRestIntegrationTest)

Example 2 with QARequest

use of se.inera.intyg.webcert.web.web.controller.api.dto.QARequest in project webcert by sklintyg.

the class FragaSvarModuleApiController method closeQAsAsHandled.

@PUT
@Path("/stang")
@Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET)
public List<FragaSvar> closeQAsAsHandled(List<QARequest> qas) {
    List<FragaSvar> fragaSvars = new ArrayList<>();
    for (QARequest qa : qas) {
        abortIfFragaSvarNotActive(qa.getIntygsTyp());
        fragaSvars.add(fragaSvarService.closeQuestionAsHandled(qa.getFragaSvarId()));
    }
    return fragaSvars;
}
Also used : QARequest(se.inera.intyg.webcert.web.web.controller.api.dto.QARequest) ArrayList(java.util.ArrayList) FragaSvar(se.inera.intyg.webcert.persistence.fragasvar.model.FragaSvar) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) PUT(javax.ws.rs.PUT)

Aggregations

ArrayList (java.util.ArrayList)2 QARequest (se.inera.intyg.webcert.web.web.controller.api.dto.QARequest)2 PUT (javax.ws.rs.PUT)1 Path (javax.ws.rs.Path)1 Produces (javax.ws.rs.Produces)1 Test (org.junit.Test)1 FragaSvar (se.inera.intyg.webcert.persistence.fragasvar.model.FragaSvar)1 BaseRestIntegrationTest (se.inera.intyg.webcert.web.web.controller.integrationtest.BaseRestIntegrationTest)1