Skip to content

Commit d261b41

Browse files
author
Florin Stan
committed
Merge branch '850-add-reason-code-crud-and-reason-codes-and-update-scheduling-activities-and-shift-segments-2' into 'master'
Resolve "Add reason code CRUD and Reason Codes, and update scheduling activities and shift segments" Closes #850 See merge request tcnpublic/api!993
2 parents 686b041 + df3bf0a commit d261b41

File tree

2 files changed

+154
-0
lines changed

2 files changed

+154
-0
lines changed

api/commons/wfm.proto

+20
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,24 @@ enum ConfigRelationshipType {
301301
IS_MEMBER_OF = 2;
302302
}
303303

304+
// Represents a Reason Code.
305+
message ReasonCode {
306+
// ID of the Reason Code.
307+
int64 reason_code_id = 1 [jstype = JS_STRING];
308+
// Name of the Reason Code.
309+
string name = 2;
310+
// The Scheduling Activity SID that the Reason Code is associated with.
311+
int64 scheduling_activity_sid = 3 [jstype = JS_STRING];
312+
// Indicates that this is a planned Reason Code.
313+
bool is_planned = 4;
314+
// Indicates that this is a paid Reason Code.
315+
bool is_paid = 5;
316+
// Set to true if the Reason Code is the default for @scheduling_activity_sid.
317+
bool is_default = 6;
318+
// Datetime that the Reason Code was set to inactive.
319+
google.protobuf.Timestamp datetime_set_to_inactive = 7;
320+
}
321+
304322
// Enum representing the level of a diagnostic.
305323
enum DiagnosticLevel {
306324
// The diagnostic is reporting an information level report.
@@ -864,6 +882,8 @@ message AdherenceAgentStateViolation {
864882
int32 violation_duration_seconds = 7;
865883
// Expected pause codes that the agent should be using if they were on Pause.
866884
repeated string expected_pause_codes = 8;
885+
// ID of the violation.
886+
int64 adherence_agent_state_violation_id = 9 [jstype = JS_STRING];
867887
}
868888

869889
// Bundle of agent states, used when returned as a bundle in a map.

api/v1alpha1/wfm/wfm.proto

+134
Original file line numberDiff line numberDiff line change
@@ -1266,6 +1266,7 @@ service WFM {
12661266
// If the rule will belong to a wfm agent, the agent group must be supplied instead to get a relevant set of candidate scheduling activities.
12671267
// Member non skill activity of each scheduling activity will be included in the response.
12681268
// The on call scheduling activity will always be included.
1269+
// Reason codes will be included with the returned scheduling activities.
12691270
// Errors:
12701271
// - grpc.Invalid: the @parent_of_rule is invalid.
12711272
// - grpc.NotFound: @parent_of_rule doesn't exist
@@ -1285,6 +1286,7 @@ service WFM {
12851286
// Lists all the scheduling activities for the org making the request.
12861287
// Their member non skill activities and pause codes will always be included.
12871288
// Scheduling activities are not checked for an active or inactive state, and neither are their member activities.
1289+
// Reason codes will be included with the returned scheduling activities.
12881290
// Errors:
12891291
// - grpc.Internal: error occurs when getting the activities or its members.
12901292
rpc ListSchedulingActivities(ListSchedulingActivitiesRequest) returns (ListSchedulingActivitiesResponse) {
@@ -1300,6 +1302,7 @@ service WFM {
13001302
}
13011303

13021304
// Gets the on call scheduling activity for the org sending the request.
1305+
// Reason codes will be included with the returned scheduling activity.
13031306
// Required permissions:
13041307
// NONE
13051308
// Errors:
@@ -2190,6 +2193,81 @@ service WFM {
21902193
};
21912194
}
21922195

2196+
// Creates the given reason code for the org sending the request.
2197+
// If @reason_code.is_default is true and there is already a default reason code for the @reason_code.scheduling_activity_sid, the existing default reason code must be set to is_default=false first.
2198+
// Required permissions:
2199+
// NONE
2200+
// Errors:
2201+
// - grpc.AlreadyExists: the @reason_code is set to default, but there is already a default reason code for the scheduling activity.
2202+
// - grpc.Internal: error occours when creating the reason code.
2203+
rpc CreateReasonCode(CreateReasonCodeRequest) returns (CreateReasonCodeResponse) {
2204+
option (google.api.http).post = "/api/v1alpha1/wfm/createreasoncode";
2205+
option (google.api.http).body = "*";
2206+
option (annotations.authz) = {
2207+
sets: [
2208+
{
2209+
permissions: [PERMISSION_WFM]
2210+
}
2211+
]
2212+
};
2213+
}
2214+
2215+
// Updates the given reason code for the org sending the request.
2216+
// If @reason_code.is_default is true and there is already a default reason code for the @reason_code.scheduling_activity_sid, the existing default reason code must be set to is_default=false first.
2217+
// Required permissions:
2218+
// NONE
2219+
// Errors:
2220+
// - grpc.AlreadyExists: the @reason_code is set to default, but there is already a default reason code for the scheduling activity.
2221+
// - grpc.Internal: error occours when updating the reason code.
2222+
rpc UpdateReasonCode(UpdateReasonCodeRequest) returns (UpdateReasonCodeResponse) {
2223+
option (google.api.http).post = "/api/v1alpha1/wfm/updatereasoncode";
2224+
option (google.api.http).body = "*";
2225+
option (annotations.authz) = {
2226+
sets: [
2227+
{
2228+
permissions: [PERMISSION_WFM]
2229+
}
2230+
]
2231+
};
2232+
}
2233+
2234+
// Gets the default reason code for the given @scheduling_activity_sid and the org sending the request.
2235+
// If there is currently no default reason code for the scheduling activity, returns nil instead.
2236+
// Required permissions:
2237+
// NONE
2238+
// Errors:
2239+
// - grpc.Internal: error occours when getting the default reason code.
2240+
rpc GetDefaultReasonCode(GetDefaultReasonCodeRequest) returns (GetDefaultReasonCodeResponse) {
2241+
option (google.api.http).post = "/api/v1alpha1/wfm/getdefaultreasoncode";
2242+
option (google.api.http).body = "*";
2243+
option (annotations.authz) = {
2244+
sets: [
2245+
{
2246+
permissions: [PERMISSION_WFM]
2247+
}
2248+
]
2249+
};
2250+
}
2251+
2252+
// Lists the reason codes for @scheduling_activity_sids and the org sending the request.
2253+
// If include_inactive is set to true, inactivate reason codes will be included in the response.
2254+
// Otherwise, only active reason codes will be included.
2255+
// Required permissions:
2256+
// NONE
2257+
// Errors:
2258+
// - grpc.Internal: error occours when listing the reason codes.
2259+
rpc ListReasonCodes(ListReasonCodesRequest) returns (ListReasonCodesResponse) {
2260+
option (google.api.http).post = "/api/v1alpha1/wfm/listreasoncodes";
2261+
option (google.api.http).body = "*";
2262+
option (annotations.authz) = {
2263+
sets: [
2264+
{
2265+
permissions: [PERMISSION_WFM]
2266+
}
2267+
]
2268+
};
2269+
}
2270+
21932271
// Deletes shift instances with the corresponding @shift_instance_sids for the org sending the request.
21942272
// Only deletes draft shifts. To delete published shifts use the DeletePublishedShifts endpoint.
21952273
// Errors:
@@ -5674,6 +5752,8 @@ message SchedulingActivity {
56745752
commons.SchedulingActivityClassification activity_classification = 5;
56755753
// List of all the pause codes that this activity allows.
56765754
repeated string pause_codes = 6;
5755+
// List of all reason codes associated with this activity.
5756+
repeated commons.ReasonCode reason_codes = 7;
56775757
}
56785758

56795759
// Request message for the ListCandidateSchedulingActivitiesReq RPC
@@ -6677,6 +6757,58 @@ message ListConfigEntitiesRes {
66776757
}
66786758
}
66796759

6760+
// Request message for CreateReasonCode RPC.
6761+
message CreateReasonCodeRequest {
6762+
// Reason code to create.
6763+
commons.ReasonCode reason_code = 1;
6764+
}
6765+
6766+
// Response message for CreateReasonCode RPC.
6767+
message CreateReasonCodeResponse {
6768+
// ID of the newly created reason code.
6769+
int64 reason_code_id = 1 [jstype = JS_STRING];
6770+
}
6771+
6772+
// Request message for UpdateReasonCode RPC.
6773+
message UpdateReasonCodeRequest {
6774+
// Reason code to update.
6775+
commons.ReasonCode reason_code = 1;
6776+
}
6777+
6778+
// Response message for UpdateReasonCode RPC.
6779+
message UpdateReasonCodeResponse {}
6780+
6781+
// Request message for GetDefaultReasonCode RPC.
6782+
message GetDefaultReasonCodeRequest {
6783+
// SID of the scheduling actvity to get the default reason code for.
6784+
int64 scheduling_activity_sid = 1 [jstype = JS_STRING];
6785+
}
6786+
6787+
// Response message for GetDefaultReasonCode RPC.
6788+
message GetDefaultReasonCodeResponse {
6789+
// The default reason code, if one exists.
6790+
commons.ReasonCode default_reason_code = 1;
6791+
}
6792+
6793+
// Request message for ListReasonCodes RPC.
6794+
message ListReasonCodesRequest {
6795+
// Scheduling Activity SIDs to get the reason codes for.
6796+
repeated int64 scheduling_activity_sids = 1;
6797+
// If True, includes inactive reason codes in the response.
6798+
// If False, only active reason codes will be included.
6799+
bool include_inactive = 2;
6800+
}
6801+
6802+
// Response message for ListReasonCodes RPC.
6803+
message ListReasonCodesResponse {
6804+
message ReasonCodes {
6805+
// A list of reason codes
6806+
repeated commons.ReasonCode reason_codes = 1;
6807+
}
6808+
// A map from the scheduling activity sid to their reason codes.
6809+
map<int64, ReasonCodes> reason_codes_by_scheduling_activity = 1;
6810+
}
6811+
66806812
// Message type specifying the parameters of a diagnostic
66816813
message Diagnostic {
66826814
// The diagnostic level describes the class of the diagnostic message.
@@ -7131,6 +7263,8 @@ message ShiftSegment {
71317263
SchedulingActivity scheduling_activity = 8;
71327264
// Per-skill call stats.
71337265
repeated ShiftSegmentCallStat call_stats_by_skill_collection = 9;
7266+
// The reason code ID associated with the shift segment.
7267+
int64 reason_code_id = 10 [jstype = JS_STRING];
71347268
}
71357269

71367270
// Request message for the GetPublishedSchedule RPC

0 commit comments

Comments
 (0)