fix bug 16 and 17
Build & Push / Pipeline Tests (push) Successful in 1m53s
Test / Type Check (all packages) (push) Successful in 56s
Build & Push / Build & Push Docker Image (push) Failing after 4m53s
Test / API Unit Tests (push) Successful in 1m15s
Test / Homepage Unit Tests (push) Successful in 46s
Test / Carplace Unit Tests (push) Successful in 41s
Test / Admin Unit Tests (push) Successful in 40s
Test / Dashboard Unit Tests (push) Successful in 42s
Test / API Integration Tests (push) Successful in 1m6s

This commit is contained in:
root
2026-08-04 00:52:58 -04:00
parent 626da23c2e
commit 149806a773
72 changed files with 834 additions and 174 deletions
@@ -0,0 +1 @@
ALTER TYPE "Plan" ADD VALUE IF NOT EXISTS 'ENTERPRISE';
@@ -0,0 +1,6 @@
-- Superseded by 20260803000000_add_enterprise_plan_enum and
-- 20260803001000_update_vehicle_plan_limits.
-- Kept as a no-op because this migration directory was created before the
-- enum/data migration was split, and Prisma requires every migration directory
-- to contain a migration.sql file.
SELECT 1;
@@ -0,0 +1,50 @@
UPDATE "plan_features"
SET "label" = 'Up to 25 vehicles', "updatedAt" = CURRENT_TIMESTAMP
WHERE "plan" = 'STARTER' AND "label" = 'Up to 10 vehicles';
UPDATE "plan_features"
SET "label" = 'Up to 75 vehicles', "updatedAt" = CURRENT_TIMESTAMP
WHERE "plan" = 'GROWTH' AND "label" = 'Up to 50 vehicles';
UPDATE "plan_features"
SET "label" = 'Up to 150 vehicles', "updatedAt" = CURRENT_TIMESTAMP
WHERE "plan" = 'PRO' AND "label" = 'Unlimited vehicles';
INSERT INTO "pricing_configs" ("id", "plan", "billingPeriod", "amount", "updatedAt")
VALUES
('prc_enterprise_monthly', 'ENTERPRISE', 'MONTHLY', 59900, NOW()),
('prc_enterprise_annual', 'ENTERPRISE', 'ANNUAL', 575040, NOW())
ON CONFLICT ("plan", "billingPeriod") DO UPDATE
SET
"amount" = EXCLUDED."amount",
"updatedAt" = EXCLUDED."updatedAt";
INSERT INTO "plan_features" ("id", "plan", "label", "sortOrder")
VALUES
('plf_enterprise_1', 'ENTERPRISE', '150+ vehicles', 10),
('plf_enterprise_2', 'ENTERPRISE', 'Unlimited user accounts', 20),
('plf_enterprise_3', 'ENTERPRISE', 'Advanced reports', 30),
('plf_enterprise_4', 'ENTERPRISE', 'API access', 40),
('plf_enterprise_5', 'ENTERPRISE', 'Dedicated support', 50)
ON CONFLICT ("id") DO UPDATE
SET
"label" = EXCLUDED."label",
"sortOrder" = EXCLUDED."sortOrder",
"updatedAt" = CURRENT_TIMESTAMP;
INSERT INTO "subscription_menu_items" ("id", "plan", "menuItemId", "displayOrder", "isActive", "createdAt", "updatedAt")
SELECT
'smi_enterprise_' || "menuItemId",
'ENTERPRISE'::"Plan",
"menuItemId",
"displayOrder",
"isActive",
CURRENT_TIMESTAMP,
CURRENT_TIMESTAMP
FROM "subscription_menu_items"
WHERE "plan" = 'PRO'
ON CONFLICT ("plan", "menuItemId") DO UPDATE
SET
"displayOrder" = EXCLUDED."displayOrder",
"isActive" = EXCLUDED."isActive",
"updatedAt" = CURRENT_TIMESTAMP;
+1
View File
@@ -25,6 +25,7 @@ enum Plan {
STARTER
GROWTH
PRO
ENTERPRISE
}
enum BillingPeriod {
+15 -3
View File
@@ -33,25 +33,36 @@ export const PLAN_PRICES: Record<string, Record<string, Record<string, number>>>
MONTHLY: { MAD: 39900 },
ANNUAL: { MAD: 383040 },
},
ENTERPRISE: {
MONTHLY: { MAD: 59900 },
ANNUAL: { MAD: 575040 },
},
}
export const PLAN_FEATURES: Record<string, string[]> = {
STARTER: [
'Up to 10 vehicles',
'Up to 25 vehicles',
'1 user account',
'Basic analytics',
'Carplace listing',
'Notification management',
],
GROWTH: [
'Up to 50 vehicles',
'Up to 75 vehicles',
'5 user accounts',
'Full analytics',
'Priority Carplace placement',
'Custom branding',
],
PRO: [
'Unlimited vehicles',
'Up to 150 vehicles',
'Unlimited user accounts',
'Advanced reports',
'API access',
'Dedicated support',
],
ENTERPRISE: [
'150+ vehicles',
'Unlimited user accounts',
'Advanced reports',
'API access',
@@ -70,6 +81,7 @@ export const PLAN_CAPABILITIES: Record<string, SubscriptionCapability[]> = {
STARTER: [SUBSCRIPTION_CAPABILITIES.NOTIFICATION_MANAGEMENT],
GROWTH: [SUBSCRIPTION_CAPABILITIES.NOTIFICATION_MANAGEMENT],
PRO: [SUBSCRIPTION_CAPABILITIES.NOTIFICATION_MANAGEMENT],
ENTERPRISE: [SUBSCRIPTION_CAPABILITIES.NOTIFICATION_MANAGEMENT],
}
export type Locale = 'en' | 'fr' | 'ar'