@nextsparkjs/theme-productivity 0.1.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +76 -0
- package/about.md +123 -0
- package/components/CardDetailModal.tsx +318 -0
- package/components/KanbanBoard.tsx +612 -0
- package/components/KanbanCard.tsx +218 -0
- package/components/KanbanColumn.tsx +264 -0
- package/components/SortableList.tsx +46 -0
- package/components/index.ts +4 -0
- package/config/app.config.ts +172 -0
- package/config/billing.config.ts +187 -0
- package/config/dashboard.config.ts +357 -0
- package/config/dev.config.ts +55 -0
- package/config/features.config.ts +256 -0
- package/config/flows.config.ts +484 -0
- package/config/permissions.config.ts +167 -0
- package/config/theme.config.ts +106 -0
- package/entities/boards/boards.config.ts +61 -0
- package/entities/boards/boards.fields.ts +154 -0
- package/entities/boards/boards.service.ts +256 -0
- package/entities/boards/boards.types.ts +57 -0
- package/entities/boards/messages/en.json +80 -0
- package/entities/boards/messages/es.json +80 -0
- package/entities/boards/migrations/001_boards_table.sql +83 -0
- package/entities/cards/cards.config.ts +61 -0
- package/entities/cards/cards.fields.ts +242 -0
- package/entities/cards/cards.service.ts +336 -0
- package/entities/cards/cards.types.ts +79 -0
- package/entities/cards/messages/en.json +114 -0
- package/entities/cards/messages/es.json +114 -0
- package/entities/cards/migrations/020_cards_table.sql +92 -0
- package/entities/lists/lists.config.ts +61 -0
- package/entities/lists/lists.fields.ts +105 -0
- package/entities/lists/lists.service.ts +252 -0
- package/entities/lists/lists.types.ts +55 -0
- package/entities/lists/messages/en.json +60 -0
- package/entities/lists/messages/es.json +60 -0
- package/entities/lists/migrations/010_lists_table.sql +79 -0
- package/lib/selectors.ts +206 -0
- package/messages/en.json +79 -0
- package/messages/es.json +79 -0
- package/migrations/999_theme_sample_data.sql +922 -0
- package/migrations/999a_initial_sample_data.sql +377 -0
- package/migrations/999b_abundant_sample_data.sql +346 -0
- package/package.json +17 -0
- package/permissions-matrix.md +122 -0
- package/styles/components.css +460 -0
- package/styles/globals.css +560 -0
- package/templates/dashboard/(main)/boards/[id]/[cardId]/page.tsx +238 -0
- package/templates/dashboard/(main)/boards/[id]/edit/page.tsx +390 -0
- package/templates/dashboard/(main)/boards/[id]/page.tsx +236 -0
- package/templates/dashboard/(main)/boards/create/page.tsx +236 -0
- package/templates/dashboard/(main)/boards/page.tsx +335 -0
- package/templates/dashboard/(main)/layout.tsx +32 -0
- package/templates/dashboard/(main)/page.tsx +592 -0
- package/templates/shared/ProductivityMobileNav.tsx +410 -0
- package/templates/shared/ProductivitySidebar.tsx +538 -0
- package/templates/shared/ProductivityTopBar.tsx +317 -0
|
@@ -0,0 +1,922 @@
|
|
|
1
|
+
-- ============================================================================
|
|
2
|
+
-- Productivity Theme - Sample Data Migration
|
|
3
|
+
-- Scenario: Multi-tenant workspace with multiple teams
|
|
4
|
+
-- Teams Mode: multi-tenant
|
|
5
|
+
--
|
|
6
|
+
-- Multi-tenant mode features:
|
|
7
|
+
-- - Multiple work teams (workspaces)
|
|
8
|
+
-- - Team switching enabled
|
|
9
|
+
-- - Can create new teams
|
|
10
|
+
-- - Invitations enabled (owner/admin can invite members)
|
|
11
|
+
-- ============================================================================
|
|
12
|
+
|
|
13
|
+
-- ============================================
|
|
14
|
+
-- STEP 0: CLEANUP (preserves superadmin)
|
|
15
|
+
-- ============================================
|
|
16
|
+
DO $$
|
|
17
|
+
DECLARE
|
|
18
|
+
v_superadmin_id TEXT;
|
|
19
|
+
BEGIN
|
|
20
|
+
-- Get superadmin ID to preserve
|
|
21
|
+
SELECT id INTO v_superadmin_id FROM "users" WHERE role = 'superadmin' LIMIT 1;
|
|
22
|
+
|
|
23
|
+
-- Clean theme entities (if tables exist)
|
|
24
|
+
IF EXISTS (SELECT 1 FROM information_schema.tables WHERE table_name = 'cards') THEN
|
|
25
|
+
TRUNCATE "cards" CASCADE;
|
|
26
|
+
END IF;
|
|
27
|
+
IF EXISTS (SELECT 1 FROM information_schema.tables WHERE table_name = 'lists') THEN
|
|
28
|
+
TRUNCATE "lists" CASCADE;
|
|
29
|
+
END IF;
|
|
30
|
+
IF EXISTS (SELECT 1 FROM information_schema.tables WHERE table_name = 'boards') THEN
|
|
31
|
+
TRUNCATE "boards" CASCADE;
|
|
32
|
+
END IF;
|
|
33
|
+
IF EXISTS (SELECT 1 FROM information_schema.tables WHERE table_name = 'invoices') THEN
|
|
34
|
+
TRUNCATE "invoices" CASCADE;
|
|
35
|
+
END IF;
|
|
36
|
+
|
|
37
|
+
-- Clean team-related data (except superadmin's)
|
|
38
|
+
IF v_superadmin_id IS NOT NULL THEN
|
|
39
|
+
DELETE FROM "api_audit_log" WHERE "userId" != v_superadmin_id;
|
|
40
|
+
DELETE FROM "api_key" WHERE "userId" != v_superadmin_id;
|
|
41
|
+
DELETE FROM "team_members" WHERE "userId" != v_superadmin_id;
|
|
42
|
+
DELETE FROM "teams" WHERE "ownerId" != v_superadmin_id;
|
|
43
|
+
DELETE FROM "users_metas" WHERE "userId" != v_superadmin_id;
|
|
44
|
+
DELETE FROM "session" WHERE "userId" != v_superadmin_id;
|
|
45
|
+
DELETE FROM "account" WHERE "userId" != v_superadmin_id;
|
|
46
|
+
DELETE FROM "users" WHERE id != v_superadmin_id;
|
|
47
|
+
ELSE
|
|
48
|
+
DELETE FROM "api_audit_log";
|
|
49
|
+
DELETE FROM "api_key";
|
|
50
|
+
DELETE FROM "team_members";
|
|
51
|
+
DELETE FROM "teams";
|
|
52
|
+
DELETE FROM "users_metas";
|
|
53
|
+
DELETE FROM "session";
|
|
54
|
+
DELETE FROM "account";
|
|
55
|
+
DELETE FROM "users";
|
|
56
|
+
END IF;
|
|
57
|
+
|
|
58
|
+
RAISE NOTICE 'Productivity theme cleanup complete. Superadmin preserved.';
|
|
59
|
+
END $$;
|
|
60
|
+
|
|
61
|
+
-- ============================================
|
|
62
|
+
-- STEP 1: CREATE USERS
|
|
63
|
+
-- ============================================
|
|
64
|
+
-- Multi-tenant mode: 4 users across 2 teams
|
|
65
|
+
-- Patricia (owner of both), Lucas (admin/member), Diana (member), Marcos (member)
|
|
66
|
+
|
|
67
|
+
INSERT INTO "users" (
|
|
68
|
+
id,
|
|
69
|
+
email,
|
|
70
|
+
name,
|
|
71
|
+
"firstName",
|
|
72
|
+
"lastName",
|
|
73
|
+
role,
|
|
74
|
+
"emailVerified",
|
|
75
|
+
language,
|
|
76
|
+
country,
|
|
77
|
+
timezone,
|
|
78
|
+
"createdAt",
|
|
79
|
+
"updatedAt"
|
|
80
|
+
) VALUES
|
|
81
|
+
-- PM / Team Lead (owner of both teams)
|
|
82
|
+
(
|
|
83
|
+
'usr-prod-pm-001',
|
|
84
|
+
'prod_owner_patricia@nextspark.dev',
|
|
85
|
+
'Patricia Torres',
|
|
86
|
+
'Patricia',
|
|
87
|
+
'Torres',
|
|
88
|
+
'member',
|
|
89
|
+
true,
|
|
90
|
+
'es',
|
|
91
|
+
'ES',
|
|
92
|
+
'Europe/Madrid',
|
|
93
|
+
NOW(),
|
|
94
|
+
NOW()
|
|
95
|
+
),
|
|
96
|
+
-- Developer (admin in Product Team, member in Marketing Hub)
|
|
97
|
+
(
|
|
98
|
+
'usr-prod-dev-001',
|
|
99
|
+
'prod_admin_member_lucas@nextspark.dev',
|
|
100
|
+
'Lucas Luna',
|
|
101
|
+
'Lucas',
|
|
102
|
+
'Luna',
|
|
103
|
+
'member',
|
|
104
|
+
true,
|
|
105
|
+
'es',
|
|
106
|
+
'AR',
|
|
107
|
+
'America/Argentina/Buenos_Aires',
|
|
108
|
+
NOW(),
|
|
109
|
+
NOW()
|
|
110
|
+
),
|
|
111
|
+
-- Designer (member in Product Team only)
|
|
112
|
+
(
|
|
113
|
+
'usr-prod-design-001',
|
|
114
|
+
'prod_member_diana@nextspark.dev',
|
|
115
|
+
'Diana Rios',
|
|
116
|
+
'Diana',
|
|
117
|
+
'Rios',
|
|
118
|
+
'member',
|
|
119
|
+
true,
|
|
120
|
+
'en',
|
|
121
|
+
'US',
|
|
122
|
+
'America/Los_Angeles',
|
|
123
|
+
NOW(),
|
|
124
|
+
NOW()
|
|
125
|
+
),
|
|
126
|
+
-- Marketing (member in Marketing Hub only)
|
|
127
|
+
(
|
|
128
|
+
'usr-prod-mkt-001',
|
|
129
|
+
'prod_member_marcos@nextspark.dev',
|
|
130
|
+
'Marcos Silva',
|
|
131
|
+
'Marcos',
|
|
132
|
+
'Silva',
|
|
133
|
+
'member',
|
|
134
|
+
true,
|
|
135
|
+
'es',
|
|
136
|
+
'MX',
|
|
137
|
+
'America/Mexico_City',
|
|
138
|
+
NOW(),
|
|
139
|
+
NOW()
|
|
140
|
+
)
|
|
141
|
+
ON CONFLICT (email) DO NOTHING;
|
|
142
|
+
|
|
143
|
+
-- ============================================
|
|
144
|
+
-- STEP 2: CREATE TEAMS
|
|
145
|
+
-- ============================================
|
|
146
|
+
-- Multi-tenant mode: TWO work teams
|
|
147
|
+
-- Product Team for development, Marketing Hub for marketing campaigns
|
|
148
|
+
|
|
149
|
+
INSERT INTO "teams" (
|
|
150
|
+
id,
|
|
151
|
+
name,
|
|
152
|
+
slug,
|
|
153
|
+
description,
|
|
154
|
+
"ownerId",
|
|
155
|
+
"createdAt",
|
|
156
|
+
"updatedAt"
|
|
157
|
+
) VALUES
|
|
158
|
+
-- Product Team (Patricia is owner)
|
|
159
|
+
(
|
|
160
|
+
'team-prod-product',
|
|
161
|
+
'Product Team',
|
|
162
|
+
'product-team',
|
|
163
|
+
'Collaborative workspace for the product team',
|
|
164
|
+
'usr-prod-pm-001',
|
|
165
|
+
NOW(),
|
|
166
|
+
NOW()
|
|
167
|
+
),
|
|
168
|
+
-- Marketing Hub (Patricia is owner)
|
|
169
|
+
(
|
|
170
|
+
'team-prod-marketing',
|
|
171
|
+
'Marketing Hub',
|
|
172
|
+
'marketing-hub',
|
|
173
|
+
'Creative workspace for marketing campaigns',
|
|
174
|
+
'usr-prod-pm-001',
|
|
175
|
+
NOW(),
|
|
176
|
+
NOW()
|
|
177
|
+
)
|
|
178
|
+
ON CONFLICT (id) DO NOTHING;
|
|
179
|
+
|
|
180
|
+
-- ============================================
|
|
181
|
+
-- STEP 3: CREATE TEAM MEMBERSHIPS
|
|
182
|
+
-- ============================================
|
|
183
|
+
-- Multi-tenant mode: Users have different roles in different teams
|
|
184
|
+
-- Lucas has admin in Product Team but member in Marketing Hub
|
|
185
|
+
|
|
186
|
+
INSERT INTO "team_members" (
|
|
187
|
+
id,
|
|
188
|
+
"teamId",
|
|
189
|
+
"userId",
|
|
190
|
+
role,
|
|
191
|
+
"invitedBy",
|
|
192
|
+
"joinedAt"
|
|
193
|
+
) VALUES
|
|
194
|
+
-- Product Team memberships
|
|
195
|
+
('tm-prod-pm-shared-001', 'team-prod-product', 'usr-prod-pm-001', 'owner', NULL, NOW()),
|
|
196
|
+
('tm-prod-dev-shared-001', 'team-prod-product', 'usr-prod-dev-001', 'admin', 'usr-prod-pm-001', NOW()),
|
|
197
|
+
('tm-prod-design-shared-001', 'team-prod-product', 'usr-prod-design-001', 'member', 'usr-prod-pm-001', NOW()),
|
|
198
|
+
-- Marketing Hub memberships
|
|
199
|
+
('tm-mkt-pm-001', 'team-prod-marketing', 'usr-prod-pm-001', 'owner', NULL, NOW()),
|
|
200
|
+
('tm-mkt-dev-001', 'team-prod-marketing', 'usr-prod-dev-001', 'member', 'usr-prod-pm-001', NOW()),
|
|
201
|
+
('tm-mkt-marcos-001', 'team-prod-marketing', 'usr-prod-mkt-001', 'member', 'usr-prod-pm-001', NOW())
|
|
202
|
+
ON CONFLICT (id) DO NOTHING;
|
|
203
|
+
|
|
204
|
+
-- ============================================
|
|
205
|
+
-- STEP 4: CREATE ACCOUNTS (Password: Test1234)
|
|
206
|
+
-- ============================================
|
|
207
|
+
|
|
208
|
+
INSERT INTO "account" (
|
|
209
|
+
id,
|
|
210
|
+
"userId",
|
|
211
|
+
"accountId",
|
|
212
|
+
"providerId",
|
|
213
|
+
"accessToken",
|
|
214
|
+
"refreshToken",
|
|
215
|
+
"idToken",
|
|
216
|
+
"accessTokenExpiresAt",
|
|
217
|
+
"refreshTokenExpiresAt",
|
|
218
|
+
"scope",
|
|
219
|
+
"password",
|
|
220
|
+
"createdAt",
|
|
221
|
+
"updatedAt"
|
|
222
|
+
) VALUES
|
|
223
|
+
(
|
|
224
|
+
'acc-prod-pm-001',
|
|
225
|
+
'usr-prod-pm-001',
|
|
226
|
+
'prod_owner_patricia@nextspark.dev',
|
|
227
|
+
'credential',
|
|
228
|
+
NULL, NULL, NULL, NULL, NULL, NULL,
|
|
229
|
+
'3db9e98e2b4d3caca97fdf2783791cbc:34b293de615caf277a237773208858e960ea8aa10f1f5c5c309b632f192cac34d52ceafbd338385616f4929e4b1b6c055b67429c6722ffdb80b01d9bf4764866',
|
|
230
|
+
NOW(),
|
|
231
|
+
NOW()
|
|
232
|
+
),
|
|
233
|
+
(
|
|
234
|
+
'acc-prod-dev-001',
|
|
235
|
+
'usr-prod-dev-001',
|
|
236
|
+
'prod_admin_member_lucas@nextspark.dev',
|
|
237
|
+
'credential',
|
|
238
|
+
NULL, NULL, NULL, NULL, NULL, NULL,
|
|
239
|
+
'3db9e98e2b4d3caca97fdf2783791cbc:34b293de615caf277a237773208858e960ea8aa10f1f5c5c309b632f192cac34d52ceafbd338385616f4929e4b1b6c055b67429c6722ffdb80b01d9bf4764866',
|
|
240
|
+
NOW(),
|
|
241
|
+
NOW()
|
|
242
|
+
),
|
|
243
|
+
(
|
|
244
|
+
'acc-prod-design-001',
|
|
245
|
+
'usr-prod-design-001',
|
|
246
|
+
'prod_member_diana@nextspark.dev',
|
|
247
|
+
'credential',
|
|
248
|
+
NULL, NULL, NULL, NULL, NULL, NULL,
|
|
249
|
+
'3db9e98e2b4d3caca97fdf2783791cbc:34b293de615caf277a237773208858e960ea8aa10f1f5c5c309b632f192cac34d52ceafbd338385616f4929e4b1b6c055b67429c6722ffdb80b01d9bf4764866',
|
|
250
|
+
NOW(),
|
|
251
|
+
NOW()
|
|
252
|
+
),
|
|
253
|
+
(
|
|
254
|
+
'acc-prod-mkt-001',
|
|
255
|
+
'usr-prod-mkt-001',
|
|
256
|
+
'prod_member_marcos@nextspark.dev',
|
|
257
|
+
'credential',
|
|
258
|
+
NULL, NULL, NULL, NULL, NULL, NULL,
|
|
259
|
+
'3db9e98e2b4d3caca97fdf2783791cbc:34b293de615caf277a237773208858e960ea8aa10f1f5c5c309b632f192cac34d52ceafbd338385616f4929e4b1b6c055b67429c6722ffdb80b01d9bf4764866',
|
|
260
|
+
NOW(),
|
|
261
|
+
NOW()
|
|
262
|
+
)
|
|
263
|
+
ON CONFLICT ("providerId", "accountId") DO NOTHING;
|
|
264
|
+
|
|
265
|
+
-- ============================================
|
|
266
|
+
-- STEP 5: CREATE USER METADATA
|
|
267
|
+
-- ============================================
|
|
268
|
+
-- Set active team for each user
|
|
269
|
+
|
|
270
|
+
INSERT INTO "users_metas" (
|
|
271
|
+
"userId",
|
|
272
|
+
"metaKey",
|
|
273
|
+
"metaValue",
|
|
274
|
+
"dataType",
|
|
275
|
+
"isPublic",
|
|
276
|
+
"isSearchable",
|
|
277
|
+
"createdAt",
|
|
278
|
+
"updatedAt"
|
|
279
|
+
) VALUES
|
|
280
|
+
-- PM starts in Product Team
|
|
281
|
+
('usr-prod-pm-001', 'activeTeamId', '"team-prod-product"', 'json', false, false, NOW(), NOW()),
|
|
282
|
+
('usr-prod-pm-001', 'uiPreferences', '{"theme": "light", "sidebarCollapsed": false}', 'json', false, false, NOW(), NOW()),
|
|
283
|
+
-- Dev starts in Product Team
|
|
284
|
+
('usr-prod-dev-001', 'activeTeamId', '"team-prod-product"', 'json', false, false, NOW(), NOW()),
|
|
285
|
+
('usr-prod-dev-001', 'uiPreferences', '{"theme": "dark", "sidebarCollapsed": false}', 'json', false, false, NOW(), NOW()),
|
|
286
|
+
-- Designer starts in Product Team
|
|
287
|
+
('usr-prod-design-001', 'activeTeamId', '"team-prod-product"', 'json', false, false, NOW(), NOW()),
|
|
288
|
+
('usr-prod-design-001', 'uiPreferences', '{"theme": "light", "sidebarCollapsed": false}', 'json', false, false, NOW(), NOW()),
|
|
289
|
+
-- Marketing starts in Marketing Hub
|
|
290
|
+
('usr-prod-mkt-001', 'activeTeamId', '"team-prod-marketing"', 'json', false, false, NOW(), NOW()),
|
|
291
|
+
('usr-prod-mkt-001', 'uiPreferences', '{"theme": "light", "sidebarCollapsed": false}', 'json', false, false, NOW(), NOW())
|
|
292
|
+
ON CONFLICT ("userId", "metaKey") DO NOTHING;
|
|
293
|
+
|
|
294
|
+
-- ============================================
|
|
295
|
+
-- STEP 6: CREATE API KEYS
|
|
296
|
+
-- ============================================
|
|
297
|
+
|
|
298
|
+
INSERT INTO "api_key" (
|
|
299
|
+
id,
|
|
300
|
+
"userId",
|
|
301
|
+
name,
|
|
302
|
+
"keyHash",
|
|
303
|
+
"keyPrefix",
|
|
304
|
+
scopes,
|
|
305
|
+
"expiresAt",
|
|
306
|
+
"createdAt",
|
|
307
|
+
"updatedAt",
|
|
308
|
+
status
|
|
309
|
+
) VALUES
|
|
310
|
+
(
|
|
311
|
+
'apikey-prod-pm-001',
|
|
312
|
+
'usr-prod-pm-001',
|
|
313
|
+
'PM API Key',
|
|
314
|
+
'a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2',
|
|
315
|
+
'testkey_prod001',
|
|
316
|
+
ARRAY['boards:read', 'boards:write', 'boards:delete', 'lists:read', 'lists:write', 'cards:read', 'cards:write'],
|
|
317
|
+
NULL,
|
|
318
|
+
NOW(),
|
|
319
|
+
NOW(),
|
|
320
|
+
'active'
|
|
321
|
+
),
|
|
322
|
+
(
|
|
323
|
+
'apikey-prod-dev-001',
|
|
324
|
+
'usr-prod-dev-001',
|
|
325
|
+
'Dev API Key',
|
|
326
|
+
'b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3',
|
|
327
|
+
'testkey_prod002',
|
|
328
|
+
ARRAY['boards:read', 'boards:write', 'lists:read', 'lists:write', 'cards:read', 'cards:write'],
|
|
329
|
+
NULL,
|
|
330
|
+
NOW(),
|
|
331
|
+
NOW(),
|
|
332
|
+
'active'
|
|
333
|
+
),
|
|
334
|
+
(
|
|
335
|
+
'apikey-prod-design-001',
|
|
336
|
+
'usr-prod-design-001',
|
|
337
|
+
'Designer API Key',
|
|
338
|
+
'c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4',
|
|
339
|
+
'testkey_prod003',
|
|
340
|
+
ARRAY['boards:read', 'lists:read', 'cards:read', 'cards:write'],
|
|
341
|
+
NULL,
|
|
342
|
+
NOW(),
|
|
343
|
+
NOW(),
|
|
344
|
+
'active'
|
|
345
|
+
)
|
|
346
|
+
ON CONFLICT (id) DO NOTHING;
|
|
347
|
+
|
|
348
|
+
-- ============================================
|
|
349
|
+
-- STEP 8: CREATE INVOICES
|
|
350
|
+
-- ============================================
|
|
351
|
+
-- Pro Plan subscription: $29/month (coherent with subscriptions)
|
|
352
|
+
-- Product Team: 6 months history
|
|
353
|
+
-- Marketing Hub: 6 months history
|
|
354
|
+
|
|
355
|
+
INSERT INTO "invoices" (
|
|
356
|
+
id,
|
|
357
|
+
"teamId",
|
|
358
|
+
"invoiceNumber",
|
|
359
|
+
date,
|
|
360
|
+
amount,
|
|
361
|
+
currency,
|
|
362
|
+
status,
|
|
363
|
+
"pdfUrl",
|
|
364
|
+
description
|
|
365
|
+
) VALUES
|
|
366
|
+
-- Product Team - 6 months of subscription history ($29/month Pro Plan)
|
|
367
|
+
('inv-prod-001', 'team-prod-product', 'INV-PROD-001',
|
|
368
|
+
NOW() - INTERVAL '5 months', 29.00, 'USD', 'paid',
|
|
369
|
+
'https://billing.example.com/invoices/inv-prod-001.pdf',
|
|
370
|
+
'Pro Plan - Monthly subscription'),
|
|
371
|
+
('inv-prod-002', 'team-prod-product', 'INV-PROD-002',
|
|
372
|
+
NOW() - INTERVAL '4 months', 29.00, 'USD', 'paid',
|
|
373
|
+
'https://billing.example.com/invoices/inv-prod-002.pdf',
|
|
374
|
+
'Pro Plan - Monthly subscription'),
|
|
375
|
+
('inv-prod-003', 'team-prod-product', 'INV-PROD-003',
|
|
376
|
+
NOW() - INTERVAL '3 months', 29.00, 'USD', 'paid',
|
|
377
|
+
'https://billing.example.com/invoices/inv-prod-003.pdf',
|
|
378
|
+
'Pro Plan - Monthly subscription'),
|
|
379
|
+
('inv-prod-004', 'team-prod-product', 'INV-PROD-004',
|
|
380
|
+
NOW() - INTERVAL '2 months', 29.00, 'USD', 'paid',
|
|
381
|
+
'https://billing.example.com/invoices/inv-prod-004.pdf',
|
|
382
|
+
'Pro Plan - Monthly subscription'),
|
|
383
|
+
('inv-prod-005', 'team-prod-product', 'INV-PROD-005',
|
|
384
|
+
NOW() - INTERVAL '1 month', 29.00, 'USD', 'paid',
|
|
385
|
+
'https://billing.example.com/invoices/inv-prod-005.pdf',
|
|
386
|
+
'Pro Plan - Monthly subscription'),
|
|
387
|
+
('inv-prod-006', 'team-prod-product', 'INV-PROD-006',
|
|
388
|
+
NOW(), 29.00, 'USD', 'pending',
|
|
389
|
+
NULL,
|
|
390
|
+
'Pro Plan - Monthly subscription'),
|
|
391
|
+
-- Marketing Hub - 6 months of subscription history ($29/month Pro Plan)
|
|
392
|
+
('inv-mkt-001', 'team-prod-marketing', 'INV-MKT-001',
|
|
393
|
+
NOW() - INTERVAL '5 months', 29.00, 'USD', 'paid',
|
|
394
|
+
'https://billing.example.com/invoices/inv-mkt-001.pdf',
|
|
395
|
+
'Pro Plan - Monthly subscription'),
|
|
396
|
+
('inv-mkt-002', 'team-prod-marketing', 'INV-MKT-002',
|
|
397
|
+
NOW() - INTERVAL '4 months', 29.00, 'USD', 'paid',
|
|
398
|
+
'https://billing.example.com/invoices/inv-mkt-002.pdf',
|
|
399
|
+
'Pro Plan - Monthly subscription'),
|
|
400
|
+
('inv-mkt-003', 'team-prod-marketing', 'INV-MKT-003',
|
|
401
|
+
NOW() - INTERVAL '3 months', 29.00, 'USD', 'paid',
|
|
402
|
+
'https://billing.example.com/invoices/inv-mkt-003.pdf',
|
|
403
|
+
'Pro Plan - Monthly subscription'),
|
|
404
|
+
('inv-mkt-004', 'team-prod-marketing', 'INV-MKT-004',
|
|
405
|
+
NOW() - INTERVAL '2 months', 29.00, 'USD', 'paid',
|
|
406
|
+
'https://billing.example.com/invoices/inv-mkt-004.pdf',
|
|
407
|
+
'Pro Plan - Monthly subscription'),
|
|
408
|
+
('inv-mkt-005', 'team-prod-marketing', 'INV-MKT-005',
|
|
409
|
+
NOW() - INTERVAL '1 month', 29.00, 'USD', 'paid',
|
|
410
|
+
'https://billing.example.com/invoices/inv-mkt-005.pdf',
|
|
411
|
+
'Pro Plan - Monthly subscription'),
|
|
412
|
+
('inv-mkt-006', 'team-prod-marketing', 'INV-MKT-006',
|
|
413
|
+
NOW(), 29.00, 'USD', 'pending',
|
|
414
|
+
NULL,
|
|
415
|
+
'Pro Plan - Monthly subscription')
|
|
416
|
+
ON CONFLICT (id) DO NOTHING;
|
|
417
|
+
|
|
418
|
+
-- ============================================
|
|
419
|
+
-- STEP 9: CREATE MARKETING HUB BOARDS
|
|
420
|
+
-- ============================================
|
|
421
|
+
-- 2 boards for Marketing Hub team
|
|
422
|
+
|
|
423
|
+
INSERT INTO "boards" (
|
|
424
|
+
id,
|
|
425
|
+
"userId",
|
|
426
|
+
"teamId",
|
|
427
|
+
name,
|
|
428
|
+
description,
|
|
429
|
+
color,
|
|
430
|
+
position,
|
|
431
|
+
"createdAt",
|
|
432
|
+
"updatedAt"
|
|
433
|
+
) VALUES
|
|
434
|
+
-- Campaign Tracker board
|
|
435
|
+
(
|
|
436
|
+
'board-mkt-campaigns-001',
|
|
437
|
+
'usr-prod-pm-001',
|
|
438
|
+
'team-prod-marketing',
|
|
439
|
+
'Campaign Tracker',
|
|
440
|
+
'Track all marketing campaigns and their progress',
|
|
441
|
+
'blue',
|
|
442
|
+
100,
|
|
443
|
+
NOW(),
|
|
444
|
+
NOW()
|
|
445
|
+
),
|
|
446
|
+
-- Content Calendar board
|
|
447
|
+
(
|
|
448
|
+
'board-mkt-content-001',
|
|
449
|
+
'usr-prod-pm-001',
|
|
450
|
+
'team-prod-marketing',
|
|
451
|
+
'Content Calendar',
|
|
452
|
+
'Plan and schedule content across all channels',
|
|
453
|
+
'green',
|
|
454
|
+
200,
|
|
455
|
+
NOW(),
|
|
456
|
+
NOW()
|
|
457
|
+
)
|
|
458
|
+
ON CONFLICT (id) DO NOTHING;
|
|
459
|
+
|
|
460
|
+
-- ============================================
|
|
461
|
+
-- STEP 10: CREATE MARKETING HUB LISTS
|
|
462
|
+
-- ============================================
|
|
463
|
+
|
|
464
|
+
INSERT INTO "lists" (
|
|
465
|
+
id,
|
|
466
|
+
"boardId",
|
|
467
|
+
"userId",
|
|
468
|
+
"teamId",
|
|
469
|
+
name,
|
|
470
|
+
position,
|
|
471
|
+
"createdAt",
|
|
472
|
+
"updatedAt"
|
|
473
|
+
) VALUES
|
|
474
|
+
-- Campaign Tracker lists
|
|
475
|
+
('list-mkt-planning-001', 'board-mkt-campaigns-001', 'usr-prod-pm-001', 'team-prod-marketing', 'Planning', 100, NOW(), NOW()),
|
|
476
|
+
('list-mkt-inprogress-001', 'board-mkt-campaigns-001', 'usr-prod-pm-001', 'team-prod-marketing', 'In Progress', 200, NOW(), NOW()),
|
|
477
|
+
('list-mkt-completed-001', 'board-mkt-campaigns-001', 'usr-prod-pm-001', 'team-prod-marketing', 'Completed', 300, NOW(), NOW()),
|
|
478
|
+
-- Content Calendar lists
|
|
479
|
+
('list-mkt-ideas-001', 'board-mkt-content-001', 'usr-prod-pm-001', 'team-prod-marketing', 'Ideas', 100, NOW(), NOW()),
|
|
480
|
+
('list-mkt-drafts-001', 'board-mkt-content-001', 'usr-prod-pm-001', 'team-prod-marketing', 'Drafts', 200, NOW(), NOW()),
|
|
481
|
+
('list-mkt-published-001', 'board-mkt-content-001', 'usr-prod-pm-001', 'team-prod-marketing', 'Published', 300, NOW(), NOW())
|
|
482
|
+
ON CONFLICT (id) DO NOTHING;
|
|
483
|
+
|
|
484
|
+
-- ============================================
|
|
485
|
+
-- STEP 11: CREATE MARKETING HUB CARDS
|
|
486
|
+
-- ============================================
|
|
487
|
+
|
|
488
|
+
INSERT INTO "cards" (
|
|
489
|
+
id,
|
|
490
|
+
"listId",
|
|
491
|
+
"boardId",
|
|
492
|
+
"userId",
|
|
493
|
+
"teamId",
|
|
494
|
+
title,
|
|
495
|
+
description,
|
|
496
|
+
priority,
|
|
497
|
+
position,
|
|
498
|
+
"createdAt",
|
|
499
|
+
"updatedAt"
|
|
500
|
+
) VALUES
|
|
501
|
+
-- Campaign Tracker - Planning
|
|
502
|
+
('card-mkt-001', 'list-mkt-planning-001', 'board-mkt-campaigns-001', 'usr-prod-pm-001', 'team-prod-marketing', 'Q4 Social Media Campaign', 'Plan holiday social media strategy across all platforms', 'high', 100, NOW(), NOW()),
|
|
503
|
+
('card-mkt-002', 'list-mkt-planning-001', 'board-mkt-campaigns-001', 'usr-prod-mkt-001', 'team-prod-marketing', 'Influencer Partnerships', 'Research and reach out to potential influencers', 'medium', 200, NOW(), NOW()),
|
|
504
|
+
-- Campaign Tracker - In Progress
|
|
505
|
+
('card-mkt-003', 'list-mkt-inprogress-001', 'board-mkt-campaigns-001', 'usr-prod-pm-001', 'team-prod-marketing', 'Holiday Email Sequence', 'Create 5-email sequence for holiday promotions', 'high', 100, NOW(), NOW()),
|
|
506
|
+
('card-mkt-004', 'list-mkt-inprogress-001', 'board-mkt-campaigns-001', 'usr-prod-dev-001', 'team-prod-marketing', 'Product Launch Video', 'Edit and finalize product demo video', 'medium', 200, NOW(), NOW()),
|
|
507
|
+
-- Campaign Tracker - Completed
|
|
508
|
+
('card-mkt-005', 'list-mkt-completed-001', 'board-mkt-campaigns-001', 'usr-prod-pm-001', 'team-prod-marketing', 'Brand Refresh Assets', 'Update all brand assets with new guidelines', 'low', 100, NOW(), NOW()),
|
|
509
|
+
-- Content Calendar - Ideas
|
|
510
|
+
('card-mkt-006', 'list-mkt-ideas-001', 'board-mkt-content-001', 'usr-prod-mkt-001', 'team-prod-marketing', 'Blog: 2024 Trends Analysis', 'Write comprehensive analysis of industry trends', 'medium', 100, NOW(), NOW()),
|
|
511
|
+
('card-mkt-007', 'list-mkt-ideas-001', 'board-mkt-content-001', 'usr-prod-dev-001', 'team-prod-marketing', 'YouTube Tutorial Series', 'Create 5-part tutorial series for new users', 'low', 200, NOW(), NOW()),
|
|
512
|
+
-- Content Calendar - Drafts
|
|
513
|
+
('card-mkt-008', 'list-mkt-drafts-001', 'board-mkt-content-001', 'usr-prod-pm-001', 'team-prod-marketing', 'Twitter Thread: Product Features', 'Draft thread showcasing key features', 'medium', 100, NOW(), NOW()),
|
|
514
|
+
('card-mkt-009', 'list-mkt-drafts-001', 'board-mkt-content-001', 'usr-prod-mkt-001', 'team-prod-marketing', 'Newsletter: Monthly Digest', 'Compile top stories for monthly newsletter', 'high', 200, NOW(), NOW()),
|
|
515
|
+
-- Content Calendar - Published
|
|
516
|
+
('card-mkt-010', 'list-mkt-published-001', 'board-mkt-content-001', 'usr-prod-pm-001', 'team-prod-marketing', 'Case Study: Client Success', 'Published case study with Enterprise client', 'medium', 100, NOW(), NOW())
|
|
517
|
+
ON CONFLICT (id) DO NOTHING;
|
|
518
|
+
|
|
519
|
+
-- ============================================
|
|
520
|
+
-- STEP 12: SUBSCRIPTIONS (B2B multi-tenant - without userId)
|
|
521
|
+
-- ============================================
|
|
522
|
+
-- Note: Productivity theme is multi-tenant B2B - NO userId
|
|
523
|
+
-- Each team has its own subscription
|
|
524
|
+
-- IMPORTANT: Delete trigger-created free subscriptions before explicit INSERT
|
|
525
|
+
|
|
526
|
+
DELETE FROM public."subscriptions" WHERE "teamId" IN (
|
|
527
|
+
'team-prod-product', 'team-prod-marketing'
|
|
528
|
+
);
|
|
529
|
+
|
|
530
|
+
INSERT INTO public."subscriptions" (
|
|
531
|
+
id, "teamId", "planId", status,
|
|
532
|
+
"currentPeriodStart", "currentPeriodEnd", "billingInterval", "paymentProvider",
|
|
533
|
+
"externalSubscriptionId", "externalCustomerId", "createdAt"
|
|
534
|
+
) VALUES
|
|
535
|
+
-- Product Team → Pro Plan $29/mo (active, monthly)
|
|
536
|
+
('sub-prod-product', 'team-prod-product', 'plan_pro', 'active',
|
|
537
|
+
NOW() - INTERVAL '20 days', NOW() + INTERVAL '10 days', 'monthly', 'stripe',
|
|
538
|
+
'sub_stripe_product', 'cus_product', NOW() - INTERVAL '6 months'),
|
|
539
|
+
-- Marketing Hub → Pro Plan $29/mo (active, monthly)
|
|
540
|
+
('sub-prod-marketing', 'team-prod-marketing', 'plan_pro', 'active',
|
|
541
|
+
NOW() - INTERVAL '10 days', NOW() + INTERVAL '20 days', 'monthly', 'stripe',
|
|
542
|
+
'sub_stripe_marketing', 'cus_marketing', NOW() - INTERVAL '6 months')
|
|
543
|
+
ON CONFLICT (id) DO NOTHING;
|
|
544
|
+
|
|
545
|
+
-- ============================================
|
|
546
|
+
-- STEP 13: BILLING EVENTS
|
|
547
|
+
-- ============================================
|
|
548
|
+
|
|
549
|
+
INSERT INTO public."billing_events" (id, "subscriptionId", type, status, amount, currency, "createdAt")
|
|
550
|
+
VALUES
|
|
551
|
+
-- Product Team (6 meses @ $29)
|
|
552
|
+
('be-prod-001', 'sub-prod-product', 'payment', 'succeeded', 2900, 'usd', NOW() - INTERVAL '6 months'),
|
|
553
|
+
('be-prod-002', 'sub-prod-product', 'payment', 'succeeded', 2900, 'usd', NOW() - INTERVAL '5 months'),
|
|
554
|
+
('be-prod-003', 'sub-prod-product', 'payment', 'succeeded', 2900, 'usd', NOW() - INTERVAL '4 months'),
|
|
555
|
+
('be-prod-004', 'sub-prod-product', 'payment', 'succeeded', 2900, 'usd', NOW() - INTERVAL '3 months'),
|
|
556
|
+
('be-prod-005', 'sub-prod-product', 'payment', 'succeeded', 2900, 'usd', NOW() - INTERVAL '2 months'),
|
|
557
|
+
('be-prod-006', 'sub-prod-product', 'payment', 'succeeded', 2900, 'usd', NOW() - INTERVAL '1 month'),
|
|
558
|
+
-- Marketing Hub (6 meses @ $29)
|
|
559
|
+
('be-mkt-001', 'sub-prod-marketing', 'payment', 'succeeded', 2900, 'usd', NOW() - INTERVAL '6 months'),
|
|
560
|
+
('be-mkt-002', 'sub-prod-marketing', 'payment', 'succeeded', 2900, 'usd', NOW() - INTERVAL '5 months'),
|
|
561
|
+
('be-mkt-003', 'sub-prod-marketing', 'payment', 'succeeded', 2900, 'usd', NOW() - INTERVAL '4 months'),
|
|
562
|
+
('be-mkt-004', 'sub-prod-marketing', 'payment', 'succeeded', 2900, 'usd', NOW() - INTERVAL '3 months'),
|
|
563
|
+
('be-mkt-005', 'sub-prod-marketing', 'payment', 'succeeded', 2900, 'usd', NOW() - INTERVAL '2 months'),
|
|
564
|
+
('be-mkt-006', 'sub-prod-marketing', 'payment', 'succeeded', 2900, 'usd', NOW() - INTERVAL '1 month')
|
|
565
|
+
ON CONFLICT (id) DO NOTHING;
|
|
566
|
+
|
|
567
|
+
-- ============================================
|
|
568
|
+
-- STEP 14: TEAM METADATA (multi-tenant workspace attributes)
|
|
569
|
+
-- ============================================
|
|
570
|
+
|
|
571
|
+
UPDATE public."teams" SET metadata = '{"workspaceType": "development", "boardCount": 0, "memberCount": 3}'::jsonb WHERE id = 'team-prod-product';
|
|
572
|
+
UPDATE public."teams" SET metadata = '{"workspaceType": "marketing", "boardCount": 2, "memberCount": 3}'::jsonb WHERE id = 'team-prod-marketing';
|
|
573
|
+
|
|
574
|
+
-- ============================================
|
|
575
|
+
-- STEP 15: 10 ADDITIONAL TEAMS (Multi-tenant B2B)
|
|
576
|
+
-- ============================================
|
|
577
|
+
-- Diverse scenarios: monthly/yearly, active/canceled/past_due/trialing/free
|
|
578
|
+
-- Each team has owner + 2-3 members
|
|
579
|
+
|
|
580
|
+
-- USERS for 10 new teams (30 users total: 10 owners + 20 members)
|
|
581
|
+
INSERT INTO "users" (
|
|
582
|
+
id, email, name, "firstName", "lastName", role,
|
|
583
|
+
"emailVerified", language, country, timezone, "createdAt", "updatedAt"
|
|
584
|
+
) VALUES
|
|
585
|
+
-- Team 3: Lambda Labs (Enterprise, yearly, active)
|
|
586
|
+
('usr-lambda-owner', 'lambda.owner@nextspark.dev', 'Sofia Lambda', 'Sofia', 'Lambda', 'member', true, 'en', 'US', 'America/New_York', NOW(), NOW()),
|
|
587
|
+
('usr-lambda-admin', 'lambda.admin@nextspark.dev', 'Carlos Lambda', 'Carlos', 'Admin', 'member', true, 'en', 'US', 'America/New_York', NOW(), NOW()),
|
|
588
|
+
('usr-lambda-member', 'lambda.member@nextspark.dev', 'Ana Lambda', 'Ana', 'Member', 'member', true, 'en', 'US', 'America/New_York', NOW(), NOW()),
|
|
589
|
+
|
|
590
|
+
-- Team 4: Mu Ventures (Enterprise, yearly, active)
|
|
591
|
+
('usr-mu-owner', 'mu.owner@nextspark.dev', 'Diego Mu', 'Diego', 'Mu', 'member', true, 'es', 'ES', 'Europe/Madrid', NOW(), NOW()),
|
|
592
|
+
('usr-mu-admin', 'mu.admin@nextspark.dev', 'Elena Mu', 'Elena', 'Admin', 'member', true, 'es', 'ES', 'Europe/Madrid', NOW(), NOW()),
|
|
593
|
+
('usr-mu-member', 'mu.member@nextspark.dev', 'Felix Mu', 'Felix', 'Member', 'member', true, 'es', 'ES', 'Europe/Madrid', NOW(), NOW()),
|
|
594
|
+
|
|
595
|
+
-- Team 5: Nu Digital (Pro, yearly, active)
|
|
596
|
+
('usr-nu-owner', 'nu.owner@nextspark.dev', 'Gabriel Nu', 'Gabriel', 'Nu', 'member', true, 'en', 'GB', 'Europe/London', NOW(), NOW()),
|
|
597
|
+
('usr-nu-admin', 'nu.admin@nextspark.dev', 'Helena Nu', 'Helena', 'Admin', 'member', true, 'en', 'GB', 'Europe/London', NOW(), NOW()),
|
|
598
|
+
('usr-nu-member', 'nu.member@nextspark.dev', 'Ivan Nu', 'Ivan', 'Member', 'member', true, 'en', 'GB', 'Europe/London', NOW(), NOW()),
|
|
599
|
+
|
|
600
|
+
-- Team 6: Xi Consulting (Pro, monthly, active)
|
|
601
|
+
('usr-xi-owner', 'xi.owner@nextspark.dev', 'Julia Xi', 'Julia', 'Xi', 'member', true, 'en', 'US', 'America/Chicago', NOW(), NOW()),
|
|
602
|
+
('usr-xi-admin', 'xi.admin@nextspark.dev', 'Kevin Xi', 'Kevin', 'Admin', 'member', true, 'en', 'US', 'America/Chicago', NOW(), NOW()),
|
|
603
|
+
('usr-xi-member', 'xi.member@nextspark.dev', 'Laura Xi', 'Laura', 'Member', 'member', true, 'en', 'US', 'America/Chicago', NOW(), NOW()),
|
|
604
|
+
|
|
605
|
+
-- Team 7: Omicron Tech (Pro, monthly, trialing)
|
|
606
|
+
('usr-omicron-owner', 'omicron.owner@nextspark.dev', 'Miguel Omicron', 'Miguel', 'Omicron', 'member', true, 'es', 'MX', 'America/Mexico_City', NOW(), NOW()),
|
|
607
|
+
('usr-omicron-admin', 'omicron.admin@nextspark.dev', 'Natalia Omicron', 'Natalia', 'Admin', 'member', true, 'es', 'MX', 'America/Mexico_City', NOW(), NOW()),
|
|
608
|
+
('usr-omicron-member', 'omicron.member@nextspark.dev', 'Oscar Omicron', 'Oscar', 'Member', 'member', true, 'es', 'MX', 'America/Mexico_City', NOW(), NOW()),
|
|
609
|
+
|
|
610
|
+
-- Team 8: Pi Systems (Pro, monthly, past_due)
|
|
611
|
+
('usr-pi-owner', 'pi.owner@nextspark.dev', 'Paula Pi', 'Paula', 'Pi', 'member', true, 'en', 'AU', 'Australia/Sydney', NOW(), NOW()),
|
|
612
|
+
('usr-pi-admin', 'pi.admin@nextspark.dev', 'Quentin Pi', 'Quentin', 'Admin', 'member', true, 'en', 'AU', 'Australia/Sydney', NOW(), NOW()),
|
|
613
|
+
('usr-pi-member', 'pi.member@nextspark.dev', 'Rosa Pi', 'Rosa', 'Member', 'member', true, 'en', 'AU', 'Australia/Sydney', NOW(), NOW()),
|
|
614
|
+
|
|
615
|
+
-- Team 9: Rho Analytics (Pro, monthly, canceled voluntary)
|
|
616
|
+
('usr-rho-owner', 'rho.owner@nextspark.dev', 'Samuel Rho', 'Samuel', 'Rho', 'member', true, 'en', 'CA', 'America/Toronto', NOW(), NOW()),
|
|
617
|
+
('usr-rho-admin', 'rho.admin@nextspark.dev', 'Teresa Rho', 'Teresa', 'Admin', 'member', true, 'en', 'CA', 'America/Toronto', NOW(), NOW()),
|
|
618
|
+
('usr-rho-member', 'rho.member@nextspark.dev', 'Ulises Rho', 'Ulises', 'Member', 'member', true, 'en', 'CA', 'America/Toronto', NOW(), NOW()),
|
|
619
|
+
|
|
620
|
+
-- Team 10: Sigma Media (Pro, yearly, canceled payment failed)
|
|
621
|
+
('usr-sigma-owner', 'sigma.owner@nextspark.dev', 'Valeria Sigma', 'Valeria', 'Sigma', 'member', true, 'es', 'AR', 'America/Argentina/Buenos_Aires', NOW(), NOW()),
|
|
622
|
+
('usr-sigma-admin', 'sigma.admin@nextspark.dev', 'Walter Sigma', 'Walter', 'Admin', 'member', true, 'es', 'AR', 'America/Argentina/Buenos_Aires', NOW(), NOW()),
|
|
623
|
+
('usr-sigma-member', 'sigma.member@nextspark.dev', 'Ximena Sigma', 'Ximena', 'Member', 'member', true, 'es', 'AR', 'America/Argentina/Buenos_Aires', NOW(), NOW()),
|
|
624
|
+
|
|
625
|
+
-- Team 11: Tau Engineering (Free, monthly, active)
|
|
626
|
+
('usr-tau-owner', 'tau.owner@nextspark.dev', 'Yolanda Tau', 'Yolanda', 'Tau', 'member', true, 'en', 'IN', 'Asia/Kolkata', NOW(), NOW()),
|
|
627
|
+
('usr-tau-admin', 'tau.admin@nextspark.dev', 'Zack Tau', 'Zack', 'Admin', 'member', true, 'en', 'IN', 'Asia/Kolkata', NOW(), NOW()),
|
|
628
|
+
('usr-tau-member', 'tau.member@nextspark.dev', 'Amanda Tau', 'Amanda', 'Member', 'member', true, 'en', 'IN', 'Asia/Kolkata', NOW(), NOW()),
|
|
629
|
+
|
|
630
|
+
-- Team 12: Upsilon Studios (Enterprise, monthly, active)
|
|
631
|
+
('usr-upsilon-owner', 'upsilon.owner@nextspark.dev', 'Bruno Upsilon', 'Bruno', 'Upsilon', 'member', true, 'en', 'DE', 'Europe/Berlin', NOW(), NOW()),
|
|
632
|
+
('usr-upsilon-admin', 'upsilon.admin@nextspark.dev', 'Claudia Upsilon', 'Claudia', 'Admin', 'member', true, 'en', 'DE', 'Europe/Berlin', NOW(), NOW()),
|
|
633
|
+
('usr-upsilon-member', 'upsilon.member@nextspark.dev', 'David Upsilon', 'David', 'Member', 'member', true, 'en', 'DE', 'Europe/Berlin', NOW(), NOW())
|
|
634
|
+
ON CONFLICT (email) DO NOTHING;
|
|
635
|
+
|
|
636
|
+
-- TEAMS for 10 new workspaces
|
|
637
|
+
INSERT INTO "teams" (id, name, slug, description, "ownerId", "createdAt", "updatedAt") VALUES
|
|
638
|
+
('team-lambda', 'Lambda Labs', 'lambda-labs', 'Enterprise R&D laboratory', 'usr-lambda-owner', NOW() - INTERVAL '18 months', NOW()),
|
|
639
|
+
('team-mu', 'Mu Ventures', 'mu-ventures', 'VC-backed startup incubator', 'usr-mu-owner', NOW() - INTERVAL '14 months', NOW()),
|
|
640
|
+
('team-nu', 'Nu Digital', 'nu-digital', 'Digital marketing agency', 'usr-nu-owner', NOW() - INTERVAL '10 months', NOW()),
|
|
641
|
+
('team-xi', 'Xi Consulting', 'xi-consulting', 'Business consulting firm', 'usr-xi-owner', NOW() - INTERVAL '8 months', NOW()),
|
|
642
|
+
('team-omicron', 'Omicron Tech', 'omicron-tech', 'Technology startup (trial)', 'usr-omicron-owner', NOW() - INTERVAL '10 days', NOW()),
|
|
643
|
+
('team-pi', 'Pi Systems', 'pi-systems', 'Systems integration company', 'usr-pi-owner', NOW() - INTERVAL '5 months', NOW()),
|
|
644
|
+
('team-rho', 'Rho Analytics', 'rho-analytics', 'Data analytics consultancy', 'usr-rho-owner', NOW() - INTERVAL '12 months', NOW()),
|
|
645
|
+
('team-sigma', 'Sigma Media', 'sigma-media', 'Media production company', 'usr-sigma-owner', NOW() - INTERVAL '16 months', NOW()),
|
|
646
|
+
('team-tau', 'Tau Engineering', 'tau-engineering', 'Engineering services (free tier)', 'usr-tau-owner', NOW() - INTERVAL '2 months', NOW()),
|
|
647
|
+
('team-upsilon', 'Upsilon Studios', 'upsilon-studios', 'Game development studio', 'usr-upsilon-owner', NOW() - INTERVAL '6 months', NOW())
|
|
648
|
+
ON CONFLICT (id) DO NOTHING;
|
|
649
|
+
|
|
650
|
+
-- TEAM_MEMBERS for 10 new teams (30 memberships)
|
|
651
|
+
INSERT INTO "team_members" (id, "teamId", "userId", role, "invitedBy", "joinedAt") VALUES
|
|
652
|
+
-- Lambda Labs
|
|
653
|
+
('tm-lambda-owner', 'team-lambda', 'usr-lambda-owner', 'owner', NULL, NOW() - INTERVAL '18 months'),
|
|
654
|
+
('tm-lambda-admin', 'team-lambda', 'usr-lambda-admin', 'admin', 'usr-lambda-owner', NOW() - INTERVAL '17 months'),
|
|
655
|
+
('tm-lambda-member', 'team-lambda', 'usr-lambda-member', 'member', 'usr-lambda-owner', NOW() - INTERVAL '16 months'),
|
|
656
|
+
-- Mu Ventures
|
|
657
|
+
('tm-mu-owner', 'team-mu', 'usr-mu-owner', 'owner', NULL, NOW() - INTERVAL '14 months'),
|
|
658
|
+
('tm-mu-admin', 'team-mu', 'usr-mu-admin', 'admin', 'usr-mu-owner', NOW() - INTERVAL '13 months'),
|
|
659
|
+
('tm-mu-member', 'team-mu', 'usr-mu-member', 'member', 'usr-mu-owner', NOW() - INTERVAL '12 months'),
|
|
660
|
+
-- Nu Digital
|
|
661
|
+
('tm-nu-owner', 'team-nu', 'usr-nu-owner', 'owner', NULL, NOW() - INTERVAL '10 months'),
|
|
662
|
+
('tm-nu-admin', 'team-nu', 'usr-nu-admin', 'admin', 'usr-nu-owner', NOW() - INTERVAL '9 months'),
|
|
663
|
+
('tm-nu-member', 'team-nu', 'usr-nu-member', 'member', 'usr-nu-owner', NOW() - INTERVAL '8 months'),
|
|
664
|
+
-- Xi Consulting
|
|
665
|
+
('tm-xi-owner', 'team-xi', 'usr-xi-owner', 'owner', NULL, NOW() - INTERVAL '8 months'),
|
|
666
|
+
('tm-xi-admin', 'team-xi', 'usr-xi-admin', 'admin', 'usr-xi-owner', NOW() - INTERVAL '7 months'),
|
|
667
|
+
('tm-xi-member', 'team-xi', 'usr-xi-member', 'member', 'usr-xi-owner', NOW() - INTERVAL '6 months'),
|
|
668
|
+
-- Omicron Tech (trial)
|
|
669
|
+
('tm-omicron-owner', 'team-omicron', 'usr-omicron-owner', 'owner', NULL, NOW() - INTERVAL '10 days'),
|
|
670
|
+
('tm-omicron-admin', 'team-omicron', 'usr-omicron-admin', 'admin', 'usr-omicron-owner', NOW() - INTERVAL '9 days'),
|
|
671
|
+
('tm-omicron-member', 'team-omicron', 'usr-omicron-member', 'member', 'usr-omicron-owner', NOW() - INTERVAL '8 days'),
|
|
672
|
+
-- Pi Systems (past_due)
|
|
673
|
+
('tm-pi-owner', 'team-pi', 'usr-pi-owner', 'owner', NULL, NOW() - INTERVAL '5 months'),
|
|
674
|
+
('tm-pi-admin', 'team-pi', 'usr-pi-admin', 'admin', 'usr-pi-owner', NOW() - INTERVAL '4 months'),
|
|
675
|
+
('tm-pi-member', 'team-pi', 'usr-pi-member', 'member', 'usr-pi-owner', NOW() - INTERVAL '3 months'),
|
|
676
|
+
-- Rho Analytics (canceled voluntary)
|
|
677
|
+
('tm-rho-owner', 'team-rho', 'usr-rho-owner', 'owner', NULL, NOW() - INTERVAL '12 months'),
|
|
678
|
+
('tm-rho-admin', 'team-rho', 'usr-rho-admin', 'admin', 'usr-rho-owner', NOW() - INTERVAL '11 months'),
|
|
679
|
+
('tm-rho-member', 'team-rho', 'usr-rho-member', 'member', 'usr-rho-owner', NOW() - INTERVAL '10 months'),
|
|
680
|
+
-- Sigma Media (canceled payment failed)
|
|
681
|
+
('tm-sigma-owner', 'team-sigma', 'usr-sigma-owner', 'owner', NULL, NOW() - INTERVAL '16 months'),
|
|
682
|
+
('tm-sigma-admin', 'team-sigma', 'usr-sigma-admin', 'admin', 'usr-sigma-owner', NOW() - INTERVAL '15 months'),
|
|
683
|
+
('tm-sigma-member', 'team-sigma', 'usr-sigma-member', 'member', 'usr-sigma-owner', NOW() - INTERVAL '14 months'),
|
|
684
|
+
-- Tau Engineering (free)
|
|
685
|
+
('tm-tau-owner', 'team-tau', 'usr-tau-owner', 'owner', NULL, NOW() - INTERVAL '2 months'),
|
|
686
|
+
('tm-tau-admin', 'team-tau', 'usr-tau-admin', 'admin', 'usr-tau-owner', NOW() - INTERVAL '6 weeks'),
|
|
687
|
+
('tm-tau-member', 'team-tau', 'usr-tau-member', 'member', 'usr-tau-owner', NOW() - INTERVAL '1 month'),
|
|
688
|
+
-- Upsilon Studios
|
|
689
|
+
('tm-upsilon-owner', 'team-upsilon', 'usr-upsilon-owner', 'owner', NULL, NOW() - INTERVAL '6 months'),
|
|
690
|
+
('tm-upsilon-admin', 'team-upsilon', 'usr-upsilon-admin', 'admin', 'usr-upsilon-owner', NOW() - INTERVAL '5 months'),
|
|
691
|
+
('tm-upsilon-member', 'team-upsilon', 'usr-upsilon-member', 'member', 'usr-upsilon-owner', NOW() - INTERVAL '4 months')
|
|
692
|
+
ON CONFLICT (id) DO NOTHING;
|
|
693
|
+
|
|
694
|
+
-- ACCOUNTS for 30 new users (Password: Test1234)
|
|
695
|
+
INSERT INTO "account" (
|
|
696
|
+
id, "userId", "accountId", "providerId",
|
|
697
|
+
"accessToken", "refreshToken", "idToken", "accessTokenExpiresAt", "refreshTokenExpiresAt", "scope",
|
|
698
|
+
"password", "createdAt", "updatedAt"
|
|
699
|
+
) VALUES
|
|
700
|
+
('acc-lambda-owner', 'usr-lambda-owner', 'lambda.owner@nextspark.dev', 'credential', NULL, NULL, NULL, NULL, NULL, NULL, '3db9e98e2b4d3caca97fdf2783791cbc:34b293de615caf277a237773208858e960ea8aa10f1f5c5c309b632f192cac34d52ceafbd338385616f4929e4b1b6c055b67429c6722ffdb80b01d9bf4764866', NOW(), NOW()),
|
|
701
|
+
('acc-lambda-admin', 'usr-lambda-admin', 'lambda.admin@nextspark.dev', 'credential', NULL, NULL, NULL, NULL, NULL, NULL, '3db9e98e2b4d3caca97fdf2783791cbc:34b293de615caf277a237773208858e960ea8aa10f1f5c5c309b632f192cac34d52ceafbd338385616f4929e4b1b6c055b67429c6722ffdb80b01d9bf4764866', NOW(), NOW()),
|
|
702
|
+
('acc-lambda-member', 'usr-lambda-member', 'lambda.member@nextspark.dev', 'credential', NULL, NULL, NULL, NULL, NULL, NULL, '3db9e98e2b4d3caca97fdf2783791cbc:34b293de615caf277a237773208858e960ea8aa10f1f5c5c309b632f192cac34d52ceafbd338385616f4929e4b1b6c055b67429c6722ffdb80b01d9bf4764866', NOW(), NOW()),
|
|
703
|
+
('acc-mu-owner', 'usr-mu-owner', 'mu.owner@nextspark.dev', 'credential', NULL, NULL, NULL, NULL, NULL, NULL, '3db9e98e2b4d3caca97fdf2783791cbc:34b293de615caf277a237773208858e960ea8aa10f1f5c5c309b632f192cac34d52ceafbd338385616f4929e4b1b6c055b67429c6722ffdb80b01d9bf4764866', NOW(), NOW()),
|
|
704
|
+
('acc-mu-admin', 'usr-mu-admin', 'mu.admin@nextspark.dev', 'credential', NULL, NULL, NULL, NULL, NULL, NULL, '3db9e98e2b4d3caca97fdf2783791cbc:34b293de615caf277a237773208858e960ea8aa10f1f5c5c309b632f192cac34d52ceafbd338385616f4929e4b1b6c055b67429c6722ffdb80b01d9bf4764866', NOW(), NOW()),
|
|
705
|
+
('acc-mu-member', 'usr-mu-member', 'mu.member@nextspark.dev', 'credential', NULL, NULL, NULL, NULL, NULL, NULL, '3db9e98e2b4d3caca97fdf2783791cbc:34b293de615caf277a237773208858e960ea8aa10f1f5c5c309b632f192cac34d52ceafbd338385616f4929e4b1b6c055b67429c6722ffdb80b01d9bf4764866', NOW(), NOW()),
|
|
706
|
+
('acc-nu-owner', 'usr-nu-owner', 'nu.owner@nextspark.dev', 'credential', NULL, NULL, NULL, NULL, NULL, NULL, '3db9e98e2b4d3caca97fdf2783791cbc:34b293de615caf277a237773208858e960ea8aa10f1f5c5c309b632f192cac34d52ceafbd338385616f4929e4b1b6c055b67429c6722ffdb80b01d9bf4764866', NOW(), NOW()),
|
|
707
|
+
('acc-nu-admin', 'usr-nu-admin', 'nu.admin@nextspark.dev', 'credential', NULL, NULL, NULL, NULL, NULL, NULL, '3db9e98e2b4d3caca97fdf2783791cbc:34b293de615caf277a237773208858e960ea8aa10f1f5c5c309b632f192cac34d52ceafbd338385616f4929e4b1b6c055b67429c6722ffdb80b01d9bf4764866', NOW(), NOW()),
|
|
708
|
+
('acc-nu-member', 'usr-nu-member', 'nu.member@nextspark.dev', 'credential', NULL, NULL, NULL, NULL, NULL, NULL, '3db9e98e2b4d3caca97fdf2783791cbc:34b293de615caf277a237773208858e960ea8aa10f1f5c5c309b632f192cac34d52ceafbd338385616f4929e4b1b6c055b67429c6722ffdb80b01d9bf4764866', NOW(), NOW()),
|
|
709
|
+
('acc-xi-owner', 'usr-xi-owner', 'xi.owner@nextspark.dev', 'credential', NULL, NULL, NULL, NULL, NULL, NULL, '3db9e98e2b4d3caca97fdf2783791cbc:34b293de615caf277a237773208858e960ea8aa10f1f5c5c309b632f192cac34d52ceafbd338385616f4929e4b1b6c055b67429c6722ffdb80b01d9bf4764866', NOW(), NOW()),
|
|
710
|
+
('acc-xi-admin', 'usr-xi-admin', 'xi.admin@nextspark.dev', 'credential', NULL, NULL, NULL, NULL, NULL, NULL, '3db9e98e2b4d3caca97fdf2783791cbc:34b293de615caf277a237773208858e960ea8aa10f1f5c5c309b632f192cac34d52ceafbd338385616f4929e4b1b6c055b67429c6722ffdb80b01d9bf4764866', NOW(), NOW()),
|
|
711
|
+
('acc-xi-member', 'usr-xi-member', 'xi.member@nextspark.dev', 'credential', NULL, NULL, NULL, NULL, NULL, NULL, '3db9e98e2b4d3caca97fdf2783791cbc:34b293de615caf277a237773208858e960ea8aa10f1f5c5c309b632f192cac34d52ceafbd338385616f4929e4b1b6c055b67429c6722ffdb80b01d9bf4764866', NOW(), NOW()),
|
|
712
|
+
('acc-omicron-owner', 'usr-omicron-owner', 'omicron.owner@nextspark.dev', 'credential', NULL, NULL, NULL, NULL, NULL, NULL, '3db9e98e2b4d3caca97fdf2783791cbc:34b293de615caf277a237773208858e960ea8aa10f1f5c5c309b632f192cac34d52ceafbd338385616f4929e4b1b6c055b67429c6722ffdb80b01d9bf4764866', NOW(), NOW()),
|
|
713
|
+
('acc-omicron-admin', 'usr-omicron-admin', 'omicron.admin@nextspark.dev', 'credential', NULL, NULL, NULL, NULL, NULL, NULL, '3db9e98e2b4d3caca97fdf2783791cbc:34b293de615caf277a237773208858e960ea8aa10f1f5c5c309b632f192cac34d52ceafbd338385616f4929e4b1b6c055b67429c6722ffdb80b01d9bf4764866', NOW(), NOW()),
|
|
714
|
+
('acc-omicron-member', 'usr-omicron-member', 'omicron.member@nextspark.dev', 'credential', NULL, NULL, NULL, NULL, NULL, NULL, '3db9e98e2b4d3caca97fdf2783791cbc:34b293de615caf277a237773208858e960ea8aa10f1f5c5c309b632f192cac34d52ceafbd338385616f4929e4b1b6c055b67429c6722ffdb80b01d9bf4764866', NOW(), NOW()),
|
|
715
|
+
('acc-pi-owner', 'usr-pi-owner', 'pi.owner@nextspark.dev', 'credential', NULL, NULL, NULL, NULL, NULL, NULL, '3db9e98e2b4d3caca97fdf2783791cbc:34b293de615caf277a237773208858e960ea8aa10f1f5c5c309b632f192cac34d52ceafbd338385616f4929e4b1b6c055b67429c6722ffdb80b01d9bf4764866', NOW(), NOW()),
|
|
716
|
+
('acc-pi-admin', 'usr-pi-admin', 'pi.admin@nextspark.dev', 'credential', NULL, NULL, NULL, NULL, NULL, NULL, '3db9e98e2b4d3caca97fdf2783791cbc:34b293de615caf277a237773208858e960ea8aa10f1f5c5c309b632f192cac34d52ceafbd338385616f4929e4b1b6c055b67429c6722ffdb80b01d9bf4764866', NOW(), NOW()),
|
|
717
|
+
('acc-pi-member', 'usr-pi-member', 'pi.member@nextspark.dev', 'credential', NULL, NULL, NULL, NULL, NULL, NULL, '3db9e98e2b4d3caca97fdf2783791cbc:34b293de615caf277a237773208858e960ea8aa10f1f5c5c309b632f192cac34d52ceafbd338385616f4929e4b1b6c055b67429c6722ffdb80b01d9bf4764866', NOW(), NOW()),
|
|
718
|
+
('acc-rho-owner', 'usr-rho-owner', 'rho.owner@nextspark.dev', 'credential', NULL, NULL, NULL, NULL, NULL, NULL, '3db9e98e2b4d3caca97fdf2783791cbc:34b293de615caf277a237773208858e960ea8aa10f1f5c5c309b632f192cac34d52ceafbd338385616f4929e4b1b6c055b67429c6722ffdb80b01d9bf4764866', NOW(), NOW()),
|
|
719
|
+
('acc-rho-admin', 'usr-rho-admin', 'rho.admin@nextspark.dev', 'credential', NULL, NULL, NULL, NULL, NULL, NULL, '3db9e98e2b4d3caca97fdf2783791cbc:34b293de615caf277a237773208858e960ea8aa10f1f5c5c309b632f192cac34d52ceafbd338385616f4929e4b1b6c055b67429c6722ffdb80b01d9bf4764866', NOW(), NOW()),
|
|
720
|
+
('acc-rho-member', 'usr-rho-member', 'rho.member@nextspark.dev', 'credential', NULL, NULL, NULL, NULL, NULL, NULL, '3db9e98e2b4d3caca97fdf2783791cbc:34b293de615caf277a237773208858e960ea8aa10f1f5c5c309b632f192cac34d52ceafbd338385616f4929e4b1b6c055b67429c6722ffdb80b01d9bf4764866', NOW(), NOW()),
|
|
721
|
+
('acc-sigma-owner', 'usr-sigma-owner', 'sigma.owner@nextspark.dev', 'credential', NULL, NULL, NULL, NULL, NULL, NULL, '3db9e98e2b4d3caca97fdf2783791cbc:34b293de615caf277a237773208858e960ea8aa10f1f5c5c309b632f192cac34d52ceafbd338385616f4929e4b1b6c055b67429c6722ffdb80b01d9bf4764866', NOW(), NOW()),
|
|
722
|
+
('acc-sigma-admin', 'usr-sigma-admin', 'sigma.admin@nextspark.dev', 'credential', NULL, NULL, NULL, NULL, NULL, NULL, '3db9e98e2b4d3caca97fdf2783791cbc:34b293de615caf277a237773208858e960ea8aa10f1f5c5c309b632f192cac34d52ceafbd338385616f4929e4b1b6c055b67429c6722ffdb80b01d9bf4764866', NOW(), NOW()),
|
|
723
|
+
('acc-sigma-member', 'usr-sigma-member', 'sigma.member@nextspark.dev', 'credential', NULL, NULL, NULL, NULL, NULL, NULL, '3db9e98e2b4d3caca97fdf2783791cbc:34b293de615caf277a237773208858e960ea8aa10f1f5c5c309b632f192cac34d52ceafbd338385616f4929e4b1b6c055b67429c6722ffdb80b01d9bf4764866', NOW(), NOW()),
|
|
724
|
+
('acc-tau-owner', 'usr-tau-owner', 'tau.owner@nextspark.dev', 'credential', NULL, NULL, NULL, NULL, NULL, NULL, '3db9e98e2b4d3caca97fdf2783791cbc:34b293de615caf277a237773208858e960ea8aa10f1f5c5c309b632f192cac34d52ceafbd338385616f4929e4b1b6c055b67429c6722ffdb80b01d9bf4764866', NOW(), NOW()),
|
|
725
|
+
('acc-tau-admin', 'usr-tau-admin', 'tau.admin@nextspark.dev', 'credential', NULL, NULL, NULL, NULL, NULL, NULL, '3db9e98e2b4d3caca97fdf2783791cbc:34b293de615caf277a237773208858e960ea8aa10f1f5c5c309b632f192cac34d52ceafbd338385616f4929e4b1b6c055b67429c6722ffdb80b01d9bf4764866', NOW(), NOW()),
|
|
726
|
+
('acc-tau-member', 'usr-tau-member', 'tau.member@nextspark.dev', 'credential', NULL, NULL, NULL, NULL, NULL, NULL, '3db9e98e2b4d3caca97fdf2783791cbc:34b293de615caf277a237773208858e960ea8aa10f1f5c5c309b632f192cac34d52ceafbd338385616f4929e4b1b6c055b67429c6722ffdb80b01d9bf4764866', NOW(), NOW()),
|
|
727
|
+
('acc-upsilon-owner', 'usr-upsilon-owner', 'upsilon.owner@nextspark.dev', 'credential', NULL, NULL, NULL, NULL, NULL, NULL, '3db9e98e2b4d3caca97fdf2783791cbc:34b293de615caf277a237773208858e960ea8aa10f1f5c5c309b632f192cac34d52ceafbd338385616f4929e4b1b6c055b67429c6722ffdb80b01d9bf4764866', NOW(), NOW()),
|
|
728
|
+
('acc-upsilon-admin', 'usr-upsilon-admin', 'upsilon.admin@nextspark.dev', 'credential', NULL, NULL, NULL, NULL, NULL, NULL, '3db9e98e2b4d3caca97fdf2783791cbc:34b293de615caf277a237773208858e960ea8aa10f1f5c5c309b632f192cac34d52ceafbd338385616f4929e4b1b6c055b67429c6722ffdb80b01d9bf4764866', NOW(), NOW()),
|
|
729
|
+
('acc-upsilon-member', 'usr-upsilon-member', 'upsilon.member@nextspark.dev', 'credential', NULL, NULL, NULL, NULL, NULL, NULL, '3db9e98e2b4d3caca97fdf2783791cbc:34b293de615caf277a237773208858e960ea8aa10f1f5c5c309b632f192cac34d52ceafbd338385616f4929e4b1b6c055b67429c6722ffdb80b01d9bf4764866', NOW(), NOW())
|
|
730
|
+
ON CONFLICT ("providerId", "accountId") DO NOTHING;
|
|
731
|
+
|
|
732
|
+
-- DELETE trigger-created subscriptions for new teams
|
|
733
|
+
DELETE FROM public."subscriptions" WHERE "teamId" IN (
|
|
734
|
+
'team-lambda', 'team-mu', 'team-nu', 'team-xi', 'team-omicron',
|
|
735
|
+
'team-pi', 'team-rho', 'team-sigma', 'team-tau', 'team-upsilon'
|
|
736
|
+
);
|
|
737
|
+
|
|
738
|
+
-- SUBSCRIPTIONS for 10 new teams (diverse scenarios)
|
|
739
|
+
INSERT INTO public."subscriptions" (
|
|
740
|
+
id, "teamId", "planId", status,
|
|
741
|
+
"currentPeriodStart", "currentPeriodEnd", "billingInterval",
|
|
742
|
+
"trialEndsAt", "canceledAt", "cancelAtPeriodEnd",
|
|
743
|
+
"paymentProvider", "externalSubscriptionId", "externalCustomerId", "createdAt"
|
|
744
|
+
) VALUES
|
|
745
|
+
-- Lambda Labs: Enterprise, yearly, active (18 months history)
|
|
746
|
+
('sub-lambda', 'team-lambda', 'plan_enterprise', 'active',
|
|
747
|
+
NOW() - INTERVAL '6 months', NOW() + INTERVAL '6 months', 'yearly',
|
|
748
|
+
NULL, NULL, false,
|
|
749
|
+
'stripe', 'sub_stripe_lambda', 'cus_lambda', NOW() - INTERVAL '18 months'),
|
|
750
|
+
|
|
751
|
+
-- Mu Ventures: Enterprise, yearly, active (14 months history)
|
|
752
|
+
('sub-mu', 'team-mu', 'plan_enterprise', 'active',
|
|
753
|
+
NOW() - INTERVAL '2 months', NOW() + INTERVAL '10 months', 'yearly',
|
|
754
|
+
NULL, NULL, false,
|
|
755
|
+
'stripe', 'sub_stripe_mu', 'cus_mu', NOW() - INTERVAL '14 months'),
|
|
756
|
+
|
|
757
|
+
-- Nu Digital: Pro, yearly, active (10 months history)
|
|
758
|
+
('sub-nu', 'team-nu', 'plan_pro', 'active',
|
|
759
|
+
NOW() - INTERVAL '10 months', NOW() + INTERVAL '2 months', 'yearly',
|
|
760
|
+
NULL, NULL, false,
|
|
761
|
+
'stripe', 'sub_stripe_nu', 'cus_nu', NOW() - INTERVAL '10 months'),
|
|
762
|
+
|
|
763
|
+
-- Xi Consulting: Pro, monthly, active (8 months history)
|
|
764
|
+
('sub-xi', 'team-xi', 'plan_pro', 'active',
|
|
765
|
+
NOW() - INTERVAL '15 days', NOW() + INTERVAL '15 days', 'monthly',
|
|
766
|
+
NULL, NULL, false,
|
|
767
|
+
'stripe', 'sub_stripe_xi', 'cus_xi', NOW() - INTERVAL '8 months'),
|
|
768
|
+
|
|
769
|
+
-- Omicron Tech: Pro, monthly, trialing (10 days old, trial ends in 4 days)
|
|
770
|
+
('sub-omicron', 'team-omicron', 'plan_pro', 'trialing',
|
|
771
|
+
NOW() - INTERVAL '10 days', NOW() + INTERVAL '20 days', 'monthly',
|
|
772
|
+
NOW() + INTERVAL '4 days', NULL, false,
|
|
773
|
+
'stripe', 'sub_stripe_omicron', 'cus_omicron', NOW() - INTERVAL '10 days'),
|
|
774
|
+
|
|
775
|
+
-- Pi Systems: Pro, monthly, past_due (payment failed 5 days ago)
|
|
776
|
+
('sub-pi', 'team-pi', 'plan_pro', 'past_due',
|
|
777
|
+
NOW() - INTERVAL '35 days', NOW() - INTERVAL '5 days', 'monthly',
|
|
778
|
+
NULL, NULL, false,
|
|
779
|
+
'stripe', 'sub_stripe_pi', 'cus_pi', NOW() - INTERVAL '5 months'),
|
|
780
|
+
|
|
781
|
+
-- Rho Analytics: Pro, monthly, canceled (voluntary, 8 months paid then canceled)
|
|
782
|
+
('sub-rho', 'team-rho', 'plan_pro', 'canceled',
|
|
783
|
+
NOW() - INTERVAL '2 months', NOW() - INTERVAL '1 month', 'monthly',
|
|
784
|
+
NULL, NOW() - INTERVAL '1 month', false,
|
|
785
|
+
'stripe', 'sub_stripe_rho', 'cus_rho', NOW() - INTERVAL '12 months'),
|
|
786
|
+
|
|
787
|
+
-- Sigma Media: Pro, yearly, canceled (payment failed after 1 year)
|
|
788
|
+
('sub-sigma', 'team-sigma', 'plan_pro', 'canceled',
|
|
789
|
+
NOW() - INTERVAL '4 months', NOW() - INTERVAL '2 weeks', 'yearly',
|
|
790
|
+
NULL, NOW() - INTERVAL '2 weeks', false,
|
|
791
|
+
'stripe', 'sub_stripe_sigma', 'cus_sigma', NOW() - INTERVAL '16 months'),
|
|
792
|
+
|
|
793
|
+
-- Tau Engineering: Free, monthly, active
|
|
794
|
+
('sub-tau', 'team-tau', 'plan_free', 'active',
|
|
795
|
+
NOW() - INTERVAL '2 months', NOW() + INTERVAL '28 days', 'monthly',
|
|
796
|
+
NULL, NULL, false,
|
|
797
|
+
NULL, NULL, NULL, NOW() - INTERVAL '2 months'),
|
|
798
|
+
|
|
799
|
+
-- Upsilon Studios: Enterprise, monthly, active (6 months history)
|
|
800
|
+
('sub-upsilon', 'team-upsilon', 'plan_enterprise', 'active',
|
|
801
|
+
NOW() - INTERVAL '10 days', NOW() + INTERVAL '20 days', 'monthly',
|
|
802
|
+
NULL, NULL, false,
|
|
803
|
+
'stripe', 'sub_stripe_upsilon', 'cus_upsilon', NOW() - INTERVAL '6 months')
|
|
804
|
+
ON CONFLICT (id) DO NOTHING;
|
|
805
|
+
|
|
806
|
+
-- BILLING EVENTS for 10 new teams (coherent payment history)
|
|
807
|
+
INSERT INTO public."billing_events" (id, "subscriptionId", type, status, amount, currency, "createdAt") VALUES
|
|
808
|
+
-- Lambda Labs: 2 yearly payments @ $4,990/yr (499000 cents)
|
|
809
|
+
('be-lambda-001', 'sub-lambda', 'payment', 'succeeded', 499000, 'usd', NOW() - INTERVAL '18 months'),
|
|
810
|
+
('be-lambda-002', 'sub-lambda', 'payment', 'succeeded', 499000, 'usd', NOW() - INTERVAL '6 months'),
|
|
811
|
+
|
|
812
|
+
-- Mu Ventures: 2 yearly payments @ $4,990/yr (499000 cents)
|
|
813
|
+
('be-mu-001', 'sub-mu', 'payment', 'succeeded', 499000, 'usd', NOW() - INTERVAL '14 months'),
|
|
814
|
+
('be-mu-002', 'sub-mu', 'payment', 'succeeded', 499000, 'usd', NOW() - INTERVAL '2 months'),
|
|
815
|
+
|
|
816
|
+
-- Nu Digital: 1 yearly payment @ $290/yr (29000 cents)
|
|
817
|
+
('be-nu-001', 'sub-nu', 'payment', 'succeeded', 29000, 'usd', NOW() - INTERVAL '10 months'),
|
|
818
|
+
|
|
819
|
+
-- Xi Consulting: 8 monthly payments @ $29/mo (2900 cents)
|
|
820
|
+
('be-xi-001', 'sub-xi', 'payment', 'succeeded', 2900, 'usd', NOW() - INTERVAL '8 months'),
|
|
821
|
+
('be-xi-002', 'sub-xi', 'payment', 'succeeded', 2900, 'usd', NOW() - INTERVAL '7 months'),
|
|
822
|
+
('be-xi-003', 'sub-xi', 'payment', 'succeeded', 2900, 'usd', NOW() - INTERVAL '6 months'),
|
|
823
|
+
('be-xi-004', 'sub-xi', 'payment', 'succeeded', 2900, 'usd', NOW() - INTERVAL '5 months'),
|
|
824
|
+
('be-xi-005', 'sub-xi', 'payment', 'succeeded', 2900, 'usd', NOW() - INTERVAL '4 months'),
|
|
825
|
+
('be-xi-006', 'sub-xi', 'payment', 'succeeded', 2900, 'usd', NOW() - INTERVAL '3 months'),
|
|
826
|
+
('be-xi-007', 'sub-xi', 'payment', 'succeeded', 2900, 'usd', NOW() - INTERVAL '2 months'),
|
|
827
|
+
('be-xi-008', 'sub-xi', 'payment', 'succeeded', 2900, 'usd', NOW() - INTERVAL '1 month'),
|
|
828
|
+
|
|
829
|
+
-- Omicron Tech: No payments (still in trial)
|
|
830
|
+
-- (no billing events)
|
|
831
|
+
|
|
832
|
+
-- Pi Systems: 4 successful + 1 failed payment @ $29/mo
|
|
833
|
+
('be-pi-001', 'sub-pi', 'payment', 'succeeded', 2900, 'usd', NOW() - INTERVAL '5 months'),
|
|
834
|
+
('be-pi-002', 'sub-pi', 'payment', 'succeeded', 2900, 'usd', NOW() - INTERVAL '4 months'),
|
|
835
|
+
('be-pi-003', 'sub-pi', 'payment', 'succeeded', 2900, 'usd', NOW() - INTERVAL '3 months'),
|
|
836
|
+
('be-pi-004', 'sub-pi', 'payment', 'succeeded', 2900, 'usd', NOW() - INTERVAL '2 months'),
|
|
837
|
+
('be-pi-005', 'sub-pi', 'payment', 'failed', 2900, 'usd', NOW() - INTERVAL '5 days'),
|
|
838
|
+
|
|
839
|
+
-- Rho Analytics: 8 successful then voluntary cancel @ $29/mo
|
|
840
|
+
-- (cancellation tracked in subscription.canceledAt, not in billing_events)
|
|
841
|
+
('be-rho-001', 'sub-rho', 'payment', 'succeeded', 2900, 'usd', NOW() - INTERVAL '12 months'),
|
|
842
|
+
('be-rho-002', 'sub-rho', 'payment', 'succeeded', 2900, 'usd', NOW() - INTERVAL '11 months'),
|
|
843
|
+
('be-rho-003', 'sub-rho', 'payment', 'succeeded', 2900, 'usd', NOW() - INTERVAL '10 months'),
|
|
844
|
+
('be-rho-004', 'sub-rho', 'payment', 'succeeded', 2900, 'usd', NOW() - INTERVAL '9 months'),
|
|
845
|
+
('be-rho-005', 'sub-rho', 'payment', 'succeeded', 2900, 'usd', NOW() - INTERVAL '8 months'),
|
|
846
|
+
('be-rho-006', 'sub-rho', 'payment', 'succeeded', 2900, 'usd', NOW() - INTERVAL '7 months'),
|
|
847
|
+
('be-rho-007', 'sub-rho', 'payment', 'succeeded', 2900, 'usd', NOW() - INTERVAL '6 months'),
|
|
848
|
+
('be-rho-008', 'sub-rho', 'payment', 'succeeded', 2900, 'usd', NOW() - INTERVAL '5 months'),
|
|
849
|
+
|
|
850
|
+
-- Sigma Media: 1 yearly payment + 1 failed renewal @ $290/yr
|
|
851
|
+
-- (cancellation tracked in subscription.canceledAt)
|
|
852
|
+
('be-sigma-001', 'sub-sigma', 'payment', 'succeeded', 29000, 'usd', NOW() - INTERVAL '16 months'),
|
|
853
|
+
('be-sigma-002', 'sub-sigma', 'payment', 'failed', 29000, 'usd', NOW() - INTERVAL '2 weeks'),
|
|
854
|
+
|
|
855
|
+
-- Tau Engineering: No payments (free plan)
|
|
856
|
+
-- (no billing events)
|
|
857
|
+
|
|
858
|
+
-- Upsilon Studios: 6 monthly payments @ $499/mo (49900 cents)
|
|
859
|
+
('be-upsilon-001', 'sub-upsilon', 'payment', 'succeeded', 49900, 'usd', NOW() - INTERVAL '6 months'),
|
|
860
|
+
('be-upsilon-002', 'sub-upsilon', 'payment', 'succeeded', 49900, 'usd', NOW() - INTERVAL '5 months'),
|
|
861
|
+
('be-upsilon-003', 'sub-upsilon', 'payment', 'succeeded', 49900, 'usd', NOW() - INTERVAL '4 months'),
|
|
862
|
+
('be-upsilon-004', 'sub-upsilon', 'payment', 'succeeded', 49900, 'usd', NOW() - INTERVAL '3 months'),
|
|
863
|
+
('be-upsilon-005', 'sub-upsilon', 'payment', 'succeeded', 49900, 'usd', NOW() - INTERVAL '2 months'),
|
|
864
|
+
('be-upsilon-006', 'sub-upsilon', 'payment', 'succeeded', 49900, 'usd', NOW() - INTERVAL '1 month')
|
|
865
|
+
ON CONFLICT (id) DO NOTHING;
|
|
866
|
+
|
|
867
|
+
-- TEAM METADATA for 10 new teams
|
|
868
|
+
UPDATE public."teams" SET metadata = '{"workspaceType": "research", "industry": "biotech", "memberCount": 3}'::jsonb WHERE id = 'team-lambda';
|
|
869
|
+
UPDATE public."teams" SET metadata = '{"workspaceType": "incubator", "industry": "fintech", "memberCount": 3}'::jsonb WHERE id = 'team-mu';
|
|
870
|
+
UPDATE public."teams" SET metadata = '{"workspaceType": "agency", "industry": "marketing", "memberCount": 3}'::jsonb WHERE id = 'team-nu';
|
|
871
|
+
UPDATE public."teams" SET metadata = '{"workspaceType": "consulting", "industry": "business", "memberCount": 3}'::jsonb WHERE id = 'team-xi';
|
|
872
|
+
UPDATE public."teams" SET metadata = '{"workspaceType": "startup", "industry": "saas", "memberCount": 3}'::jsonb WHERE id = 'team-omicron';
|
|
873
|
+
UPDATE public."teams" SET metadata = '{"workspaceType": "enterprise", "industry": "systems", "memberCount": 3}'::jsonb WHERE id = 'team-pi';
|
|
874
|
+
UPDATE public."teams" SET metadata = '{"workspaceType": "consultancy", "industry": "data", "memberCount": 3}'::jsonb WHERE id = 'team-rho';
|
|
875
|
+
UPDATE public."teams" SET metadata = '{"workspaceType": "production", "industry": "media", "memberCount": 3}'::jsonb WHERE id = 'team-sigma';
|
|
876
|
+
UPDATE public."teams" SET metadata = '{"workspaceType": "services", "industry": "engineering", "memberCount": 3}'::jsonb WHERE id = 'team-tau';
|
|
877
|
+
UPDATE public."teams" SET metadata = '{"workspaceType": "studio", "industry": "gaming", "memberCount": 3}'::jsonb WHERE id = 'team-upsilon';
|
|
878
|
+
|
|
879
|
+
-- ============================================
|
|
880
|
+
-- SUCCESS SUMMARY
|
|
881
|
+
-- ============================================
|
|
882
|
+
|
|
883
|
+
DO $$
|
|
884
|
+
BEGIN
|
|
885
|
+
RAISE NOTICE '';
|
|
886
|
+
RAISE NOTICE '═══════════════════════════════════════════════════════════';
|
|
887
|
+
RAISE NOTICE ' Productivity Theme Sample Data - Multi-Tenant Mode';
|
|
888
|
+
RAISE NOTICE '═══════════════════════════════════════════════════════════';
|
|
889
|
+
RAISE NOTICE '';
|
|
890
|
+
RAISE NOTICE ' 👥 ORIGINAL TEST USERS (password: Test1234):';
|
|
891
|
+
RAISE NOTICE ' prod_owner_patricia@nextspark.dev → owner (both teams)';
|
|
892
|
+
RAISE NOTICE ' prod_admin_member_lucas@nextspark.dev → admin (Product), member (Marketing)';
|
|
893
|
+
RAISE NOTICE ' prod_member_diana@nextspark.dev → member (Product only)';
|
|
894
|
+
RAISE NOTICE ' prod_member_marcos@nextspark.dev → member (Marketing only)';
|
|
895
|
+
RAISE NOTICE '';
|
|
896
|
+
RAISE NOTICE ' 🏢 ALL 12 TEAMS:';
|
|
897
|
+
RAISE NOTICE ' 1. Product Team - Pro $29/mo monthly active';
|
|
898
|
+
RAISE NOTICE ' 2. Marketing Hub - Pro $29/mo monthly active';
|
|
899
|
+
RAISE NOTICE ' 3. Lambda Labs - Ent $499/mo yearly active';
|
|
900
|
+
RAISE NOTICE ' 4. Mu Ventures - Ent $499/mo yearly active';
|
|
901
|
+
RAISE NOTICE ' 5. Nu Digital - Pro $29/mo yearly active';
|
|
902
|
+
RAISE NOTICE ' 6. Xi Consulting - Pro $29/mo monthly active';
|
|
903
|
+
RAISE NOTICE ' 7. Omicron Tech - Pro $29/mo monthly trialing';
|
|
904
|
+
RAISE NOTICE ' 8. Pi Systems - Pro $29/mo monthly past_due';
|
|
905
|
+
RAISE NOTICE ' 9. Rho Analytics - Pro $29/mo monthly canceled (voluntary)';
|
|
906
|
+
RAISE NOTICE ' 10. Sigma Media - Pro $29/mo yearly canceled (payment failed)';
|
|
907
|
+
RAISE NOTICE ' 11. Tau Engineering - Free monthly active';
|
|
908
|
+
RAISE NOTICE ' 12. Upsilon Studios - Ent $499/mo monthly active';
|
|
909
|
+
RAISE NOTICE '';
|
|
910
|
+
RAISE NOTICE ' 📊 SUBSCRIPTION STATS:';
|
|
911
|
+
RAISE NOTICE ' Active: 8 (incl 1 trialing) | Past Due: 1 | Canceled: 2 | Free: 1';
|
|
912
|
+
RAISE NOTICE ' MRR: ~$1,085 (4 Pro monthly + 1 Enterprise monthly)';
|
|
913
|
+
RAISE NOTICE ' ARR: ~$10,268 (2 Enterprise yearly + 1 Pro yearly)';
|
|
914
|
+
RAISE NOTICE '';
|
|
915
|
+
RAISE NOTICE ' 📝 TEAMS MODE: multi-tenant (B2B)';
|
|
916
|
+
RAISE NOTICE ' - Team switcher enabled';
|
|
917
|
+
RAISE NOTICE ' - Can create new teams';
|
|
918
|
+
RAISE NOTICE ' - Invitations enabled (owner/admin can invite)';
|
|
919
|
+
RAISE NOTICE ' - Subscriptions belong to team (no userId)';
|
|
920
|
+
RAISE NOTICE '';
|
|
921
|
+
RAISE NOTICE '═══════════════════════════════════════════════════════════';
|
|
922
|
+
END $$;
|