diff --git a/common/common.proto b/common/common.proto index f69ad38..503ccd5 100644 --- a/common/common.proto +++ b/common/common.proto @@ -36,6 +36,11 @@ enum Domain { DOMAIN_SUBMISSION = 10; } +enum SortOrder { + ASC = 0; + DESC = 1; +} + message ScanCriteria { string key = 1; optional Operator operator = 2; @@ -73,6 +78,28 @@ message LookupCriteria { google.protobuf.Value value = 3; } +message GetRequest { + oneof id { + int64 integer_id = 1; + string string_id = 2; + } + repeated string attributes = 3; +} + +message SearchRequest { + repeated SearchCriteria criteria = 1; + repeated string attributes = 2; + optional int32 page = 3; + optional int32 per_page = 4; + SortOrder sort_order = 5; + optional string sort_by = 6; +} + +message SearchCriteria { + string key = 1; + google.protobuf.Value value = 2; +} + // TODO: There has to be a better way to do this. message GoogleProtobufTypesPlaceholder { google.protobuf.Timestamp timestamp = 1; diff --git a/domain-layer/review/answer_type.proto b/domain-layer/review/answer_type.proto new file mode 100644 index 0000000..18ca3d2 --- /dev/null +++ b/domain-layer/review/answer_type.proto @@ -0,0 +1,30 @@ +syntax = "proto3"; + +package topcoder.domain.review.answertype; + +import "google/protobuf/timestamp.proto"; + +option java_multiple_files = true; +option java_package = "com.topcoder.domain.review.answertype"; + +message AnswerType { + optional int64 id = 1; + string name = 2; + optional string description = 3; + repeated AnswerTypeValue answer_type_values = 4; + google.protobuf.Timestamp created_at = 5; + google.protobuf.Timestamp updated_at = 6; + int32 created_by = 7; + int32 updated_by = 8; +} + +message AnswerTypeValue { + optional int64 id = 1; + string value = 2; + double weight = 3; + int32 display_order = 4; + google.protobuf.Timestamp created_at = 5; + google.protobuf.Timestamp updated_at = 6; + int32 created_by = 7; + int32 updated_by = 8; +} \ No newline at end of file diff --git a/domain-layer/review/discussion.proto b/domain-layer/review/discussion.proto new file mode 100644 index 0000000..2f53b02 --- /dev/null +++ b/domain-layer/review/discussion.proto @@ -0,0 +1,31 @@ +syntax = "proto3"; + +package topcoder.domain.review.discussion; + +import "google/protobuf/timestamp.proto"; + +option java_multiple_files = true; +option java_package = "com.topcoder.domain.review.discussion"; + +message Discussion { + optional int64 id = 1; + int64 score_id = 2; + optional int64 parent_id = 3; + int64 discussion_type_id = 4; + string text = 5; + optional string reference = 6; + google.protobuf.Timestamp created_at = 7; + google.protobuf.Timestamp updated_at = 8; + int32 created_by = 9; + int32 updated_by = 10; +} + +message DiscussionType { + optional int64 id = 1; + string name = 2; + optional string description = 3; + google.protobuf.Timestamp created_at = 4; + google.protobuf.Timestamp updated_at = 5; + int32 created_by = 6; + int32 updated_by = 7; +} \ No newline at end of file diff --git a/domain-layer/review/review.proto b/domain-layer/review/review.proto new file mode 100644 index 0000000..8a5798e --- /dev/null +++ b/domain-layer/review/review.proto @@ -0,0 +1,52 @@ +syntax = "proto3"; + +package topcoder.domain.review.review; + +import "domain-layer/review/discussion.proto"; +import "google/protobuf/timestamp.proto"; + +option java_multiple_files = true; +option java_package = "com.topcoder.domain.review.review"; + +message Review { + enum ReviewStatus { + DRAFT = 0; + SUBMITTED = 1; + PUBLISHED = 2; + } + + optional int64 id = 1; + int64 reviewer_id = 2; + int64 scorecard_id = 3; + int64 work_id = 4; + int64 work_group_id = 5; + double total_score = 6; + ReviewStatus status = 7; + optional string custom_data = 8; + repeated Score scores = 9; + google.protobuf.Timestamp created_at = 10; + google.protobuf.Timestamp updated_at = 11; + int32 created_by = 12; + int32 updated_by = 13; +} + +message Score { + optional int64 id = 1; + int64 criterion_id = 2; + int64 answer_type_value_id = 3; + repeated topcoder.domain.review.discussion.Discussion discussions = 4; + google.protobuf.Timestamp created_at = 5; + google.protobuf.Timestamp updated_at = 6; + int32 created_by = 7; + int32 updated_by = 8; +} + +message WorkGroup { + optional int64 id = 1; + string name = 2; + optional string description = 3; + google.protobuf.Timestamp created_at = 4; + google.protobuf.Timestamp updated_at = 5; + int32 created_by = 6; + int32 updated_by = 7; +} \ No newline at end of file diff --git a/domain-layer/review/scorecard.proto b/domain-layer/review/scorecard.proto new file mode 100644 index 0000000..eb4b426 --- /dev/null +++ b/domain-layer/review/scorecard.proto @@ -0,0 +1,52 @@ +syntax = "proto3"; + +package topcoder.domain.review.scorecard; + +import "google/protobuf/timestamp.proto"; + +option java_multiple_files = true; +option java_package = "com.topcoder.domain.review.scorecard"; + +message Scorecard { + enum Status { + ENABLED = 0; + DISABLED = 1; + } + + optional int64 id = 1; + string name = 2; + optional string description = 3; + int32 version = 4; + Status status = 5; + optional int64 parent_scorecard_id = 6; + repeated CriteriaGroup criteria_groups = 7; + google.protobuf.Timestamp created_at = 8; + google.protobuf.Timestamp updated_at = 9; + int32 created_by = 10; + int32 updated_by = 11; +} + +message CriteriaGroup { + optional int64 id = 1; + string name = 2; + double weight = 3; + int32 display_order = 4; + repeated Criterion criterias = 5; + google.protobuf.Timestamp created_at = 6; + google.protobuf.Timestamp updated_at = 7; + int32 created_by = 8; + int32 updated_by = 9; +} + +message Criterion { + optional int64 id = 1; + string name = 2; + optional string description = 3; + int64 answer_type_id = 4; + int32 display_order = 5; + optional string example = 6; + google.protobuf.Timestamp created_at = 7; + google.protobuf.Timestamp updated_at = 8; + int32 created_by = 9; + int32 updated_by = 10; +} \ No newline at end of file diff --git a/domain-layer/review/services/answer_type.proto b/domain-layer/review/services/answer_type.proto new file mode 100644 index 0000000..5f81035 --- /dev/null +++ b/domain-layer/review/services/answer_type.proto @@ -0,0 +1,30 @@ +syntax = "proto3"; + +package topcoder.domain.service.review.answertype; + +import "common/common.proto"; +import "domain-layer/review/answer_type.proto"; + +option java_multiple_files = true; +option java_package = "com.topcoder.domain.service.review.answertype"; + +message AnswerTypeList { + repeated topcoder.domain.review.answertype.AnswerType answer_types = 1; +} + +service AnswerType { + rpc Get(topcoder.common.GetRequest) + returns (topcoder.domain.review.answertype.AnswerType); + + rpc Search(topcoder.common.SearchRequest) + returns (AnswerTypeList); + + rpc Create(topcoder.domain.review.answertype.AnswerType) + returns (topcoder.domain.review.answertype.AnswerType); + + rpc Update(topcoder.domain.review.answertype.AnswerType) + returns (topcoder.domain.review.answertype.AnswerType); + + rpc Delete(topcoder.common.GetRequest) + returns (topcoder.domain.review.answertype.AnswerType); +} \ No newline at end of file diff --git a/domain-layer/review/services/discussion.proto b/domain-layer/review/services/discussion.proto new file mode 100644 index 0000000..b01de16 --- /dev/null +++ b/domain-layer/review/services/discussion.proto @@ -0,0 +1,30 @@ +syntax = "proto3"; + +package topcoder.domain.service.review.discussion; + +import "common/common.proto"; +import "domain-layer/review/discussion.proto"; + +option java_multiple_files = true; +option java_package = "com.topcoder.domain.service.review.discussion"; + +message DiscussionList { + repeated topcoder.domain.review.discussion.Discussion discussions = 1; +} + +service Discussion { + rpc Get(topcoder.common.GetRequest) + returns (topcoder.domain.review.discussion.Discussion); + + rpc Search(topcoder.common.SearchRequest) + returns (DiscussionList); + + rpc Create(topcoder.domain.review.discussion.Discussion) + returns (topcoder.domain.review.discussion.Discussion); + + rpc Update(topcoder.domain.review.discussion.Discussion) + returns (topcoder.domain.review.discussion.Discussion); + + rpc Delete(topcoder.common.GetRequest) + returns (topcoder.domain.review.discussion.Discussion); +} \ No newline at end of file diff --git a/domain-layer/review/services/review.proto b/domain-layer/review/services/review.proto new file mode 100644 index 0000000..1b141e1 --- /dev/null +++ b/domain-layer/review/services/review.proto @@ -0,0 +1,30 @@ +syntax = "proto3"; + +package topcoder.domain.service.review.review; + +import "common/common.proto"; +import "domain-layer/review/review.proto"; + +option java_multiple_files = true; +option java_package = "com.topcoder.domain.service.review.review"; + +message ReviewList { + repeated topcoder.domain.review.review.Review reviews = 1; +} + +service Discussion { + rpc Get(topcoder.common.GetRequest) + returns (topcoder.domain.review.review.Review); + + rpc Search(topcoder.common.SearchRequest) + returns (ReviewList); + + rpc Create(topcoder.domain.review.review.Review) + returns (topcoder.domain.review.review.Review); + + rpc Update(topcoder.domain.review.review.Review) + returns (topcoder.domain.review.review.Review); + + rpc Delete(topcoder.common.GetRequest) + returns (topcoder.domain.review.review.Review); +} \ No newline at end of file diff --git a/domain-layer/review/services/scorecard.proto b/domain-layer/review/services/scorecard.proto new file mode 100644 index 0000000..136803e --- /dev/null +++ b/domain-layer/review/services/scorecard.proto @@ -0,0 +1,30 @@ +syntax = "proto3"; + +package topcoder.domain.service.review.scorecard; + +import "common/common.proto"; +import "domain-layer/review/scorecard.proto"; + +option java_multiple_files = true; +option java_package = "com.topcoder.domain.service.review.scorecard"; + +message ScorecardList { + repeated topcoder.domain.review.scorecard.Scorecard scorecards = 1; +} + +service Scorecard { + rpc Get(topcoder.common.GetRequest) + returns (topcoder.domain.review.scorecard.Scorecard); + + rpc Search(topcoder.common.SearchRequest) + returns (ScorecardList); + + rpc Create(topcoder.domain.review.scorecard.Scorecard) + returns (topcoder.domain.review.scorecard.Scorecard); + + rpc Update(topcoder.domain.review.scorecard.Scorecard) + returns (topcoder.domain.review.scorecard.Scorecard); + + rpc Delete(topcoder.common.GetRequest) + returns (topcoder.domain.review.scorecard.Scorecard); +} \ No newline at end of file