Add tsoa create endpoints for orgs users and projects
This commit is contained in:
@@ -3,7 +3,17 @@ import { mkdtempSync, rmSync } from "node:fs";
|
||||
import { join } from "node:path";
|
||||
import { tmpdir } from "node:os";
|
||||
import { reseedDatabase } from "../src/database";
|
||||
import { createTask, getOrganizationSummary, getTaskDetail, listOrganizations, listTasks, updateTask } from "../src/repository";
|
||||
import {
|
||||
createOrganization,
|
||||
createProject,
|
||||
createTask,
|
||||
createUser,
|
||||
getOrganizationSummary,
|
||||
getTaskDetail,
|
||||
listOrganizations,
|
||||
listTasks,
|
||||
updateTask,
|
||||
} from "../src/repository";
|
||||
|
||||
let tempDir: string | null = null;
|
||||
|
||||
@@ -62,6 +72,36 @@ describe("mock task repository", () => {
|
||||
expect(updated?.assigneeUserId).toBeNull();
|
||||
});
|
||||
|
||||
it("creates organization, user, and project records", () => {
|
||||
const db = createDb();
|
||||
|
||||
const organization = createOrganization(db, {
|
||||
slug: "zenith-labs",
|
||||
name: "Zenith Labs",
|
||||
plan: "starter",
|
||||
industry: "Biotech",
|
||||
});
|
||||
const user = createUser(db, {
|
||||
orgId: organization!.id as string,
|
||||
fullName: "Nora Finch",
|
||||
email: "nora@zenith.example",
|
||||
role: "org_admin",
|
||||
timezone: "Europe/Dublin",
|
||||
});
|
||||
const project = createProject(db, {
|
||||
orgId: organization!.id as string,
|
||||
key: "RND",
|
||||
name: "Research Dashboard",
|
||||
status: "planning",
|
||||
ownerUserId: user!.id as string,
|
||||
dueDate: "2026-09-01",
|
||||
});
|
||||
|
||||
expect(organization?.slug).toBe("zenith-labs");
|
||||
expect(user?.orgId).toBe(organization?.id);
|
||||
expect(project?.ownerUserId).toBe(user?.id);
|
||||
});
|
||||
|
||||
it("returns org summary status counts", () => {
|
||||
const db = createDb();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user