Seed default tags and categories for new tenants
New tenants auto-provisioned via hostname get 5 default tags (Bug, Feature, Enhancement, Urgent, Documentation) and 4 categories (Frontend, Backend, Design, Infrastructure). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -45,6 +45,16 @@ export async function resolveTenant(hostname: string): Promise<TenantInfo | null
|
||||
return tenant;
|
||||
}
|
||||
|
||||
const DEFAULT_TAGS = [
|
||||
{ name: 'Bug', color: '#ef4444' },
|
||||
{ name: 'Feature', color: '#3b82f6' },
|
||||
{ name: 'Enhancement', color: '#14b8a6' },
|
||||
{ name: 'Urgent', color: '#f97316' },
|
||||
{ name: 'Documentation', color: '#6b7280' }
|
||||
];
|
||||
|
||||
const DEFAULT_CATEGORIES = ['Frontend', 'Backend', 'Design', 'Infrastructure'];
|
||||
|
||||
async function autoProvisionTenant(host: string): Promise<TenantInfo> {
|
||||
// Any hostname that reaches this app was pointed here via DNS,
|
||||
// so it's intentional. Auto-create a tenant for it.
|
||||
@@ -57,6 +67,12 @@ async function autoProvisionTenant(host: string): Promise<TenantInfo> {
|
||||
slug,
|
||||
hostnames: {
|
||||
create: { hostname: host, isPrimary: true }
|
||||
},
|
||||
tags: {
|
||||
create: DEFAULT_TAGS
|
||||
},
|
||||
categories: {
|
||||
create: DEFAULT_CATEGORIES.map((n) => ({ name: n }))
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user