Skip to content

Commit

Permalink
feat: create org search admin API contract (#380)
Browse files Browse the repository at this point in the history
* feat: create org search admin API contract

* fix: import

* fix: body

* fix: body

* fix: fmt

* fix: syntax error

* fix: proto error

* fix: remove redundant key

* fix: use oneof instead of any in filter value

* fix: change int_val to float_val

* fix: newline
  • Loading branch information
whoAbhishekSah authored Mar 3, 2025
1 parent 59bb914 commit ed2adec
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 0 deletions.
37 changes: 37 additions & 0 deletions raystack/frontier/v1beta1/admin.proto
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package raystack.frontier.v1beta1;
import "google/api/annotations.proto";
import "google/api/field_behavior.proto";
import "google/protobuf/struct.proto";
import "google/protobuf/timestamp.proto";
import "protoc-gen-openapiv2/options/annotations.proto";
import "raystack/frontier/v1beta1/models.proto";
import "validate/validate.proto";
Expand Down Expand Up @@ -154,6 +155,18 @@ service AdminService {
};
}

rpc SearchOrganizations(SearchOrganizationsRequest) returns (SearchOrganizationsResponse) {
option (google.api.http) = {
post: "/v1beta1/admin/organizations/search",
body: "query"
};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
tags: "Organization";
summary: "Search organizations";
description: "Search organization based on org demographic properties and billing plan details";
};
}

rpc SetOrganizationKyc(SetOrganizationKycRequest) returns (SetOrganizationKycResponse) {
option (google.api.http) = {
put: "/v1beta1/admin/organizations/{org_id}/kyc",
Expand Down Expand Up @@ -834,6 +847,30 @@ message SetOrganizationKycRequest {
string link = 3;
}

message SearchOrganizationsRequest {
RQLRequest query = 1;
}

message SetOrganizationKycResponse {
OrganizationKyc organization_kyc = 1;
}

message SearchOrganizationsResponse {
message OrganizationResult {
string id = 1;
string name = 2;
string title = 3;
google.protobuf.Timestamp created_at = 4;
google.protobuf.Timestamp updated_at = 5 ;
string state = 6;
string avatar = 7;
string created_by = 8;
string billing_plan_name = 9;
string payment_mode = 10 [(validate.rules).string = {in: ["prepaid", "postpaid"]}];
google.protobuf.Timestamp billing_cycle_ends_at = 11;
string country = 12;
}

repeated OrganizationResult organizations = 1;
RQLQueryPaginationResponse pagination = 2;
}
29 changes: 29 additions & 0 deletions raystack/frontier/v1beta1/models.proto
Original file line number Diff line number Diff line change
Expand Up @@ -973,3 +973,32 @@ message Audience {
google.protobuf.Struct metadata = 35;
}

message RQLRequest {
repeated RQLFilter filters = 1;
repeated string group_by = 2;
uint32 offset = 3;
uint32 limit = 4;
string search = 5;
repeated RQLSort sort = 6;
}

message RQLFilter {
string name = 1;
string operator = 2;
oneof value {
bool bool_value = 3;
string string_value = 4;
float number_value = 5;
}
}

message RQLSort {
string key = 1;
string order = 2 [(validate.rules).string = {in: ["asc", "desc"]}];
}

message RQLQueryPaginationResponse {
uint32 offset = 1;
uint32 limit = 2;
uint32 total_count = 3;
}

0 comments on commit ed2adec

Please sign in to comment.