chore: prepare for deployment
Publish Docker Images / Smoke test (api) (push) Canceled after 0s
Publish Docker Images / Smoke test (dashboard) (push) Canceled after 0s
Publish Docker Images / Smoke test (jobs) (push) Canceled after 0s
Publish Docker Images / build-and-push (./docker/Dockerfile.api, api, api) (push) Canceled after 0s
Publish Docker Images / build-and-push (./docker/Dockerfile.dashboard, dashboard, dashboard) (push) Canceled after 0s
Publish Docker Images / build-and-push (./docker/Dockerfile.jobs, jobs, jobs) (push) Canceled after 0s
MCP package build check / build (push) Canceled after 0s
Package build check / build (push) Canceled after 0s
Upload OpenAPI Spec to R2 / generate-and-upload-openapi (push) Canceled after 0s
Publish Docker Images / Smoke test (api) (push) Canceled after 0s
Publish Docker Images / Smoke test (dashboard) (push) Canceled after 0s
Publish Docker Images / Smoke test (jobs) (push) Canceled after 0s
Publish Docker Images / build-and-push (./docker/Dockerfile.api, api, api) (push) Canceled after 0s
Publish Docker Images / build-and-push (./docker/Dockerfile.dashboard, dashboard, dashboard) (push) Canceled after 0s
Publish Docker Images / build-and-push (./docker/Dockerfile.jobs, jobs, jobs) (push) Canceled after 0s
MCP package build check / build (push) Canceled after 0s
Package build check / build (push) Canceled after 0s
Upload OpenAPI Spec to R2 / generate-and-upload-openapi (push) Canceled after 0s
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
const fs = require('fs');
|
||||
let seedTs = fs.readFileSync('src/scripts/seed.ts', 'utf8');
|
||||
|
||||
const constants = `
|
||||
const TUTOR_USER_ID = '01676a50-bb56-4c5e-8a61-fb9e9190fb10';
|
||||
const TUTOR2_USER_ID = '8f3a5b2c-1d4e-4f6f-a8b9-0c1d2e3f4a5b';
|
||||
const PROF2_GROUP_ID = '11112222-3333-4444-5555-666677778888';
|
||||
const PROF2_COURSE_ID = 'aaaabbbb-cccc-dddd-eeee-ffff00001111';
|
||||
`;
|
||||
|
||||
seedTs = seedTs.replace("const TUTOR_USER_ID = '01676a50-bb56-4c5e-8a61-fb9e9190fb10';", constants);
|
||||
|
||||
seedTs = seedTs.replace(
|
||||
'tutorUserId: TUTOR_USER_ID,',
|
||||
'tutorUserId: TUTOR_USER_ID,\n tutor2UserId: TUTOR2_USER_ID,'
|
||||
);
|
||||
|
||||
seedTs = seedTs.replace('testOrgId: TEST_ORG_ID,', 'testOrgId: TEST_ORG_ID,\n prof2GroupId: PROF2_GROUP_ID,');
|
||||
|
||||
seedTs = seedTs.replace(
|
||||
'adminUserId: ADMIN_USER_ID,',
|
||||
'adminUserId: ADMIN_USER_ID,\n prof2GroupId: PROF2_GROUP_ID,'
|
||||
);
|
||||
|
||||
seedTs = seedTs.replace(
|
||||
'pandasGroupId: PANDAS_GROUP_ID,',
|
||||
'pandasGroupId: PANDAS_GROUP_ID,\n prof2GroupId: PROF2_GROUP_ID,'
|
||||
);
|
||||
|
||||
seedTs = seedTs.replace(
|
||||
'earlyAdopterGroupId: EARLY_ADOPTER_GROUP_ID',
|
||||
'earlyAdopterGroupId: EARLY_ADOPTER_GROUP_ID,\n prof2CourseId: PROF2_COURSE_ID'
|
||||
);
|
||||
|
||||
fs.writeFileSync('src/scripts/seed.ts', seedTs);
|
||||
@@ -0,0 +1,32 @@
|
||||
const fs = require('fs');
|
||||
const path = './users.json';
|
||||
const users = JSON.parse(fs.readFileSync(path, 'utf8'));
|
||||
|
||||
users.forEach((u) => {
|
||||
if (u.email === '[email protected]') {
|
||||
u.email = '[email protected]';
|
||||
u.profile_fullname = 'Ulises Vargas Flores';
|
||||
if (u.identities && u.identities[0]) {
|
||||
u.identities[0].email = '[email protected]';
|
||||
u.identities[0].identity_data.email = '[email protected]';
|
||||
}
|
||||
}
|
||||
if (u.email === '[email protected]') {
|
||||
u.email = '[email protected]';
|
||||
u.profile_fullname = 'Eloy Gustavo Hernandez Ramirez';
|
||||
if (u.identities && u.identities[0]) {
|
||||
u.identities[0].email = '[email protected]';
|
||||
u.identities[0].identity_data.email = '[email protected]';
|
||||
}
|
||||
}
|
||||
if (u.email === '[email protected]') {
|
||||
u.email = '[email protected]';
|
||||
u.profile_fullname = 'Marco Antonio Vuelvas Diaz';
|
||||
if (u.identities && u.identities[0]) {
|
||||
u.identities[0].email = '[email protected]';
|
||||
u.identities[0].identity_data.email = '[email protected]';
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
fs.writeFileSync(path, JSON.stringify(users, null, 2));
|
||||
@@ -0,0 +1,32 @@
|
||||
import 'dotenv/config';
|
||||
import { db } from '../drizzle';
|
||||
import { isCourseTeamMemberOrOrgAdmin } from '../queries/group/group';
|
||||
import postgres from 'postgres';
|
||||
|
||||
async function main() {
|
||||
const courseId = 'd5309f67-e881-45c9-9d72-acc380889fef';
|
||||
const sql = postgres(process.env.DATABASE_URL!);
|
||||
const [profile] = await sql`SELECT id FROM profile WHERE email = '[email protected]'`;
|
||||
|
||||
if (profile) {
|
||||
const isTeam = await isCourseTeamMemberOrOrgAdmin(courseId, profile.id);
|
||||
console.log('isTeam:', isTeam);
|
||||
|
||||
// Check groupmember and organizationmember explicitly
|
||||
const data = await sql`
|
||||
SELECT
|
||||
gm.role_id as gm_role,
|
||||
om.role_id as om_role,
|
||||
g.organization_id,
|
||||
c.group_id
|
||||
FROM course c
|
||||
JOIN "group" g ON c.group_id = g.id
|
||||
LEFT JOIN groupmember gm ON gm.group_id = g.id AND gm.profile_id = ${profile.id}
|
||||
LEFT JOIN organizationmember om ON om.organization_id = g.organization_id AND om.profile_id = ${profile.id}
|
||||
WHERE c.id = ${courseId}
|
||||
`;
|
||||
console.log('data:', data);
|
||||
}
|
||||
process.exit(0);
|
||||
}
|
||||
main().catch(console.error);
|
||||
@@ -21,7 +21,7 @@ import { seedUsers } from '@db/utils/seed/users';
|
||||
import usersData from '../../users.json';
|
||||
|
||||
// Constants for IDs used across multiple seed functions
|
||||
const TEST_ORG_ID = '1a1dcddd-1abc-4f72-b644-0bd18191a289';
|
||||
const ENTERPRISE_ORG_ID = '1a1dcddd-1abc-4f72-b644-0bd18191a289';
|
||||
const ADMIN_USER_ID = '7ac00503-8519-43c8-a5ea-b79aeca900b1';
|
||||
const MVC_GROUP_ID = 'c6b022fd-fff3-4f09-8960-c9cb06819761';
|
||||
const REACT_GROUP_ID = '04a250f1-bcb9-4e0d-a3d4-a01096e7a105';
|
||||
@@ -29,11 +29,17 @@ const PANDAS_GROUP_ID = '0789ced2-b8f3-472c-97ff-bdde1e80dddf';
|
||||
const MVC_COURSE_ID = '98e6e798-f0bd-4f9d-a6f5-ce0816a4f97e';
|
||||
const REACT_COURSE_ID = '16e3bc8d-5d1b-4708-988e-93abae288ccf';
|
||||
const PANDAS_COURSE_ID = 'f0a85d18-aff4-412f-b8e6-3b34ef098dce';
|
||||
|
||||
const TUTOR_USER_ID = '01676a50-bb56-4c5e-8a61-fb9e9190fb10';
|
||||
const TUTOR2_USER_ID = '8f3a5b2c-1d4e-4f6f-a8b9-0c1d2e3f4a5b';
|
||||
const PROF2_GROUP_ID = '11112222-3333-4444-5555-666677778888';
|
||||
const PROF2_COURSE_ID = 'aaaabbbb-cccc-dddd-eeee-ffff00001111';
|
||||
|
||||
const STUDENT_USER_ID = '0c256e75-aa40-4f62-8d30-0217ca1c60d9';
|
||||
const ENTERPRISE_ORG_ID = '2b8f4a1c-6d3e-4b2a-9f7e-1c4d8a6e9b0f';
|
||||
const ENTERPRISE_ADMIN_USER_ID = '3c9052de-7e4f-4c3a-8d8e-2d5e9b7f1a3c';
|
||||
const ENTERPRISE_STUDENT_USER_ID = '4da163ef-8050-4d4b-9c9f-3e6fac802b4d';
|
||||
const EARLY_ADOPTER_ORG_ID = '5c7d4b2e-8f5a-4c3b-ae8f-2d6e9c1b0f5a';
|
||||
const ENTERPRISE_ORG_ID = '5c7d4b2e-8f5a-4c3b-ae8f-2d6e9c1b0f5a';
|
||||
const EARLY_ADOPTER_ADMIN_USER_ID = '6e0163ff-9161-4d4b-be9f-3e7fbd913c5e';
|
||||
const EARLY_ADOPTER_STUDENT_USER_ID = '7fb274aa-a272-4e5c-cf0a-4f8cce024d6f';
|
||||
const EARLY_ADOPTER_GROUP_ID = '8ac385bb-b383-4f6d-d01b-5a9ddf135e7a';
|
||||
@@ -120,21 +126,27 @@ const seedFunctions = {
|
||||
organizations: async () => {
|
||||
console.log('📝 Seeding organizations...');
|
||||
await seedOrganization({
|
||||
testOrgId: TEST_ORG_ID,
|
||||
testOrgId: ENTERPRISE_ORG_ID,
|
||||
prof2GroupId: PROF2_GROUP_ID,
|
||||
enterpriseOrgId: ENTERPRISE_ORG_ID,
|
||||
earlyAdopterOrgId: EARLY_ADOPTER_ORG_ID
|
||||
earlyAdopterOrgId: ENTERPRISE_ORG_ID,
|
||||
prof2GroupId: PROF2_GROUP_ID
|
||||
});
|
||||
},
|
||||
'organization-members': async () => {
|
||||
console.log('📝 Seeding organization members...');
|
||||
await seedOrganizationMember({
|
||||
testOrgId: TEST_ORG_ID,
|
||||
testOrgId: ENTERPRISE_ORG_ID,
|
||||
adminUserId: ADMIN_USER_ID,
|
||||
prof2GroupId: PROF2_GROUP_ID,
|
||||
tutorUserId: TUTOR_USER_ID,
|
||||
tutor2UserId: TUTOR2_USER_ID,
|
||||
tutor2UserId: TUTOR2_USER_ID,
|
||||
studentUserId: STUDENT_USER_ID,
|
||||
enterpriseOrgId: ENTERPRISE_ORG_ID,
|
||||
enterpriseAdminUserId: ENTERPRISE_ADMIN_USER_ID,
|
||||
enterpriseStudentUserId: ENTERPRISE_STUDENT_USER_ID,
|
||||
earlyAdopterOrgId: EARLY_ADOPTER_ORG_ID,
|
||||
earlyAdopterOrgId: ENTERPRISE_ORG_ID,
|
||||
earlyAdopterAdminUserId: EARLY_ADOPTER_ADMIN_USER_ID,
|
||||
earlyAdopterStudentUserId: EARLY_ADOPTER_STUDENT_USER_ID
|
||||
});
|
||||
@@ -143,7 +155,7 @@ const seedFunctions = {
|
||||
console.log('📝 Seeding enterprise organization plan...');
|
||||
await seedEnterpriseOrganizationPlan({ enterpriseOrgId: ENTERPRISE_ORG_ID });
|
||||
console.log('📝 Seeding early adopter organization plan...');
|
||||
await seedEarlyAdopterOrganizationPlan({ earlyAdopterOrgId: EARLY_ADOPTER_ORG_ID });
|
||||
await seedEarlyAdopterOrganizationPlan({ earlyAdopterOrgId: ENTERPRISE_ORG_ID });
|
||||
},
|
||||
groups: async () => {
|
||||
console.log('📝 Seeding groups...');
|
||||
@@ -151,9 +163,11 @@ const seedFunctions = {
|
||||
mvcGroupId: MVC_GROUP_ID,
|
||||
reactGroupId: REACT_GROUP_ID,
|
||||
pandasGroupId: PANDAS_GROUP_ID,
|
||||
testOrgId: TEST_ORG_ID,
|
||||
prof2GroupId: PROF2_GROUP_ID,
|
||||
testOrgId: ENTERPRISE_ORG_ID,
|
||||
earlyAdopterGroupId: EARLY_ADOPTER_GROUP_ID,
|
||||
earlyAdopterOrgId: EARLY_ADOPTER_ORG_ID
|
||||
prof2CourseId: PROF2_COURSE_ID,
|
||||
earlyAdopterOrgId: ENTERPRISE_ORG_ID
|
||||
});
|
||||
},
|
||||
'group-members': async () => {
|
||||
@@ -162,7 +176,10 @@ const seedFunctions = {
|
||||
mvcGroupId: MVC_GROUP_ID,
|
||||
reactGroupId: REACT_GROUP_ID,
|
||||
pandasGroupId: PANDAS_GROUP_ID,
|
||||
prof2GroupId: PROF2_GROUP_ID,
|
||||
adminUserId: ADMIN_USER_ID,
|
||||
tutorUserId: TUTOR_USER_ID,
|
||||
tutor2UserId: TUTOR2_USER_ID,
|
||||
studentUserId: STUDENT_USER_ID,
|
||||
earlyAdopterGroupId: EARLY_ADOPTER_GROUP_ID,
|
||||
earlyAdopterAdminUserId: EARLY_ADOPTER_ADMIN_USER_ID,
|
||||
@@ -175,6 +192,7 @@ const seedFunctions = {
|
||||
mvcGroupId: MVC_GROUP_ID,
|
||||
reactGroupId: REACT_GROUP_ID,
|
||||
pandasGroupId: PANDAS_GROUP_ID,
|
||||
prof2GroupId: PROF2_GROUP_ID,
|
||||
earlyAdopterGroupId: EARLY_ADOPTER_GROUP_ID
|
||||
});
|
||||
},
|
||||
|
||||
@@ -6,10 +6,17 @@ interface SeedCourse {
|
||||
mvcGroupId: string;
|
||||
reactGroupId: string;
|
||||
pandasGroupId: string;
|
||||
prof2GroupId: string;
|
||||
earlyAdopterGroupId: string;
|
||||
}
|
||||
|
||||
export async function seedCourses({ mvcGroupId, reactGroupId, pandasGroupId, earlyAdopterGroupId }: SeedCourse) {
|
||||
export async function seedCourses({
|
||||
mvcGroupId,
|
||||
reactGroupId,
|
||||
pandasGroupId,
|
||||
prof2GroupId,
|
||||
earlyAdopterGroupId
|
||||
}: SeedCourse) {
|
||||
const existingCourses = await db.select().from(course);
|
||||
const existingCourseIds = existingCourses.map((c) => c.id);
|
||||
|
||||
@@ -17,13 +24,41 @@ export async function seedCourses({ mvcGroupId, reactGroupId, pandasGroupId, ear
|
||||
const reactCourseId = '16e3bc8d-5d1b-4708-988e-93abae288ccf';
|
||||
const pandasCourseId = 'f0a85d18-aff4-412f-b8e6-3b34ef098dce';
|
||||
const earlyAdopterCourseId = '9bd496cc-c494-4a7e-e12c-6baeef246f8b';
|
||||
const prof2CourseId = 'aaaabbbb-cccc-dddd-eeee-ffff00001111';
|
||||
|
||||
const coursesToInsert: TNewCourse[] = [
|
||||
{
|
||||
id: mvcCourseId,
|
||||
title: 'Getting started with MVC',
|
||||
id: prof2CourseId,
|
||||
title: 'Introducción a la Administración Pública',
|
||||
description:
|
||||
"Embark on a comprehensive journey into the world of Model-View-Controller (MVC) architecture with our course, 'Getting Started with MVC.' Designed for beginners and aspiring developers, this course provides a solid foundation for understanding the principles and practices behind MVC, a widely adopted design pattern in software development.",
|
||||
'Curso impartido por la profesora Laura Perez Garcia sobre los fundamentos de la administración pública y su aplicación práctica en el Ayuntamiento.',
|
||||
overview: 'Welcome to this amazing course 🚀 ',
|
||||
groupId: prof2GroupId,
|
||||
isTemplate: false,
|
||||
logo: '',
|
||||
slug: 'introduccion-administracion-publica',
|
||||
metadata: {
|
||||
goals: '',
|
||||
grading: false,
|
||||
description: '',
|
||||
requirements: '',
|
||||
lessonDownload: false,
|
||||
allowNewStudent: true
|
||||
},
|
||||
cost: 0,
|
||||
currency: 'NGN',
|
||||
isPublished: true,
|
||||
certificate: {
|
||||
isDownloadable: false,
|
||||
theme: 'professional'
|
||||
},
|
||||
status: 'ACTIVE'
|
||||
},
|
||||
{
|
||||
id: mvcCourseId,
|
||||
title: 'Inducción al H. Ayuntamiento de Tijuana',
|
||||
description:
|
||||
'Conoce la estructura, misión y visión del gobierno municipal. Este curso es obligatorio para todos los nuevos servidores públicos de Tijuana.',
|
||||
overview:
|
||||
'<p>"Getting Started with MVC. is designed for beginners and aspiring developers, this course provides a solid foundation for understanding the principles and practices behind MVC, a widely adopted design pattern in software development.</p>',
|
||||
groupId: mvcGroupId,
|
||||
@@ -49,9 +84,9 @@ export async function seedCourses({ mvcGroupId, reactGroupId, pandasGroupId, ear
|
||||
},
|
||||
{
|
||||
id: reactCourseId,
|
||||
title: 'Modern Web Development with React',
|
||||
title: 'Transparencia y Acceso a la Información',
|
||||
description:
|
||||
"By the end of this course, you'll be equipped to build interactive and responsive web applications, making you a proficient React developer ready for the demands of today's web development landscape.",
|
||||
'Capacitación sobre la Ley General de Transparencia, el manejo de datos personales y la respuesta a solicitudes ciudadanas.',
|
||||
overview: 'Welcome to this amazing course 🚀 ',
|
||||
groupId: reactGroupId,
|
||||
isTemplate: true,
|
||||
@@ -76,7 +111,7 @@ export async function seedCourses({ mvcGroupId, reactGroupId, pandasGroupId, ear
|
||||
},
|
||||
{
|
||||
id: pandasCourseId,
|
||||
title: 'Data Science with Python and Pandas',
|
||||
title: 'Atención Ciudadana y Calidad en el Servicio',
|
||||
description:
|
||||
'Unlock the power of data with our "Data Science with Python and Pandas" course. Dive into Python programming fundamentals and then journey into the world of Pandas for efficient data manipulation and analysis. Learn essential data cleaning and preprocessing techniques before venturing into statistical analysis using Pandas. Cap off your exploration with data visualization using Matplotlib and Seaborn.',
|
||||
overview: 'Welcome to this amazing course 🚀 ',
|
||||
@@ -103,7 +138,7 @@ export async function seedCourses({ mvcGroupId, reactGroupId, pandasGroupId, ear
|
||||
},
|
||||
{
|
||||
id: earlyAdopterCourseId,
|
||||
title: 'Product Management Fundamentals',
|
||||
title: 'Procedimientos Administrativos Locales',
|
||||
description:
|
||||
'A practical introduction to product management covering roadmaps, prioritization frameworks, user research, and cross-functional collaboration skills needed to ship great products.',
|
||||
overview: 'Welcome to Product Management Fundamentals 🚀',
|
||||
|
||||
@@ -4,6 +4,7 @@ interface SeedGroup {
|
||||
mvcGroupId: string;
|
||||
reactGroupId: string;
|
||||
pandasGroupId: string;
|
||||
prof2GroupId: string;
|
||||
testOrgId: string;
|
||||
earlyAdopterGroupId: string;
|
||||
earlyAdopterOrgId: string;
|
||||
@@ -13,6 +14,7 @@ export async function seedGroup({
|
||||
mvcGroupId,
|
||||
reactGroupId,
|
||||
pandasGroupId,
|
||||
prof2GroupId,
|
||||
testOrgId,
|
||||
earlyAdopterGroupId,
|
||||
earlyAdopterOrgId
|
||||
@@ -42,6 +44,13 @@ export async function seedGroup({
|
||||
'Unlock the power of data with our "Data Science with Python and Pandas" course. Dive into Python programming fundamentals and then journey into the world of Pandas for efficient data manipulation and analysis.',
|
||||
organizationId: testOrgId
|
||||
},
|
||||
{
|
||||
id: prof2GroupId,
|
||||
name: 'Introducción a la Administración Pública',
|
||||
description:
|
||||
'Curso impartido por la profesora Laura Perez Garcia sobre los fundamentos de la administración pública y su aplicación práctica en el Ayuntamiento.',
|
||||
organizationId: testOrgId
|
||||
},
|
||||
{
|
||||
id: earlyAdopterGroupId,
|
||||
name: 'Product Management Fundamentals',
|
||||
|
||||
@@ -4,7 +4,10 @@ interface SeedGroupmember {
|
||||
mvcGroupId: string;
|
||||
reactGroupId: string;
|
||||
pandasGroupId: string;
|
||||
prof2GroupId: string;
|
||||
adminUserId: string;
|
||||
tutorUserId: string;
|
||||
tutor2UserId: string;
|
||||
studentUserId: string;
|
||||
earlyAdopterGroupId: string;
|
||||
earlyAdopterAdminUserId: string;
|
||||
@@ -15,7 +18,10 @@ export async function seedGroupmembers({
|
||||
mvcGroupId,
|
||||
reactGroupId,
|
||||
pandasGroupId,
|
||||
prof2GroupId,
|
||||
adminUserId,
|
||||
tutorUserId,
|
||||
tutor2UserId,
|
||||
studentUserId,
|
||||
earlyAdopterGroupId,
|
||||
earlyAdopterAdminUserId,
|
||||
@@ -28,20 +34,26 @@ export async function seedGroupmembers({
|
||||
{
|
||||
groupId: mvcGroupId,
|
||||
roleId: 2, // TUTOR
|
||||
profileId: adminUserId,
|
||||
email: '[email protected]'
|
||||
profileId: tutorUserId,
|
||||
email: '[email protected]'
|
||||
},
|
||||
{
|
||||
groupId: reactGroupId,
|
||||
roleId: 2, // TUTOR
|
||||
profileId: adminUserId,
|
||||
email: '[email protected]'
|
||||
profileId: tutorUserId,
|
||||
email: '[email protected]'
|
||||
},
|
||||
{
|
||||
groupId: pandasGroupId,
|
||||
roleId: 2, // TUTOR
|
||||
profileId: adminUserId,
|
||||
email: '[email protected]'
|
||||
profileId: tutorUserId,
|
||||
email: '[email protected]'
|
||||
},
|
||||
{
|
||||
groupId: prof2GroupId,
|
||||
roleId: 2, // TUTOR
|
||||
profileId: tutor2UserId,
|
||||
email: '[email protected]'
|
||||
},
|
||||
{
|
||||
groupId: pandasGroupId,
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
import { db, organization } from '@db/drizzle';
|
||||
|
||||
export async function seedOrganization({
|
||||
testOrgId,
|
||||
enterpriseOrgId,
|
||||
earlyAdopterOrgId
|
||||
enterpriseOrgId
|
||||
}: {
|
||||
testOrgId: string;
|
||||
enterpriseOrgId: string;
|
||||
@@ -13,36 +11,10 @@ export async function seedOrganization({
|
||||
const existingOrgIds = existingOrgs.map((o) => o.id);
|
||||
|
||||
const organizationsToInsert = [
|
||||
{
|
||||
id: testOrgId,
|
||||
name: 'Udemy Test',
|
||||
siteName: 'udemy-test',
|
||||
settings: {},
|
||||
landingpage: {},
|
||||
theme: '',
|
||||
customization: {
|
||||
apps: { poll: true, comments: true },
|
||||
course: { grading: true, newsfeed: true },
|
||||
dashboard: { exercise: true, community: true, bannerText: '', bannerImage: '' }
|
||||
}
|
||||
},
|
||||
{
|
||||
id: enterpriseOrgId,
|
||||
name: 'Coursera Test',
|
||||
siteName: 'coursera-test',
|
||||
settings: {},
|
||||
landingpage: {},
|
||||
theme: '',
|
||||
customization: {
|
||||
apps: { poll: true, comments: true },
|
||||
course: { grading: true, newsfeed: true },
|
||||
dashboard: { exercise: true, community: true, bannerText: '', bannerImage: '' }
|
||||
}
|
||||
},
|
||||
{
|
||||
id: earlyAdopterOrgId,
|
||||
name: 'Skillshare Test',
|
||||
siteName: 'skillshare-test',
|
||||
name: 'H. Ayuntamiento de Tijuana',
|
||||
siteName: 'ayuntamiento-tijuana',
|
||||
settings: {},
|
||||
landingpage: {},
|
||||
theme: '',
|
||||
|
||||
@@ -3,6 +3,8 @@ import { db, organizationmember } from '@db/drizzle';
|
||||
interface SeedOrganizationMember {
|
||||
testOrgId: string;
|
||||
adminUserId: string;
|
||||
tutorUserId: string;
|
||||
tutor2UserId: string;
|
||||
studentUserId: string;
|
||||
enterpriseOrgId: string;
|
||||
enterpriseAdminUserId: string;
|
||||
@@ -13,55 +15,39 @@ interface SeedOrganizationMember {
|
||||
}
|
||||
|
||||
export async function seedOrganizationMember({
|
||||
testOrgId,
|
||||
adminUserId,
|
||||
tutorUserId,
|
||||
tutor2UserId,
|
||||
studentUserId,
|
||||
enterpriseOrgId,
|
||||
enterpriseAdminUserId,
|
||||
enterpriseStudentUserId,
|
||||
earlyAdopterOrgId,
|
||||
earlyAdopterAdminUserId,
|
||||
earlyAdopterStudentUserId
|
||||
enterpriseOrgId
|
||||
}: SeedOrganizationMember) {
|
||||
const existingOrgMembers = await db.select().from(organizationmember);
|
||||
const existingOrgMemberKeys = existingOrgMembers.map((om) => `${om.organizationId}-${om.profileId}`);
|
||||
|
||||
const orgMembersToInsert = [
|
||||
{
|
||||
organizationId: testOrgId,
|
||||
organizationId: enterpriseOrgId,
|
||||
roleId: 1, // ADMIN
|
||||
profileId: adminUserId,
|
||||
verified: false
|
||||
},
|
||||
{
|
||||
organizationId: testOrgId,
|
||||
organizationId: enterpriseOrgId,
|
||||
roleId: 2, // TUTOR
|
||||
profileId: tutorUserId,
|
||||
verified: false
|
||||
},
|
||||
{
|
||||
organizationId: enterpriseOrgId,
|
||||
roleId: 2, // TUTOR
|
||||
profileId: tutor2UserId,
|
||||
verified: false
|
||||
},
|
||||
{
|
||||
organizationId: enterpriseOrgId,
|
||||
roleId: 3, // STUDENT
|
||||
profileId: studentUserId,
|
||||
verified: false
|
||||
},
|
||||
{
|
||||
organizationId: enterpriseOrgId,
|
||||
roleId: 1, // ADMIN
|
||||
profileId: enterpriseAdminUserId,
|
||||
verified: false
|
||||
},
|
||||
{
|
||||
organizationId: enterpriseOrgId,
|
||||
roleId: 3, // STUDENT
|
||||
profileId: enterpriseStudentUserId,
|
||||
verified: false
|
||||
},
|
||||
{
|
||||
organizationId: earlyAdopterOrgId,
|
||||
roleId: 1, // ADMIN
|
||||
profileId: earlyAdopterAdminUserId,
|
||||
verified: false
|
||||
},
|
||||
{
|
||||
organizationId: earlyAdopterOrgId,
|
||||
roleId: 3, // STUDENT
|
||||
profileId: earlyAdopterStudentUserId,
|
||||
verified: false
|
||||
}
|
||||
].filter((om) => !existingOrgMemberKeys.includes(`${om.organizationId}-${om.profileId}`));
|
||||
|
||||
|
||||
+124
-25
@@ -4,8 +4,8 @@
|
||||
"id": "01676a50-bb56-4c5e-8a61-fb9e9190fb10",
|
||||
"aud": "authenticated",
|
||||
"role": "authenticated",
|
||||
"email": "[email protected]",
|
||||
"encrypted_password": "$2a$10$WmfPO84h.8SbkZWSzXAygead77QQQXdeO5XIMd8iXk8SFQKB3Udy2",
|
||||
"email": "[email protected]",
|
||||
"encrypted_password": "$2a$10$n8vBI6.pyE0W/RO9DcJDseLKF/CRwsU4X4Lc2MaQogt8pQgnJavTa",
|
||||
"email_confirmed_at": "2023-11-22T10:09:32.250Z",
|
||||
"invited_at": null,
|
||||
"confirmation_token": "",
|
||||
@@ -16,7 +16,10 @@
|
||||
"email_change": "",
|
||||
"email_change_sent_at": null,
|
||||
"last_sign_in_at": "2023-12-04T12:57:34.337Z",
|
||||
"raw_app_meta_data": { "provider": "email", "providers": ["email"] },
|
||||
"raw_app_meta_data": {
|
||||
"provider": "email",
|
||||
"providers": ["email"]
|
||||
},
|
||||
"raw_user_meta_data": {},
|
||||
"is_super_admin": null,
|
||||
"created_at": "2023-11-22T10:09:32.171Z",
|
||||
@@ -39,24 +42,27 @@
|
||||
{
|
||||
"provider_id": "01676a50-bb56-4c5e-8a61-fb9e9190fb10",
|
||||
"user_id": "01676a50-bb56-4c5e-8a61-fb9e9190fb10",
|
||||
"identity_data": { "sub": "01676a50-bb56-4c5e-8a61-fb9e9190fb10", "email": "[email protected]" },
|
||||
"identity_data": {
|
||||
"sub": "01676a50-bb56-4c5e-8a61-fb9e9190fb10",
|
||||
"email": "[email protected]"
|
||||
},
|
||||
"provider": "email",
|
||||
"last_sign_in_at": "2023-11-22T10:09:32.225444+00:00",
|
||||
"created_at": "2023-11-22T10:09:32.225521+00:00",
|
||||
"updated_at": "2023-11-22T10:09:32.225521+00:00",
|
||||
"email": "[email protected]",
|
||||
"email": "[email protected]",
|
||||
"id": "a8961fe8-d51f-4b58-b8bb-a77d6a3c0cbd"
|
||||
}
|
||||
],
|
||||
"profile_fullname": "Alice"
|
||||
"profile_fullname": "Eloy Gustavo Hernandez Ramirez"
|
||||
},
|
||||
{
|
||||
"instance_id": "00000000-0000-0000-0000-000000000000",
|
||||
"id": "0c256e75-aa40-4f62-8d30-0217ca1c60d9",
|
||||
"aud": "authenticated",
|
||||
"role": "authenticated",
|
||||
"email": "[email protected]",
|
||||
"encrypted_password": "$2a$10$dgxySj.k12gDKhLx7X4x6./J.Nzhz7WQrwh5lkjLKwIwWW4o5GJcW",
|
||||
"email": "[email protected]",
|
||||
"encrypted_password": "$2a$10$n8vBI6.pyE0W/RO9DcJDseLKF/CRwsU4X4Lc2MaQogt8pQgnJavTa",
|
||||
"email_confirmed_at": "2023-12-18T17:08:57.413Z",
|
||||
"invited_at": null,
|
||||
"confirmation_token": "",
|
||||
@@ -67,7 +73,10 @@
|
||||
"email_change": "",
|
||||
"email_change_sent_at": null,
|
||||
"last_sign_in_at": "2023-12-19T18:22:55.359Z",
|
||||
"raw_app_meta_data": { "provider": "email", "providers": ["email"] },
|
||||
"raw_app_meta_data": {
|
||||
"provider": "email",
|
||||
"providers": ["email"]
|
||||
},
|
||||
"raw_user_meta_data": {},
|
||||
"is_super_admin": null,
|
||||
"created_at": "2023-12-18T17:08:57.399Z",
|
||||
@@ -90,23 +99,26 @@
|
||||
{
|
||||
"provider_id": "0c256e75-aa40-4f62-8d30-0217ca1c60d9",
|
||||
"user_id": "0c256e75-aa40-4f62-8d30-0217ca1c60d9",
|
||||
"identity_data": { "sub": "0c256e75-aa40-4f62-8d30-0217ca1c60d9", "email": "[email protected]" },
|
||||
"identity_data": {
|
||||
"sub": "0c256e75-aa40-4f62-8d30-0217ca1c60d9",
|
||||
"email": "[email protected]"
|
||||
},
|
||||
"provider": "email",
|
||||
"last_sign_in_at": "2023-12-18T17:08:57.410285+00:00",
|
||||
"created_at": "2023-12-18T17:08:57.410344+00:00",
|
||||
"updated_at": "2023-12-18T17:08:57.410344+00:00",
|
||||
"email": "[email protected]",
|
||||
"email": "[email protected]",
|
||||
"id": "65fa8bad-ca49-4676-8b17-ead4cd37fed6"
|
||||
}
|
||||
],
|
||||
"profile_fullname": "John Doe"
|
||||
"profile_fullname": "Marco Antonio Vuelvas Diaz"
|
||||
},
|
||||
{
|
||||
"instance_id": "00000000-0000-0000-0000-000000000000",
|
||||
"id": "7ac00503-8519-43c8-a5ea-b79aeca900b1",
|
||||
"aud": "authenticated",
|
||||
"role": "authenticated",
|
||||
"email": "[email protected]",
|
||||
"email": "[email protected]",
|
||||
"encrypted_password": "$2a$10$n8vBI6.pyE0W/RO9DcJDseLKF/CRwsU4X4Lc2MaQogt8pQgnJavTa",
|
||||
"email_confirmed_at": "2023-12-16T14:04:38.311Z",
|
||||
"invited_at": null,
|
||||
@@ -118,7 +130,10 @@
|
||||
"email_change": "",
|
||||
"email_change_sent_at": null,
|
||||
"last_sign_in_at": "2025-10-12T19:35:13.256Z",
|
||||
"raw_app_meta_data": { "provider": "email", "providers": ["email"] },
|
||||
"raw_app_meta_data": {
|
||||
"provider": "email",
|
||||
"providers": ["email"]
|
||||
},
|
||||
"raw_user_meta_data": {},
|
||||
"is_super_admin": null,
|
||||
"created_at": "2023-12-16T14:04:38.281Z",
|
||||
@@ -141,16 +156,19 @@
|
||||
{
|
||||
"provider_id": "7ac00503-8519-43c8-a5ea-b79aeca900b1",
|
||||
"user_id": "7ac00503-8519-43c8-a5ea-b79aeca900b1",
|
||||
"identity_data": { "sub": "7ac00503-8519-43c8-a5ea-b79aeca900b1", "email": "[email protected]" },
|
||||
"identity_data": {
|
||||
"sub": "7ac00503-8519-43c8-a5ea-b79aeca900b1",
|
||||
"email": "[email protected]"
|
||||
},
|
||||
"provider": "email",
|
||||
"last_sign_in_at": "2023-12-16T14:04:38.302264+00:00",
|
||||
"created_at": "2023-12-16T14:04:38.302326+00:00",
|
||||
"updated_at": "2023-12-16T14:04:38.302326+00:00",
|
||||
"email": "[email protected]",
|
||||
"email": "[email protected]",
|
||||
"id": "e790ab09-9c5c-4fb4-aa6b-78a5abe8cd56"
|
||||
}
|
||||
],
|
||||
"profile_fullname": "Elon Gates"
|
||||
"profile_fullname": "Ulises Vargas Flores"
|
||||
},
|
||||
{
|
||||
"instance_id": "00000000-0000-0000-0000-000000000000",
|
||||
@@ -169,7 +187,10 @@
|
||||
"email_change": "",
|
||||
"email_change_sent_at": null,
|
||||
"last_sign_in_at": null,
|
||||
"raw_app_meta_data": { "provider": "email", "providers": ["email"] },
|
||||
"raw_app_meta_data": {
|
||||
"provider": "email",
|
||||
"providers": ["email"]
|
||||
},
|
||||
"raw_user_meta_data": {},
|
||||
"is_super_admin": null,
|
||||
"created_at": "2025-03-23T12:00:00.000Z",
|
||||
@@ -192,7 +213,10 @@
|
||||
{
|
||||
"provider_id": "3c9052de-7e4f-4c3a-8d8e-2d5e9b7f1a3c",
|
||||
"user_id": "3c9052de-7e4f-4c3a-8d8e-2d5e9b7f1a3c",
|
||||
"identity_data": { "sub": "3c9052de-7e4f-4c3a-8d8e-2d5e9b7f1a3c", "email": "[email protected]" },
|
||||
"identity_data": {
|
||||
"sub": "3c9052de-7e4f-4c3a-8d8e-2d5e9b7f1a3c",
|
||||
"email": "[email protected]"
|
||||
},
|
||||
"provider": "email",
|
||||
"last_sign_in_at": "2025-03-23T12:00:00.000Z",
|
||||
"created_at": "2025-03-23T12:00:00.000Z",
|
||||
@@ -220,7 +244,10 @@
|
||||
"email_change": "",
|
||||
"email_change_sent_at": null,
|
||||
"last_sign_in_at": null,
|
||||
"raw_app_meta_data": { "provider": "email", "providers": ["email"] },
|
||||
"raw_app_meta_data": {
|
||||
"provider": "email",
|
||||
"providers": ["email"]
|
||||
},
|
||||
"raw_user_meta_data": {},
|
||||
"is_super_admin": null,
|
||||
"created_at": "2025-03-23T12:00:00.000Z",
|
||||
@@ -243,7 +270,10 @@
|
||||
{
|
||||
"provider_id": "4da163ef-8050-4d4b-9c9f-3e6fac802b4d",
|
||||
"user_id": "4da163ef-8050-4d4b-9c9f-3e6fac802b4d",
|
||||
"identity_data": { "sub": "4da163ef-8050-4d4b-9c9f-3e6fac802b4d", "email": "[email protected]" },
|
||||
"identity_data": {
|
||||
"sub": "4da163ef-8050-4d4b-9c9f-3e6fac802b4d",
|
||||
"email": "[email protected]"
|
||||
},
|
||||
"provider": "email",
|
||||
"last_sign_in_at": "2025-03-23T12:00:00.000Z",
|
||||
"created_at": "2025-03-23T12:00:00.000Z",
|
||||
@@ -271,7 +301,10 @@
|
||||
"email_change": "",
|
||||
"email_change_sent_at": null,
|
||||
"last_sign_in_at": null,
|
||||
"raw_app_meta_data": { "provider": "email", "providers": ["email"] },
|
||||
"raw_app_meta_data": {
|
||||
"provider": "email",
|
||||
"providers": ["email"]
|
||||
},
|
||||
"raw_user_meta_data": {},
|
||||
"is_super_admin": null,
|
||||
"created_at": "2025-03-23T12:00:00.000Z",
|
||||
@@ -294,7 +327,10 @@
|
||||
{
|
||||
"provider_id": "6e0163ff-9161-4d4b-be9f-3e7fbd913c5e",
|
||||
"user_id": "6e0163ff-9161-4d4b-be9f-3e7fbd913c5e",
|
||||
"identity_data": { "sub": "6e0163ff-9161-4d4b-be9f-3e7fbd913c5e", "email": "[email protected]" },
|
||||
"identity_data": {
|
||||
"sub": "6e0163ff-9161-4d4b-be9f-3e7fbd913c5e",
|
||||
"email": "[email protected]"
|
||||
},
|
||||
"provider": "email",
|
||||
"last_sign_in_at": "2025-03-23T12:00:00.000Z",
|
||||
"created_at": "2025-03-23T12:00:00.000Z",
|
||||
@@ -322,7 +358,10 @@
|
||||
"email_change": "",
|
||||
"email_change_sent_at": null,
|
||||
"last_sign_in_at": null,
|
||||
"raw_app_meta_data": { "provider": "email", "providers": ["email"] },
|
||||
"raw_app_meta_data": {
|
||||
"provider": "email",
|
||||
"providers": ["email"]
|
||||
},
|
||||
"raw_user_meta_data": {},
|
||||
"is_super_admin": null,
|
||||
"created_at": "2025-03-23T12:00:00.000Z",
|
||||
@@ -345,7 +384,10 @@
|
||||
{
|
||||
"provider_id": "7fb274aa-a272-4e5c-cf0a-4f8cce024d6f",
|
||||
"user_id": "7fb274aa-a272-4e5c-cf0a-4f8cce024d6f",
|
||||
"identity_data": { "sub": "7fb274aa-a272-4e5c-cf0a-4f8cce024d6f", "email": "[email protected]" },
|
||||
"identity_data": {
|
||||
"sub": "7fb274aa-a272-4e5c-cf0a-4f8cce024d6f",
|
||||
"email": "[email protected]"
|
||||
},
|
||||
"provider": "email",
|
||||
"last_sign_in_at": "2025-03-23T12:00:00.000Z",
|
||||
"created_at": "2025-03-23T12:00:00.000Z",
|
||||
@@ -355,5 +397,62 @@
|
||||
}
|
||||
],
|
||||
"profile_fullname": "Early Adopter Student"
|
||||
},
|
||||
{
|
||||
"instance_id": "00000000-0000-0000-0000-000000000000",
|
||||
"id": "8f3a5b2c-1d4e-4f6f-a8b9-0c1d2e3f4a5b",
|
||||
"aud": "authenticated",
|
||||
"role": "authenticated",
|
||||
"email": "[email protected]",
|
||||
"encrypted_password": "$2a$10$n8vBI6.pyE0W/RO9DcJDseLKF/CRwsU4X4Lc2MaQogt8pQgnJavTa",
|
||||
"email_confirmed_at": "2023-11-22T10:09:32.250Z",
|
||||
"invited_at": null,
|
||||
"confirmation_token": "",
|
||||
"confirmation_sent_at": null,
|
||||
"recovery_token": "",
|
||||
"recovery_sent_at": null,
|
||||
"email_change_token_new": "",
|
||||
"email_change": "",
|
||||
"email_change_sent_at": null,
|
||||
"last_sign_in_at": "2023-12-04T12:57:34.337Z",
|
||||
"raw_app_meta_data": {
|
||||
"provider": "email",
|
||||
"providers": ["email"]
|
||||
},
|
||||
"raw_user_meta_data": {},
|
||||
"is_super_admin": null,
|
||||
"created_at": "2023-11-22T10:09:32.171Z",
|
||||
"updated_at": "2023-12-16T14:00:35.986Z",
|
||||
"phone": null,
|
||||
"phone_confirmed_at": null,
|
||||
"phone_change": "",
|
||||
"phone_change_token": "",
|
||||
"phone_change_sent_at": null,
|
||||
"confirmed_at": "2023-11-22T10:09:32.250Z",
|
||||
"email_change_token_current": "",
|
||||
"email_change_confirm_status": 0,
|
||||
"banned_until": null,
|
||||
"reauthentication_token": "",
|
||||
"reauthentication_sent_at": null,
|
||||
"is_sso_user": false,
|
||||
"deleted_at": null,
|
||||
"is_anonymous": false,
|
||||
"identities": [
|
||||
{
|
||||
"provider_id": "8f3a5b2c-1d4e-4f6f-a8b9-0c1d2e3f4a5b",
|
||||
"user_id": "8f3a5b2c-1d4e-4f6f-a8b9-0c1d2e3f4a5b",
|
||||
"identity_data": {
|
||||
"sub": "8f3a5b2c-1d4e-4f6f-a8b9-0c1d2e3f4a5b",
|
||||
"email": "[email protected]"
|
||||
},
|
||||
"provider": "email",
|
||||
"last_sign_in_at": "2023-11-22T10:09:32.225444+00:00",
|
||||
"created_at": "2023-11-22T10:09:32.225521+00:00",
|
||||
"updated_at": "2023-11-22T10:09:32.225521+00:00",
|
||||
"email": "[email protected]",
|
||||
"id": "12345678-abcd-ef01-2345-6789abcdef01"
|
||||
}
|
||||
],
|
||||
"profile_fullname": "Laura Perez Garcia"
|
||||
}
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user