40073-vm/backend/src/db/seeders/20260515010000-subscription-plans.js
2026-05-25 13:04:02 +00:00

89 lines
2.3 KiB
JavaScript

const db = require('../models');
const PLAN_DATA = [
{
name: 'Starter',
slug: 'starter',
description: 'For solo builders who want a clean AI workspace and the basics of billing.',
price_monthly: 19,
currency: 'usd',
stripe_product_id: 'prod_mock_starter',
stripe_price_id: 'price_mock_starter_monthly',
message_limit: 300,
agent_limit: 3,
is_featured: false,
is_active: true,
features_json: JSON.stringify([
'300 AI messages every month',
'3 custom agents',
'Conversation history and export',
]),
},
{
name: 'Pro',
slug: 'pro',
description: 'For power users who need more throughput, better limits, and a polished workspace.',
price_monthly: 49,
currency: 'usd',
stripe_product_id: 'prod_mock_pro',
stripe_price_id: 'price_mock_pro_monthly',
message_limit: 1500,
agent_limit: 10,
is_featured: true,
is_active: true,
features_json: JSON.stringify([
'1,500 AI messages every month',
'10 custom agents',
'Priority billing support',
]),
},
{
name: 'Team',
slug: 'team',
description: 'For heavier shared use with room for more agents, more messages, and longer workflows.',
price_monthly: 149,
currency: 'usd',
stripe_product_id: 'prod_mock_team',
stripe_price_id: 'price_mock_team_monthly',
message_limit: 5000,
agent_limit: 30,
is_featured: false,
is_active: true,
features_json: JSON.stringify([
'5,000 AI messages every month',
'30 custom agents',
'Shared workspace billing controls',
]),
},
];
module.exports = {
async up() {
const adminUser = await db.users.findOne({
order: [['createdAt', 'ASC']],
});
for (const plan of PLAN_DATA) {
const [record] = await db.subscription_plans.findOrCreate({
where: {
slug: plan.slug,
},
defaults: {
...plan,
createdById: adminUser ? adminUser.id : null,
updatedById: adminUser ? adminUser.id : null,
},
});
await record.update({
...plan,
updatedById: adminUser ? adminUser.id : null,
});
}
},
async down(queryInterface) {
await queryInterface.bulkDelete('subscription_plans', null, {});
},
};