Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: create org search admin API contract #380

Merged
merged 11 commits into from
Mar 3, 2025
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;
}
Loading