feat(coding): add durable project identity core
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import type { IncomingMessage, ServerResponse } from 'node:http';
|
||||
import type { ProjectType } from '../../../shared/project-config';
|
||||
import type { ProjectIdentityChoice } from '../../../shared/coding-project-contracts';
|
||||
import type { CodingProjectConfigSnapshot } from '../../coding-projects/project-service';
|
||||
import type { CodingProject } from '../../coding-projects/project-store';
|
||||
import type { HostApiContext } from '../context';
|
||||
@@ -65,10 +66,41 @@ export async function handleCodingProjectRoutes(
|
||||
parentPath?: string;
|
||||
projectName?: string;
|
||||
projectType?: ProjectType;
|
||||
identity: ProjectIdentityChoice;
|
||||
}>(req);
|
||||
sendJson(res, 201, { snapshot: publicProjectSnapshot(await projects.createProject(body)) });
|
||||
return true;
|
||||
}
|
||||
if (url.pathname === '/api/coding/projects/identity' && req.method === 'POST') {
|
||||
const body = await parseJsonBody<{
|
||||
localProjectId?: string;
|
||||
identity: ProjectIdentityChoice;
|
||||
}>(req);
|
||||
sendJson(res, 200, {
|
||||
snapshot: publicProjectSnapshot(
|
||||
await projects.resolveProjectIdentity(
|
||||
body.localProjectId ?? '',
|
||||
body.identity,
|
||||
),
|
||||
),
|
||||
});
|
||||
return true;
|
||||
}
|
||||
if (url.pathname === '/api/coding/projects/identity/independent-copy' && req.method === 'POST') {
|
||||
const body = await parseJsonBody<{
|
||||
localProjectId?: string;
|
||||
confirmed: unknown;
|
||||
}>(req);
|
||||
sendJson(res, 200, {
|
||||
snapshot: publicProjectSnapshot(
|
||||
await projects.makeProjectIndependentCopy(
|
||||
body.localProjectId ?? '',
|
||||
body.confirmed as true,
|
||||
),
|
||||
),
|
||||
});
|
||||
return true;
|
||||
}
|
||||
if (url.pathname === '/api/coding/projects/remove' && req.method === 'POST') {
|
||||
const body = await parseJsonBody<{ projectId?: string }>(req);
|
||||
await projects.removeProject(body.projectId ?? '');
|
||||
|
||||
Reference in New Issue
Block a user