fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! Merge branch 'main' into org_api

This commit is contained in:
Iraq Jaber
2025-05-21 12:52:12 +02:00
parent 83a5371fe6
commit cb2c2e77bf
2 changed files with 148 additions and 27 deletions

View File

@@ -5,7 +5,6 @@ package org_test
import ( import (
"context" "context"
"errors" "errors"
"fmt"
"os" "os"
"strings" "strings"
"testing" "testing"
@@ -167,7 +166,6 @@ func TestServer_CreateOrganization(t *testing.T) {
for _, tt := range tests { for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) { t.Run(tt.name, func(t *testing.T) {
got, err := Client.CreateOrganization(tt.ctx, tt.req) got, err := Client.CreateOrganization(tt.ctx, tt.req)
fmt.Printf("@@ >>>>>>>>>>>>>>>>>>>>>>>>>>>> err = %+v\n", err)
if tt.wantErr { if tt.wantErr {
require.Error(t, err) require.Error(t, err)
return return

View File

@@ -126,6 +126,21 @@ service OrganizationService {
permission: "org.create" permission: "org.create"
} }
}; };
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
responses: {
key: "200";
value: {
description: "Organization created successfully";
};
};
responses: {
key: "409"
value: {
description: "The organization to create already exists.";
}
};
};
} }
// Update Organization // Update Organization
@@ -136,7 +151,7 @@ service OrganizationService {
// - `org.write` // - `org.write`
rpc UpdateOrganization(UpdateOrganizationRequest) returns (UpdateOrganizationResponse) { rpc UpdateOrganization(UpdateOrganizationRequest) returns (UpdateOrganizationResponse) {
option (google.api.http) = { option (google.api.http) = {
put: "/v2beta/organizations/{id}" post: "/v2beta/organizations/{id}"
body: "*" body: "*"
}; };
@@ -145,6 +160,28 @@ service OrganizationService {
permission: "org.write" permission: "org.write"
} }
}; };
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
responses: {
key: "200";
value: {
description: "Organization created successfully";
};
};
responses: {
key: "404"
value: {
description: "Organisation's not found";
}
};
responses: {
key: "409"
value: {
description: "Organisation's name already taken";
}
};
};
} }
// List Organizations // List Organizations
@@ -164,17 +201,12 @@ service OrganizationService {
permission: "iam.read"; permission: "iam.read";
} }
}; };
// responses: {
// key: "400"; option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
// value: { responses: {
// description: "invalid list query"; key: "200";
// schema: { };
// json_schema: { };
// ref: "#/definitions/rpcStatus";
// };
// };
// };
// };
} }
// Delete Organization // Delete Organization
@@ -194,17 +226,20 @@ service OrganizationService {
} }
}; };
// responses: { option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
// key: "400"; responses: {
// value: { key: "200";
// description: "invalid org"; value: {
// schema: { description: "Organization created successfully";
// json_schema: { };
// ref: "#/definitions/rpcStatus"; };
// }; responses: {
// }; key: "404"
// }; value: {
// }; description: "Organisation's not found";
}
};
};
} }
// Set Organization Metadata // Set Organization Metadata
@@ -224,6 +259,19 @@ service OrganizationService {
permission: "org.write" permission: "org.write"
} }
}; };
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
responses: {
key: "200";
};
responses: {
// TODO This needs to chagne to 404
key: "400"
value: {
description: "Organisation's not found";
}
};
};
} }
// List Organization Metadata // List Organization Metadata
@@ -243,6 +291,12 @@ service OrganizationService {
} }
}; };
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
responses: {
key: "200";
};
};
} }
// Delete Organization Metadata // Delete Organization Metadata
@@ -262,6 +316,12 @@ service OrganizationService {
} }
}; };
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
responses: {
key: "200";
};
};
} }
// Add Organization Domain // Add Organization Domain
@@ -282,6 +342,18 @@ service OrganizationService {
} }
}; };
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
responses: {
key: "200";
};
responses: {
key: "409"
value: {
description: "Domain already exists";
}
};
};
} }
// List Organization Domains // List Organization Domains
@@ -302,6 +374,12 @@ service OrganizationService {
} }
}; };
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
responses: {
key: "200";
};
};
} }
// Delete Organization Domain // Delete Organization Domain
@@ -321,6 +399,12 @@ service OrganizationService {
} }
}; };
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
responses: {
key: "200";
};
};
} }
// Generate Organization Domain Validation // Generate Organization Domain Validation
@@ -341,6 +425,17 @@ service OrganizationService {
} }
}; };
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
responses: {
key: "200";
};
responses: {
key: "404"
value: {
description: "Domain doesn't exist on organization";
}
};
};
} }
// Verify Organization Domain // Verify Organization Domain
@@ -361,6 +456,11 @@ service OrganizationService {
} }
}; };
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
responses: {
key: "200";
};
};
} }
// Deactivate Organization // Deactivate Organization
@@ -381,6 +481,12 @@ service OrganizationService {
} }
}; };
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
responses: {
key: "200";
};
};
} }
// Activate Organization // Activate Organization
@@ -401,8 +507,15 @@ service OrganizationService {
} }
}; };
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
responses: {
key: "200";
};
};
} }
} }
message CreateOrganizationRequest{ message CreateOrganizationRequest{
@@ -646,7 +759,6 @@ message DeleteOrganizationDomainRequest {
min_length: 1; min_length: 1;
max_length: 200; max_length: 200;
example: "\"69629012906488334\""; example: "\"69629012906488334\"";
description: "Organization ID of the organization you want to delete."
} }
]; ];
string domain = 2 [ string domain = 2 [
@@ -748,7 +860,18 @@ message Metadata {
bytes value = 2 [(validate.rules).bytes = {min_len: 1, max_len: 500000}]; bytes value = 2 [(validate.rules).bytes = {min_len: 1, max_len: 500000}];
} }
message SetOrganizationMetadataRequest{ message SetOrganizationMetadataRequest{
string organization_id = 1; // Organization Id for the Organization doman to be verified.
string organization_id = 1 [
(validate.rules).string = {min_len: 1, max_len: 200},
(google.api.field_behavior) = REQUIRED,
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
min_length: 1;
max_length: 200;
example: "\"69629012906488334\"";
description: "Organization ID of the organization you want to veryify the domain on."
}
];
// Metadata to set.
repeated Metadata metadata = 2 [ repeated Metadata metadata = 2 [
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
title: "Medata (Key/Value)" title: "Medata (Key/Value)"