Skip to content

Commit e806c3a

Browse files
feat(frontier): add scope fields to preference messages (#441)
* feat(frontier): add scope fields to preference messages Add scope_type and scope_id fields to support org-scoped user preferences: - Preference message: add scope_type (field 6) and scope_id (field 7) - PreferenceRequestBody message: add scope_type (field 4) and scope_id (field 5) - ListCurrentUserPreferencesRequest message: add scope_type (field 1) and scope_id (field 2) These fields enable users to have different preference values per organization context while maintaining backward compatibility with global preferences (empty scope = global). Related: raystack/frontier#1347 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * feat(frontier): add scope fields to ListUserPreferencesRequest Add scope_type and scope_id fields to ListUserPreferencesRequest to allow filtering user preferences by scope context. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1 parent b1687af commit e806c3a

2 files changed

Lines changed: 30 additions & 1 deletion

File tree

raystack/frontier/v1beta1/frontier.proto

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4115,6 +4115,14 @@ message CreateUserPreferencesResponse {
41154115

41164116
message ListUserPreferencesRequest {
41174117
string id = 1 [(validate.rules).string.min_len = 3];
4118+
// scope_type filters preferences by context type (e.g., "app/organization")
4119+
// If empty, returns all user preferences (global + all scoped)
4120+
// If set with scope_id, returns preferences for the specific scope,
4121+
// with trait defaults for any unset preferences
4122+
string scope_type = 2;
4123+
// scope_id filters preferences by scope identifier (e.g., organization ID)
4124+
// Only applicable when scope_type is set
4125+
string scope_id = 3;
41184126
}
41194127

41204128
message ListUserPreferencesResponse {
@@ -4129,7 +4137,16 @@ message CreateCurrentUserPreferencesResponse {
41294137
repeated Preference preferences = 1;
41304138
}
41314139

4132-
message ListCurrentUserPreferencesRequest {}
4140+
message ListCurrentUserPreferencesRequest {
4141+
// scope_type filters preferences by context type (e.g., "app/organization")
4142+
// If empty, returns all user preferences (global + all scoped)
4143+
// If set with scope_id, returns global preferences + preferences for the specific scope,
4144+
// with trait defaults for any unset preferences
4145+
string scope_type = 1;
4146+
// scope_id filters preferences by scope identifier (e.g., organization ID)
4147+
// Only applicable when scope_type is set
4148+
string scope_id = 2;
4149+
}
41334150

41344151
message ListCurrentUserPreferencesResponse {
41354152
repeated Preference preferences = 1;

raystack/frontier/v1beta1/models.proto

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -555,6 +555,12 @@ message Preference {
555555
string value = 3;
556556
string resource_id = 4;
557557
string resource_type = 5;
558+
// scope_type defines the context type for scoped preferences (e.g., "app/organization")
559+
// If empty, the preference is global (not scoped to any context)
560+
string scope_type = 6;
561+
// scope_id is the identifier of the scope context (e.g., organization ID)
562+
// Only applicable when scope_type is set
563+
string scope_id = 7;
558564

559565
google.protobuf.Timestamp created_at = 10 [(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
560566
description: "The time when the preference was created.",
@@ -947,6 +953,12 @@ message PreferenceRequestBody {
947953
pattern: "^[A-Za-z0-9-_]+$"
948954
}];
949955
string value = 3;
956+
// scope_type defines the context type for scoped preferences (e.g., "app/organization")
957+
// If empty, the preference is global (not scoped to any context)
958+
string scope_type = 4;
959+
// scope_id is the identifier of the scope context (e.g., organization ID)
960+
// Only applicable when scope_type is set
961+
string scope_id = 5;
950962
}
951963

952964
message CheckoutSubscriptionBody {

0 commit comments

Comments
 (0)