-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Respond to consultation request from VH Officer and transfer to provi…
…ded consultation room
- Loading branch information
1 parent
de0c048
commit d66f2a0
Showing
17 changed files
with
587 additions
and
216 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
30 changes: 30 additions & 0 deletions
30
VideoAPI/Video.API/Validations/AdminConsultationRequestValidation.cs
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,30 @@ | ||
using System.Collections.Generic; | ||
using FluentValidation; | ||
using VideoApi.Contract.Requests; | ||
using VideoApi.Domain.Enums; | ||
|
||
namespace Video.API.Validations | ||
{ | ||
public class AdminConsultationRequestValidation : AbstractValidator<AdminConsultationRequest> | ||
{ | ||
public static readonly string NoConferenceIdErrorMessage = "ConferenceId is required"; | ||
public static readonly string NoParticipantIdErrorMessage = "ParticipantId is required"; | ||
public static readonly string NoAnswerErrorMessage = "Answer to request is required"; | ||
public static readonly string NotValidConsultationRoomMessage = "Room must be a consultation room"; | ||
|
||
public AdminConsultationRequestValidation() | ||
{ | ||
RuleFor(x => x.ConferenceId).NotEmpty().WithMessage(NoConferenceIdErrorMessage); | ||
RuleFor(x => x.ParticipantId).NotEmpty().WithMessage(NoParticipantIdErrorMessage); | ||
RuleFor(x => x.Answer).NotEqual(ConsultationAnswer.None).WithMessage(NoAnswerErrorMessage); | ||
RuleFor(x => x.ConsultationRoom).Custom((type, context) => | ||
{ | ||
var validRooms = new List<RoomType> {RoomType.ConsultationRoom1, RoomType.ConsultationRoom2}; | ||
if (!validRooms.Contains(type)) | ||
{ | ||
context.AddFailure("ConsultationRoom", NotValidConsultationRoomMessage); | ||
} | ||
}); | ||
} | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
VideoAPI/VideoApi.Contract/Requests/AdminConsultationRequest.cs
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,33 @@ | ||
using System; | ||
using System.ComponentModel.DataAnnotations; | ||
using VideoApi.Domain.Enums; | ||
|
||
namespace VideoApi.Contract.Requests | ||
{ | ||
/// <summary> | ||
/// Request a private consultation with another participant | ||
/// </summary> | ||
public class AdminConsultationRequest | ||
{ | ||
/// <summary> | ||
/// The conference UUID | ||
/// </summary> | ||
public Guid ConferenceId { get; set; } | ||
|
||
/// <summary> | ||
/// UUID of participant VH Officer attempted to call | ||
/// </summary> | ||
public Guid ParticipantId { get; set; } | ||
|
||
/// <summary> | ||
/// Consultation Room to use | ||
/// </summary> | ||
public RoomType ConsultationRoom { get; set; } | ||
|
||
/// <summary> | ||
/// Response to a consultation request (i.e. 'Accepted or Rejected') | ||
/// </summary> | ||
[EnumDataType(typeof(ConsultationAnswer))] | ||
public ConsultationAnswer? Answer { get; set; } | ||
} | ||
} |
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
105 changes: 0 additions & 105 deletions
105
VideoAPI/VideoApi.IntegrationTests/Api/Consultations.feature
This file was deleted.
Oops, something went wrong.
31 changes: 31 additions & 0 deletions
31
VideoAPI/VideoApi.IntegrationTests/Api/Consultations/AdminConsultations.feature
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,31 @@ | ||
Feature: Respond to Admin Consultations | ||
In order to manage private consultations with the VH Admin team | ||
As an API service | ||
I want to respond to private consultations with the VH Admin team | ||
|
||
Scenario: Respond to a VH Officer Consultation with an invalid request | ||
Given I have an invalid respond to admin consultation request | ||
When I send the request to the endpoint | ||
Then the response should have the status BadRequest and success status False | ||
And the error response message should also contain 'ConferenceId is required' | ||
And the error response message should also contain 'ParticipantId is required' | ||
And the error response message should also contain 'Room must be a consultation room' | ||
And the error response message should also contain 'Answer to request is required' | ||
|
||
Scenario: Respond to a VH Officer Consultation for a non-existent conference | ||
Given I have a conference | ||
Given I have a nonexistent respond to admin consultation request | ||
When I send the request to the endpoint | ||
Then the response should have the status NotFound and success status False | ||
|
||
Scenario: Respond to a VH Officer Consultation for a non-existent participant | ||
Given I have a conference | ||
Given I have a respond to admin consultation request with a non-existent participant | ||
When I send the request to the endpoint | ||
Then the response should have the status NotFound and success status False | ||
|
||
Scenario: Respond to a VH Officer Consultation successfully | ||
Given I have a conference | ||
And I have a valid respond to admin consultation request | ||
When I send the request to the endpoint | ||
Then the response should have the status NoContent and success status True |
36 changes: 36 additions & 0 deletions
36
VideoAPI/VideoApi.IntegrationTests/Api/Consultations/LeavePrivateConsultation.feature
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,36 @@ | ||
Feature: Leave Private Consultations | ||
In order to manage private consultations | ||
As an API service | ||
I want to leave private consultations | ||
|
||
Scenario: Leave a private consultation with an invalid request | ||
Given I have an invalid leave consultation request | ||
When I send the request to the endpoint | ||
Then the response should have the status BadRequest and success status False | ||
And the error response message should also contain 'ConferenceId is required' | ||
And the error response message should also contain 'ParticipantId is required' | ||
|
||
Scenario: Successfully leave a private consultation | ||
Given I have a conference | ||
And I have an valid leave consultation request | ||
When I send the request to the endpoint | ||
Then the response should have the status NoContent and success status True | ||
|
||
Scenario: Leaving a consultation for a non-existent conference returns not found | ||
Given I have a conference | ||
And I have an nonexistent leave consultation request | ||
When I send the request to the endpoint | ||
Then the response should have the status NotFound and success status False | ||
|
||
Scenario: Leaving a consultation for a non-existent participant returns not found | ||
Given I have a conference | ||
And I have a leave consultation request for a nonexistent participant | ||
When I send the request to the endpoint | ||
Then the response should have the status NotFound and success status False | ||
|
||
Scenario: Leaving a consultation for a participant not in a consultation returns a bad request | ||
Given I have a conference | ||
And I have a leave consultation request for a participant not in a consultation | ||
When I send the request to the endpoint | ||
Then the response should have the status BadRequest and success status False | ||
And the error response message should also contain 'is not in a consultation room' |
36 changes: 36 additions & 0 deletions
36
VideoAPI/VideoApi.IntegrationTests/Api/Consultations/RaisePrivateConsultation.feature
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,36 @@ | ||
Feature: Raise Private Consultations | ||
In order to manage private consultations | ||
As an API service | ||
I want to raise private consultations | ||
|
||
Scenario: Successfully raise a private consultation request | ||
Given I have a conference | ||
And I have a valid raise consultation request | ||
When I send the request to the endpoint | ||
Then the response should have the status NoContent and success status True | ||
|
||
Scenario: Raise private consultation request against non-existent conference | ||
Given I have a conference | ||
And I have a nonexistent raise consultation request | ||
When I send the request to the endpoint | ||
Then the response should have the status NotFound and success status False | ||
|
||
Scenario: Raise a private consultation request that fails validation | ||
Given I have an invalid raise consultation request | ||
When I send the request to the endpoint | ||
Then the response should have the status BadRequest and success status False | ||
And the error response message should also contain 'RequestedBy is required' | ||
And the error response message should also contain 'RequestedFor is required' | ||
And the error response message should also contain 'ConferenceId is required' | ||
|
||
Scenario: Raise private consultation request when user requested by does not exist | ||
Given I have a conference | ||
And I have a raise consultation request with an invalid requestedBy | ||
When I send the request to the endpoint | ||
Then the response should have the status NotFound and success status False | ||
|
||
Scenario: Raise private consultation request when user requested for does not exist | ||
Given I have a conference | ||
And I have a raise consultation request with an invalid requestedFor | ||
When I send the request to the endpoint | ||
Then the response should have the status NotFound and success status False |
37 changes: 37 additions & 0 deletions
37
VideoAPI/VideoApi.IntegrationTests/Api/Consultations/RespondToPrivateConsultation.feature
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,37 @@ | ||
Feature: Respond To Consultations | ||
In order to manage private consultations | ||
As an API service | ||
I want to respond to private consultations | ||
|
||
Scenario: Successfully respond to a private consultation request | ||
Given I have a conference | ||
And I have a valid respond consultation request | ||
When I send the request to the endpoint | ||
Then the response should have the status NoContent and success status True | ||
|
||
Scenario: Respond to private consultation request against non-existent conference | ||
Given I have a conference | ||
And I have a nonexistent respond consultation request | ||
When I send the request to the endpoint | ||
Then the response should have the status NotFound and success status False | ||
|
||
Scenario: Respond to a private consultation request that fails validation | ||
Given I have an invalid respond consultation request | ||
When I send the request to the endpoint | ||
Then the response should have the status BadRequest and success status False | ||
And the error response message should also contain 'RequestedBy is required' | ||
And the error response message should also contain 'RequestedFor is required' | ||
And the error response message should also contain 'ConferenceId is required' | ||
And the error response message should also contain 'Answer to request is required' | ||
|
||
Scenario: Respond to private consultation request when user requested by does not exist | ||
Given I have a conference | ||
And I have a respond consultation request with an invalid requestedBy | ||
When I send the request to the endpoint | ||
Then the response should have the status NotFound and success status False | ||
|
||
Scenario: Respond to private consultation request when user requested for does not exist | ||
Given I have a conference | ||
And I have a respond consultation request with an invalid requestedFor | ||
When I send the request to the endpoint | ||
Then the response should have the status NotFound and success status False |
Oops, something went wrong.