4142 lines
92 KiB
JavaScript
4142 lines
92 KiB
JavaScript
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const db = require('../models');
|
|
const Users = db.users;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const Organizations = db.organizations;
|
|
|
|
const Workspaces = db.workspaces;
|
|
|
|
const WorkspaceMemberships = db.workspace_memberships;
|
|
|
|
const Projects = db.projects;
|
|
|
|
const Tags = db.tags;
|
|
|
|
const Tasks = db.tasks;
|
|
|
|
const TaskComments = db.task_comments;
|
|
|
|
const TaskActivityLogs = db.task_activity_logs;
|
|
|
|
const TaskChecklistItems = db.task_checklist_items;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const OrganizationsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"name": "Ada Lovelace",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"name": "Alan Turing",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"name": "Grace Hopper",
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"name": "Alan Turing",
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const WorkspacesData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"name": "Northwind Delivery",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"slug": "northwind-delivery",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Team workspace for product planning and delivery operations.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_personal": false,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "images" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"name": "Mobile App Squad",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"slug": "mobile-app-squad",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Workspace for the mobile application team.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_personal": false,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "images" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"name": "Customer Success",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"slug": "customer-success",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Task tracking for customer support and success initiatives.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_personal": false,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "images" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
"name": "Internal Tools",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"slug": "internal-tools",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Back-office automation and internal tooling projects.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_personal": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "images" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const WorkspaceMembershipsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"membership_role": "owner",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "invited",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"invited_at": new Date('2026-02-20T10:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"joined_at": new Date('2026-02-20T10:05:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"membership_role": "member",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "active",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"invited_at": new Date('2026-02-21T09:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"joined_at": new Date('2026-02-21T09:20:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"membership_role": "admin",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "suspended",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"invited_at": new Date('2026-02-21T09:10:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"joined_at": new Date('2026-02-21T09:40:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"membership_role": "member",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "active",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"invited_at": new Date('2026-01-15T13:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"joined_at": new Date('2026-01-15T13:05:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const ProjectsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"name": "Q2 Release Plan",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"key": "Q2PLAN",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Plan and execute the Q2 release across teams.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"visibility": "private",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_archived": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"start_at": new Date('2026-03-01T00:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"due_at": new Date('2026-06-30T00:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "images" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"name": "Bug Triage",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"key": "TRIAGE",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Incoming bug reports, prioritization, and resolution tracking.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"visibility": "workspace",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_archived": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"start_at": new Date('2026-03-10T00:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"due_at": new Date('2026-05-31T00:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "images" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"name": "iOS Refresh",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"key": "IOSR",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "UI refresh and performance improvements for iOS.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"visibility": "private",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_archived": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"start_at": new Date('2026-02-15T00:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"due_at": new Date('2026-04-30T00:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "images" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"name": "Ops Dashboard",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"key": "OPSD",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Unified dashboard for operational metrics and alerts.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"visibility": "private",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_archived": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"start_at": new Date('2026-03-05T00:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"due_at": new Date('2026-07-15T00:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "images" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const TagsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"name": "Backend",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"color": "#2563EB",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Server-side work and API changes.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"name": "Frontend",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"color": "#7C3AED",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Client-side UI and UX changes.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"name": "Urgent",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"color": "#DC2626",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Requires immediate attention.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"name": "Performance",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"color": "#059669",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Performance optimization related tasks.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const TasksData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"title": "Finalize Q2 scope and milestones",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Confirm deliverables, owners, and success metrics for the quarter.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "blocked",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"priority": "low",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"start_at": new Date('2026-03-02T09:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"due_at": new Date('2026-03-29T17:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"completed_at": new Date('2026-03-25T15:10:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"estimate_hours": 6.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"time_spent_hours": 4.5,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"sort_order": 10,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_recurring": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"recurrence_rule": "monthly",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_many" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"title": "Draft release notes template",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Create a reusable release notes template including risk and rollback sections.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "todo",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"priority": "low",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"start_at": new Date('2026-03-26T10:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"due_at": new Date('2026-04-05T17:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"completed_at": new Date('2026-04-04T12:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"estimate_hours": 3.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"time_spent_hours": 2.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"sort_order": 20,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_recurring": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"recurrence_rule": "weekly",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_many" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"title": "Investigate intermittent login timeout",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Review logs and reproduce the timeout seen by a subset of users.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "in_progress",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"priority": "urgent",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"start_at": new Date('2026-03-15T09:30:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"due_at": new Date('2026-03-28T17:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"completed_at": new Date('2026-03-30T10:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"estimate_hours": 8.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"time_spent_hours": 3.5,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"sort_order": 5,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_recurring": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"recurrence_rule": "daily",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_many" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"title": "Reduce cold start time",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"description": "Profile startup, optimize asset loading, and remove redundant initialization.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"status": "done",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"priority": "high",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"start_at": new Date('2026-03-01T08:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"due_at": new Date('2026-04-10T17:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"completed_at": new Date('2026-04-11T09:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"estimate_hours": 20.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"time_spent_hours": 11.0,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"sort_order": 15,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_recurring": false,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"recurrence_rule": "weekly",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_many" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const TaskCommentsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"body": "Please confirm owner assignments for the top three milestones before Friday.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"posted_at": new Date('2026-03-20T10:12:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_edited": false,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"body": "Owners confirmed. I updated the milestone sheet and added a risk section.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"posted_at": new Date('2026-03-21T14:05:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_edited": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"body": "Reproduced once in staging under high latency. Next step is to add tracing around auth gateway calls.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"posted_at": new Date('2026-03-16T09:45:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_edited": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"body": "Initial profiling shows image decoding on main thread. Planning to move decoding off the critical path.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"posted_at": new Date('2026-03-05T11:30:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_edited": false,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "files" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const TaskActivityLogsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"action_type": "assigned",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"details": "Task created in Q2 Release Plan.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"occurred_at": new Date('2026-03-02T09:01:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"action_type": "tagged",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"details": "Status changed from todo to in_progress.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"occurred_at": new Date('2026-03-10T10:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"action_type": "unassigned",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"details": "New bug investigation task created.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"occurred_at": new Date('2026-03-15T09:31:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"action_type": "updated",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"details": "Attached login-timeout.log for analysis.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"occurred_at": new Date('2026-03-15T09:35:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const TaskChecklistItemsData = [
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"title": "Confirm stakeholders for sign-off",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_done": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"position": 1,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"done_at": new Date('2026-03-18T16:40:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"title": "Align dependencies with engineering leads",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_done": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"position": 2,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"done_at": new Date('2026-03-19T11:15:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"title": "Collect gateway timeout metrics",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_done": false,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"position": 1,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"done_at": new Date('2026-03-17T10:00:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"title": "Record startup trace on low-end device",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"is_done": true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"position": 1,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"done_at": new Date('2026-03-06T09:10:00Z'),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// type code here for "relation_one" field
|
|
|
|
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Similar logic for "relation_many"
|
|
|
|
|
|
|
|
|
|
async function associateUserWithOrganization() {
|
|
|
|
const relatedOrganization0 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const User0 = await Users.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (User0?.setOrganization)
|
|
{
|
|
await
|
|
User0.
|
|
setOrganization(relatedOrganization0);
|
|
}
|
|
|
|
const relatedOrganization1 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const User1 = await Users.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (User1?.setOrganization)
|
|
{
|
|
await
|
|
User1.
|
|
setOrganization(relatedOrganization1);
|
|
}
|
|
|
|
const relatedOrganization2 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const User2 = await Users.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (User2?.setOrganization)
|
|
{
|
|
await
|
|
User2.
|
|
setOrganization(relatedOrganization2);
|
|
}
|
|
|
|
const relatedOrganization3 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const User3 = await Users.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (User3?.setOrganization)
|
|
{
|
|
await
|
|
User3.
|
|
setOrganization(relatedOrganization3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateWorkspaceWithOwner() {
|
|
|
|
const relatedOwner0 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Workspace0 = await Workspaces.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Workspace0?.setOwner)
|
|
{
|
|
await
|
|
Workspace0.
|
|
setOwner(relatedOwner0);
|
|
}
|
|
|
|
const relatedOwner1 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Workspace1 = await Workspaces.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Workspace1?.setOwner)
|
|
{
|
|
await
|
|
Workspace1.
|
|
setOwner(relatedOwner1);
|
|
}
|
|
|
|
const relatedOwner2 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Workspace2 = await Workspaces.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Workspace2?.setOwner)
|
|
{
|
|
await
|
|
Workspace2.
|
|
setOwner(relatedOwner2);
|
|
}
|
|
|
|
const relatedOwner3 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Workspace3 = await Workspaces.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Workspace3?.setOwner)
|
|
{
|
|
await
|
|
Workspace3.
|
|
setOwner(relatedOwner3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateWorkspaceWithOrganization() {
|
|
|
|
const relatedOrganization0 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Workspace0 = await Workspaces.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Workspace0?.setOrganization)
|
|
{
|
|
await
|
|
Workspace0.
|
|
setOrganization(relatedOrganization0);
|
|
}
|
|
|
|
const relatedOrganization1 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Workspace1 = await Workspaces.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Workspace1?.setOrganization)
|
|
{
|
|
await
|
|
Workspace1.
|
|
setOrganization(relatedOrganization1);
|
|
}
|
|
|
|
const relatedOrganization2 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Workspace2 = await Workspaces.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Workspace2?.setOrganization)
|
|
{
|
|
await
|
|
Workspace2.
|
|
setOrganization(relatedOrganization2);
|
|
}
|
|
|
|
const relatedOrganization3 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Workspace3 = await Workspaces.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Workspace3?.setOrganization)
|
|
{
|
|
await
|
|
Workspace3.
|
|
setOrganization(relatedOrganization3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateWorkspaceMembershipWithWorkspace() {
|
|
|
|
const relatedWorkspace0 = await Workspaces.findOne({
|
|
offset: Math.floor(Math.random() * (await Workspaces.count())),
|
|
});
|
|
const WorkspaceMembership0 = await WorkspaceMemberships.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (WorkspaceMembership0?.setWorkspace)
|
|
{
|
|
await
|
|
WorkspaceMembership0.
|
|
setWorkspace(relatedWorkspace0);
|
|
}
|
|
|
|
const relatedWorkspace1 = await Workspaces.findOne({
|
|
offset: Math.floor(Math.random() * (await Workspaces.count())),
|
|
});
|
|
const WorkspaceMembership1 = await WorkspaceMemberships.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (WorkspaceMembership1?.setWorkspace)
|
|
{
|
|
await
|
|
WorkspaceMembership1.
|
|
setWorkspace(relatedWorkspace1);
|
|
}
|
|
|
|
const relatedWorkspace2 = await Workspaces.findOne({
|
|
offset: Math.floor(Math.random() * (await Workspaces.count())),
|
|
});
|
|
const WorkspaceMembership2 = await WorkspaceMemberships.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (WorkspaceMembership2?.setWorkspace)
|
|
{
|
|
await
|
|
WorkspaceMembership2.
|
|
setWorkspace(relatedWorkspace2);
|
|
}
|
|
|
|
const relatedWorkspace3 = await Workspaces.findOne({
|
|
offset: Math.floor(Math.random() * (await Workspaces.count())),
|
|
});
|
|
const WorkspaceMembership3 = await WorkspaceMemberships.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (WorkspaceMembership3?.setWorkspace)
|
|
{
|
|
await
|
|
WorkspaceMembership3.
|
|
setWorkspace(relatedWorkspace3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateWorkspaceMembershipWithUser() {
|
|
|
|
const relatedUser0 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const WorkspaceMembership0 = await WorkspaceMemberships.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (WorkspaceMembership0?.setUser)
|
|
{
|
|
await
|
|
WorkspaceMembership0.
|
|
setUser(relatedUser0);
|
|
}
|
|
|
|
const relatedUser1 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const WorkspaceMembership1 = await WorkspaceMemberships.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (WorkspaceMembership1?.setUser)
|
|
{
|
|
await
|
|
WorkspaceMembership1.
|
|
setUser(relatedUser1);
|
|
}
|
|
|
|
const relatedUser2 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const WorkspaceMembership2 = await WorkspaceMemberships.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (WorkspaceMembership2?.setUser)
|
|
{
|
|
await
|
|
WorkspaceMembership2.
|
|
setUser(relatedUser2);
|
|
}
|
|
|
|
const relatedUser3 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const WorkspaceMembership3 = await WorkspaceMemberships.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (WorkspaceMembership3?.setUser)
|
|
{
|
|
await
|
|
WorkspaceMembership3.
|
|
setUser(relatedUser3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateWorkspaceMembershipWithOrganization() {
|
|
|
|
const relatedOrganization0 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const WorkspaceMembership0 = await WorkspaceMemberships.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (WorkspaceMembership0?.setOrganization)
|
|
{
|
|
await
|
|
WorkspaceMembership0.
|
|
setOrganization(relatedOrganization0);
|
|
}
|
|
|
|
const relatedOrganization1 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const WorkspaceMembership1 = await WorkspaceMemberships.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (WorkspaceMembership1?.setOrganization)
|
|
{
|
|
await
|
|
WorkspaceMembership1.
|
|
setOrganization(relatedOrganization1);
|
|
}
|
|
|
|
const relatedOrganization2 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const WorkspaceMembership2 = await WorkspaceMemberships.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (WorkspaceMembership2?.setOrganization)
|
|
{
|
|
await
|
|
WorkspaceMembership2.
|
|
setOrganization(relatedOrganization2);
|
|
}
|
|
|
|
const relatedOrganization3 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const WorkspaceMembership3 = await WorkspaceMemberships.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (WorkspaceMembership3?.setOrganization)
|
|
{
|
|
await
|
|
WorkspaceMembership3.
|
|
setOrganization(relatedOrganization3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateProjectWithWorkspace() {
|
|
|
|
const relatedWorkspace0 = await Workspaces.findOne({
|
|
offset: Math.floor(Math.random() * (await Workspaces.count())),
|
|
});
|
|
const Project0 = await Projects.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Project0?.setWorkspace)
|
|
{
|
|
await
|
|
Project0.
|
|
setWorkspace(relatedWorkspace0);
|
|
}
|
|
|
|
const relatedWorkspace1 = await Workspaces.findOne({
|
|
offset: Math.floor(Math.random() * (await Workspaces.count())),
|
|
});
|
|
const Project1 = await Projects.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Project1?.setWorkspace)
|
|
{
|
|
await
|
|
Project1.
|
|
setWorkspace(relatedWorkspace1);
|
|
}
|
|
|
|
const relatedWorkspace2 = await Workspaces.findOne({
|
|
offset: Math.floor(Math.random() * (await Workspaces.count())),
|
|
});
|
|
const Project2 = await Projects.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Project2?.setWorkspace)
|
|
{
|
|
await
|
|
Project2.
|
|
setWorkspace(relatedWorkspace2);
|
|
}
|
|
|
|
const relatedWorkspace3 = await Workspaces.findOne({
|
|
offset: Math.floor(Math.random() * (await Workspaces.count())),
|
|
});
|
|
const Project3 = await Projects.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Project3?.setWorkspace)
|
|
{
|
|
await
|
|
Project3.
|
|
setWorkspace(relatedWorkspace3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateProjectWithOrganization() {
|
|
|
|
const relatedOrganization0 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Project0 = await Projects.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Project0?.setOrganization)
|
|
{
|
|
await
|
|
Project0.
|
|
setOrganization(relatedOrganization0);
|
|
}
|
|
|
|
const relatedOrganization1 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Project1 = await Projects.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Project1?.setOrganization)
|
|
{
|
|
await
|
|
Project1.
|
|
setOrganization(relatedOrganization1);
|
|
}
|
|
|
|
const relatedOrganization2 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Project2 = await Projects.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Project2?.setOrganization)
|
|
{
|
|
await
|
|
Project2.
|
|
setOrganization(relatedOrganization2);
|
|
}
|
|
|
|
const relatedOrganization3 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Project3 = await Projects.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Project3?.setOrganization)
|
|
{
|
|
await
|
|
Project3.
|
|
setOrganization(relatedOrganization3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateTagWithWorkspace() {
|
|
|
|
const relatedWorkspace0 = await Workspaces.findOne({
|
|
offset: Math.floor(Math.random() * (await Workspaces.count())),
|
|
});
|
|
const Tag0 = await Tags.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Tag0?.setWorkspace)
|
|
{
|
|
await
|
|
Tag0.
|
|
setWorkspace(relatedWorkspace0);
|
|
}
|
|
|
|
const relatedWorkspace1 = await Workspaces.findOne({
|
|
offset: Math.floor(Math.random() * (await Workspaces.count())),
|
|
});
|
|
const Tag1 = await Tags.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Tag1?.setWorkspace)
|
|
{
|
|
await
|
|
Tag1.
|
|
setWorkspace(relatedWorkspace1);
|
|
}
|
|
|
|
const relatedWorkspace2 = await Workspaces.findOne({
|
|
offset: Math.floor(Math.random() * (await Workspaces.count())),
|
|
});
|
|
const Tag2 = await Tags.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Tag2?.setWorkspace)
|
|
{
|
|
await
|
|
Tag2.
|
|
setWorkspace(relatedWorkspace2);
|
|
}
|
|
|
|
const relatedWorkspace3 = await Workspaces.findOne({
|
|
offset: Math.floor(Math.random() * (await Workspaces.count())),
|
|
});
|
|
const Tag3 = await Tags.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Tag3?.setWorkspace)
|
|
{
|
|
await
|
|
Tag3.
|
|
setWorkspace(relatedWorkspace3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateTagWithOrganization() {
|
|
|
|
const relatedOrganization0 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Tag0 = await Tags.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Tag0?.setOrganization)
|
|
{
|
|
await
|
|
Tag0.
|
|
setOrganization(relatedOrganization0);
|
|
}
|
|
|
|
const relatedOrganization1 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Tag1 = await Tags.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Tag1?.setOrganization)
|
|
{
|
|
await
|
|
Tag1.
|
|
setOrganization(relatedOrganization1);
|
|
}
|
|
|
|
const relatedOrganization2 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Tag2 = await Tags.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Tag2?.setOrganization)
|
|
{
|
|
await
|
|
Tag2.
|
|
setOrganization(relatedOrganization2);
|
|
}
|
|
|
|
const relatedOrganization3 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Tag3 = await Tags.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Tag3?.setOrganization)
|
|
{
|
|
await
|
|
Tag3.
|
|
setOrganization(relatedOrganization3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateTaskWithProject() {
|
|
|
|
const relatedProject0 = await Projects.findOne({
|
|
offset: Math.floor(Math.random() * (await Projects.count())),
|
|
});
|
|
const Task0 = await Tasks.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Task0?.setProject)
|
|
{
|
|
await
|
|
Task0.
|
|
setProject(relatedProject0);
|
|
}
|
|
|
|
const relatedProject1 = await Projects.findOne({
|
|
offset: Math.floor(Math.random() * (await Projects.count())),
|
|
});
|
|
const Task1 = await Tasks.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Task1?.setProject)
|
|
{
|
|
await
|
|
Task1.
|
|
setProject(relatedProject1);
|
|
}
|
|
|
|
const relatedProject2 = await Projects.findOne({
|
|
offset: Math.floor(Math.random() * (await Projects.count())),
|
|
});
|
|
const Task2 = await Tasks.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Task2?.setProject)
|
|
{
|
|
await
|
|
Task2.
|
|
setProject(relatedProject2);
|
|
}
|
|
|
|
const relatedProject3 = await Projects.findOne({
|
|
offset: Math.floor(Math.random() * (await Projects.count())),
|
|
});
|
|
const Task3 = await Tasks.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Task3?.setProject)
|
|
{
|
|
await
|
|
Task3.
|
|
setProject(relatedProject3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateTaskWithAssignee() {
|
|
|
|
const relatedAssignee0 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Task0 = await Tasks.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Task0?.setAssignee)
|
|
{
|
|
await
|
|
Task0.
|
|
setAssignee(relatedAssignee0);
|
|
}
|
|
|
|
const relatedAssignee1 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Task1 = await Tasks.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Task1?.setAssignee)
|
|
{
|
|
await
|
|
Task1.
|
|
setAssignee(relatedAssignee1);
|
|
}
|
|
|
|
const relatedAssignee2 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Task2 = await Tasks.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Task2?.setAssignee)
|
|
{
|
|
await
|
|
Task2.
|
|
setAssignee(relatedAssignee2);
|
|
}
|
|
|
|
const relatedAssignee3 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Task3 = await Tasks.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Task3?.setAssignee)
|
|
{
|
|
await
|
|
Task3.
|
|
setAssignee(relatedAssignee3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateTaskWithReporter() {
|
|
|
|
const relatedReporter0 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Task0 = await Tasks.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Task0?.setReporter)
|
|
{
|
|
await
|
|
Task0.
|
|
setReporter(relatedReporter0);
|
|
}
|
|
|
|
const relatedReporter1 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Task1 = await Tasks.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Task1?.setReporter)
|
|
{
|
|
await
|
|
Task1.
|
|
setReporter(relatedReporter1);
|
|
}
|
|
|
|
const relatedReporter2 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Task2 = await Tasks.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Task2?.setReporter)
|
|
{
|
|
await
|
|
Task2.
|
|
setReporter(relatedReporter2);
|
|
}
|
|
|
|
const relatedReporter3 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const Task3 = await Tasks.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Task3?.setReporter)
|
|
{
|
|
await
|
|
Task3.
|
|
setReporter(relatedReporter3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Similar logic for "relation_many"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateTaskWithOrganization() {
|
|
|
|
const relatedOrganization0 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Task0 = await Tasks.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (Task0?.setOrganization)
|
|
{
|
|
await
|
|
Task0.
|
|
setOrganization(relatedOrganization0);
|
|
}
|
|
|
|
const relatedOrganization1 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Task1 = await Tasks.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (Task1?.setOrganization)
|
|
{
|
|
await
|
|
Task1.
|
|
setOrganization(relatedOrganization1);
|
|
}
|
|
|
|
const relatedOrganization2 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Task2 = await Tasks.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (Task2?.setOrganization)
|
|
{
|
|
await
|
|
Task2.
|
|
setOrganization(relatedOrganization2);
|
|
}
|
|
|
|
const relatedOrganization3 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const Task3 = await Tasks.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (Task3?.setOrganization)
|
|
{
|
|
await
|
|
Task3.
|
|
setOrganization(relatedOrganization3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateTaskCommentWithTask() {
|
|
|
|
const relatedTask0 = await Tasks.findOne({
|
|
offset: Math.floor(Math.random() * (await Tasks.count())),
|
|
});
|
|
const TaskComment0 = await TaskComments.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (TaskComment0?.setTask)
|
|
{
|
|
await
|
|
TaskComment0.
|
|
setTask(relatedTask0);
|
|
}
|
|
|
|
const relatedTask1 = await Tasks.findOne({
|
|
offset: Math.floor(Math.random() * (await Tasks.count())),
|
|
});
|
|
const TaskComment1 = await TaskComments.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (TaskComment1?.setTask)
|
|
{
|
|
await
|
|
TaskComment1.
|
|
setTask(relatedTask1);
|
|
}
|
|
|
|
const relatedTask2 = await Tasks.findOne({
|
|
offset: Math.floor(Math.random() * (await Tasks.count())),
|
|
});
|
|
const TaskComment2 = await TaskComments.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (TaskComment2?.setTask)
|
|
{
|
|
await
|
|
TaskComment2.
|
|
setTask(relatedTask2);
|
|
}
|
|
|
|
const relatedTask3 = await Tasks.findOne({
|
|
offset: Math.floor(Math.random() * (await Tasks.count())),
|
|
});
|
|
const TaskComment3 = await TaskComments.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (TaskComment3?.setTask)
|
|
{
|
|
await
|
|
TaskComment3.
|
|
setTask(relatedTask3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateTaskCommentWithAuthor() {
|
|
|
|
const relatedAuthor0 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const TaskComment0 = await TaskComments.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (TaskComment0?.setAuthor)
|
|
{
|
|
await
|
|
TaskComment0.
|
|
setAuthor(relatedAuthor0);
|
|
}
|
|
|
|
const relatedAuthor1 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const TaskComment1 = await TaskComments.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (TaskComment1?.setAuthor)
|
|
{
|
|
await
|
|
TaskComment1.
|
|
setAuthor(relatedAuthor1);
|
|
}
|
|
|
|
const relatedAuthor2 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const TaskComment2 = await TaskComments.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (TaskComment2?.setAuthor)
|
|
{
|
|
await
|
|
TaskComment2.
|
|
setAuthor(relatedAuthor2);
|
|
}
|
|
|
|
const relatedAuthor3 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const TaskComment3 = await TaskComments.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (TaskComment3?.setAuthor)
|
|
{
|
|
await
|
|
TaskComment3.
|
|
setAuthor(relatedAuthor3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateTaskCommentWithOrganization() {
|
|
|
|
const relatedOrganization0 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const TaskComment0 = await TaskComments.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (TaskComment0?.setOrganization)
|
|
{
|
|
await
|
|
TaskComment0.
|
|
setOrganization(relatedOrganization0);
|
|
}
|
|
|
|
const relatedOrganization1 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const TaskComment1 = await TaskComments.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (TaskComment1?.setOrganization)
|
|
{
|
|
await
|
|
TaskComment1.
|
|
setOrganization(relatedOrganization1);
|
|
}
|
|
|
|
const relatedOrganization2 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const TaskComment2 = await TaskComments.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (TaskComment2?.setOrganization)
|
|
{
|
|
await
|
|
TaskComment2.
|
|
setOrganization(relatedOrganization2);
|
|
}
|
|
|
|
const relatedOrganization3 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const TaskComment3 = await TaskComments.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (TaskComment3?.setOrganization)
|
|
{
|
|
await
|
|
TaskComment3.
|
|
setOrganization(relatedOrganization3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateTaskActivityLogWithTask() {
|
|
|
|
const relatedTask0 = await Tasks.findOne({
|
|
offset: Math.floor(Math.random() * (await Tasks.count())),
|
|
});
|
|
const TaskActivityLog0 = await TaskActivityLogs.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (TaskActivityLog0?.setTask)
|
|
{
|
|
await
|
|
TaskActivityLog0.
|
|
setTask(relatedTask0);
|
|
}
|
|
|
|
const relatedTask1 = await Tasks.findOne({
|
|
offset: Math.floor(Math.random() * (await Tasks.count())),
|
|
});
|
|
const TaskActivityLog1 = await TaskActivityLogs.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (TaskActivityLog1?.setTask)
|
|
{
|
|
await
|
|
TaskActivityLog1.
|
|
setTask(relatedTask1);
|
|
}
|
|
|
|
const relatedTask2 = await Tasks.findOne({
|
|
offset: Math.floor(Math.random() * (await Tasks.count())),
|
|
});
|
|
const TaskActivityLog2 = await TaskActivityLogs.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (TaskActivityLog2?.setTask)
|
|
{
|
|
await
|
|
TaskActivityLog2.
|
|
setTask(relatedTask2);
|
|
}
|
|
|
|
const relatedTask3 = await Tasks.findOne({
|
|
offset: Math.floor(Math.random() * (await Tasks.count())),
|
|
});
|
|
const TaskActivityLog3 = await TaskActivityLogs.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (TaskActivityLog3?.setTask)
|
|
{
|
|
await
|
|
TaskActivityLog3.
|
|
setTask(relatedTask3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateTaskActivityLogWithActor() {
|
|
|
|
const relatedActor0 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const TaskActivityLog0 = await TaskActivityLogs.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (TaskActivityLog0?.setActor)
|
|
{
|
|
await
|
|
TaskActivityLog0.
|
|
setActor(relatedActor0);
|
|
}
|
|
|
|
const relatedActor1 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const TaskActivityLog1 = await TaskActivityLogs.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (TaskActivityLog1?.setActor)
|
|
{
|
|
await
|
|
TaskActivityLog1.
|
|
setActor(relatedActor1);
|
|
}
|
|
|
|
const relatedActor2 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const TaskActivityLog2 = await TaskActivityLogs.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (TaskActivityLog2?.setActor)
|
|
{
|
|
await
|
|
TaskActivityLog2.
|
|
setActor(relatedActor2);
|
|
}
|
|
|
|
const relatedActor3 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const TaskActivityLog3 = await TaskActivityLogs.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (TaskActivityLog3?.setActor)
|
|
{
|
|
await
|
|
TaskActivityLog3.
|
|
setActor(relatedActor3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateTaskActivityLogWithOrganization() {
|
|
|
|
const relatedOrganization0 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const TaskActivityLog0 = await TaskActivityLogs.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (TaskActivityLog0?.setOrganization)
|
|
{
|
|
await
|
|
TaskActivityLog0.
|
|
setOrganization(relatedOrganization0);
|
|
}
|
|
|
|
const relatedOrganization1 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const TaskActivityLog1 = await TaskActivityLogs.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (TaskActivityLog1?.setOrganization)
|
|
{
|
|
await
|
|
TaskActivityLog1.
|
|
setOrganization(relatedOrganization1);
|
|
}
|
|
|
|
const relatedOrganization2 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const TaskActivityLog2 = await TaskActivityLogs.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (TaskActivityLog2?.setOrganization)
|
|
{
|
|
await
|
|
TaskActivityLog2.
|
|
setOrganization(relatedOrganization2);
|
|
}
|
|
|
|
const relatedOrganization3 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const TaskActivityLog3 = await TaskActivityLogs.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (TaskActivityLog3?.setOrganization)
|
|
{
|
|
await
|
|
TaskActivityLog3.
|
|
setOrganization(relatedOrganization3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateTaskChecklistItemWithTask() {
|
|
|
|
const relatedTask0 = await Tasks.findOne({
|
|
offset: Math.floor(Math.random() * (await Tasks.count())),
|
|
});
|
|
const TaskChecklistItem0 = await TaskChecklistItems.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (TaskChecklistItem0?.setTask)
|
|
{
|
|
await
|
|
TaskChecklistItem0.
|
|
setTask(relatedTask0);
|
|
}
|
|
|
|
const relatedTask1 = await Tasks.findOne({
|
|
offset: Math.floor(Math.random() * (await Tasks.count())),
|
|
});
|
|
const TaskChecklistItem1 = await TaskChecklistItems.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (TaskChecklistItem1?.setTask)
|
|
{
|
|
await
|
|
TaskChecklistItem1.
|
|
setTask(relatedTask1);
|
|
}
|
|
|
|
const relatedTask2 = await Tasks.findOne({
|
|
offset: Math.floor(Math.random() * (await Tasks.count())),
|
|
});
|
|
const TaskChecklistItem2 = await TaskChecklistItems.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (TaskChecklistItem2?.setTask)
|
|
{
|
|
await
|
|
TaskChecklistItem2.
|
|
setTask(relatedTask2);
|
|
}
|
|
|
|
const relatedTask3 = await Tasks.findOne({
|
|
offset: Math.floor(Math.random() * (await Tasks.count())),
|
|
});
|
|
const TaskChecklistItem3 = await TaskChecklistItems.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (TaskChecklistItem3?.setTask)
|
|
{
|
|
await
|
|
TaskChecklistItem3.
|
|
setTask(relatedTask3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function associateTaskChecklistItemWithDone_by() {
|
|
|
|
const relatedDone_by0 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const TaskChecklistItem0 = await TaskChecklistItems.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (TaskChecklistItem0?.setDone_by)
|
|
{
|
|
await
|
|
TaskChecklistItem0.
|
|
setDone_by(relatedDone_by0);
|
|
}
|
|
|
|
const relatedDone_by1 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const TaskChecklistItem1 = await TaskChecklistItems.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (TaskChecklistItem1?.setDone_by)
|
|
{
|
|
await
|
|
TaskChecklistItem1.
|
|
setDone_by(relatedDone_by1);
|
|
}
|
|
|
|
const relatedDone_by2 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const TaskChecklistItem2 = await TaskChecklistItems.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (TaskChecklistItem2?.setDone_by)
|
|
{
|
|
await
|
|
TaskChecklistItem2.
|
|
setDone_by(relatedDone_by2);
|
|
}
|
|
|
|
const relatedDone_by3 = await Users.findOne({
|
|
offset: Math.floor(Math.random() * (await Users.count())),
|
|
});
|
|
const TaskChecklistItem3 = await TaskChecklistItems.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (TaskChecklistItem3?.setDone_by)
|
|
{
|
|
await
|
|
TaskChecklistItem3.
|
|
setDone_by(relatedDone_by3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function associateTaskChecklistItemWithOrganization() {
|
|
|
|
const relatedOrganization0 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const TaskChecklistItem0 = await TaskChecklistItems.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 0
|
|
});
|
|
if (TaskChecklistItem0?.setOrganization)
|
|
{
|
|
await
|
|
TaskChecklistItem0.
|
|
setOrganization(relatedOrganization0);
|
|
}
|
|
|
|
const relatedOrganization1 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const TaskChecklistItem1 = await TaskChecklistItems.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 1
|
|
});
|
|
if (TaskChecklistItem1?.setOrganization)
|
|
{
|
|
await
|
|
TaskChecklistItem1.
|
|
setOrganization(relatedOrganization1);
|
|
}
|
|
|
|
const relatedOrganization2 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const TaskChecklistItem2 = await TaskChecklistItems.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 2
|
|
});
|
|
if (TaskChecklistItem2?.setOrganization)
|
|
{
|
|
await
|
|
TaskChecklistItem2.
|
|
setOrganization(relatedOrganization2);
|
|
}
|
|
|
|
const relatedOrganization3 = await Organizations.findOne({
|
|
offset: Math.floor(Math.random() * (await Organizations.count())),
|
|
});
|
|
const TaskChecklistItem3 = await TaskChecklistItems.findOne({
|
|
order: [['id', 'ASC']],
|
|
offset: 3
|
|
});
|
|
if (TaskChecklistItem3?.setOrganization)
|
|
{
|
|
await
|
|
TaskChecklistItem3.
|
|
setOrganization(relatedOrganization3);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
module.exports = {
|
|
up: async (queryInterface, Sequelize) => {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await Organizations.bulkCreate(OrganizationsData);
|
|
|
|
|
|
|
|
|
|
await Workspaces.bulkCreate(WorkspacesData);
|
|
|
|
|
|
|
|
|
|
await WorkspaceMemberships.bulkCreate(WorkspaceMembershipsData);
|
|
|
|
|
|
|
|
|
|
await Projects.bulkCreate(ProjectsData);
|
|
|
|
|
|
|
|
|
|
await Tags.bulkCreate(TagsData);
|
|
|
|
|
|
|
|
|
|
await Tasks.bulkCreate(TasksData);
|
|
|
|
|
|
|
|
|
|
await TaskComments.bulkCreate(TaskCommentsData);
|
|
|
|
|
|
|
|
|
|
await TaskActivityLogs.bulkCreate(TaskActivityLogsData);
|
|
|
|
|
|
|
|
|
|
await TaskChecklistItems.bulkCreate(TaskChecklistItemsData);
|
|
|
|
|
|
await Promise.all([
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Similar logic for "relation_many"
|
|
|
|
|
|
|
|
|
|
await associateUserWithOrganization(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateWorkspaceWithOwner(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateWorkspaceWithOrganization(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateWorkspaceMembershipWithWorkspace(),
|
|
|
|
|
|
|
|
|
|
await associateWorkspaceMembershipWithUser(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateWorkspaceMembershipWithOrganization(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateProjectWithWorkspace(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateProjectWithOrganization(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateTagWithWorkspace(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateTagWithOrganization(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateTaskWithProject(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateTaskWithAssignee(),
|
|
|
|
|
|
|
|
|
|
await associateTaskWithReporter(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Similar logic for "relation_many"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateTaskWithOrganization(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateTaskCommentWithTask(),
|
|
|
|
|
|
|
|
|
|
await associateTaskCommentWithAuthor(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateTaskCommentWithOrganization(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateTaskActivityLogWithTask(),
|
|
|
|
|
|
|
|
|
|
await associateTaskActivityLogWithActor(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateTaskActivityLogWithOrganization(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateTaskChecklistItemWithTask(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await associateTaskChecklistItemWithDone_by(),
|
|
|
|
|
|
|
|
|
|
await associateTaskChecklistItemWithOrganization(),
|
|
|
|
|
|
|
|
]);
|
|
|
|
},
|
|
|
|
down: async (queryInterface, Sequelize) => {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await queryInterface.bulkDelete('organizations', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('workspaces', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('workspace_memberships', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('projects', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('tags', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('tasks', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('task_comments', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('task_activity_logs', null, {});
|
|
|
|
|
|
await queryInterface.bulkDelete('task_checklist_items', null, {});
|
|
|
|
|
|
},
|
|
}; |