feat: add enabled column to UserFeatures and TeamFeatures for tri-state semantics (#25765)
* feat: add enabled column to UserFeatures and TeamFeatures for tri-state semantics - Add enabled Boolean column to UserFeatures model with default true - Add enabled Boolean column to TeamFeatures model with default true - Update FeaturesRepository to use tri-state semantics: - enabled=true: feature is explicitly enabled - enabled=false: feature is explicitly disabled (blocks inheritance) - No row: inherit from team/org level - Update SQL queries to check enabled=true for feature access - Add enableFeatureForTeam method to interface and implementation Co-Authored-By: [email protected] <[email protected]> * update comments * add integration tests * add more test * select enabled only * no @default(true) * fix types and tests * add missing enabled * add missing enabled * rename enableFeatureForTeam to updateFeatureForTeam and support FeatureState * refactor: rename updateFeatureForTeam to setTeamFeatureState Co-Authored-By: [email protected] <[email protected]> * fix integration test * fix tests * add more tests * add missing enabled --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
1 parent
056922b6ee
commit
cef8610925
27 files changed
+871
-93
No files matched your search
@@ -55,6 +55,7 @@ async function main() {
|
||||
teamId: org.id,
|
||||
featureId: "delegation-credential",
|
||||
},
|
||||
enabled: true,
|
||||
},
|
||||
});
|
||||
if (!delegationFeature) {
|
||||
@@ -64,6 +65,7 @@ async function main() {
|
||||
featureId: "delegation-credential",
|
||||
assignedAt: new Date(),
|
||||
assignedBy: "prepare-local-script",
|
||||
enabled: true,
|
||||
},
|
||||
});
|
||||
console.log("Created TeamFeatures: delegation-credential");
|
||||
@@ -78,6 +80,7 @@ async function main() {
|
||||
teamId: org.id,
|
||||
featureId: "calendar-cache",
|
||||
},
|
||||
enabled: true,
|
||||
},
|
||||
});
|
||||
if (!calendarCacheFeature) {
|
||||
@@ -87,6 +90,7 @@ async function main() {
|
||||
featureId: "calendar-cache",
|
||||
assignedAt: new Date(),
|
||||
assignedBy: "prepare-local-script",
|
||||
enabled: true,
|
||||
},
|
||||
});
|
||||
console.log("Created TeamFeatures: calendar-cache");
|
||||
|
||||
@@ -57,6 +57,7 @@ export async function createPBACOrganization() {
|
||||
teamId: organization.id,
|
||||
assignedBy: "system (Seed script)",
|
||||
assignedAt: new Date(),
|
||||
enabled: true,
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user