sciagent code + Gitea Actions CI/CD
CI/CD / backend (push) Failing after 2m8s
CI/CD / frontend (push) Failing after 1m40s
CI/CD / deploy (push) Has been skipped

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Thinh Lam
2026-06-30 09:38:30 +07:00
commit 688fac73e9
1167 changed files with 158244 additions and 0 deletions
@@ -0,0 +1,41 @@
/**
* Thin publisher API helpers over the existing research endpoints.
*
* Papers have no dedicated backend: they live in `ResearchProject.content.papers[]`, read via the
* cockpit bundle and written via the merge endpoint (which records an audit row server-side, INV-6).
* There is no per-paper endpoint, so saving is read-modify-write of the whole array.
*/
import {
getCockpit,
listMyProjects,
updateProjectDetail,
type CockpitBundle,
type ResearchProject,
} from '@ump/shared';
import { extractPapers, type Paper } from '../domain/paperModel';
/** Approved projects the investigator owns — the publishable research-result sources. */
export async function listPublishableProjects(): Promise<ResearchProject[]> {
const projects = await listMyProjects();
return projects.filter((p) => p.status === 'approved');
}
export interface ProjectResearch {
bundle: CockpitBundle;
papers: Paper[];
}
/** Read a project's full research results (cockpit) plus its current papers. */
export async function getProjectResearch(projectId: string): Promise<ProjectResearch> {
const bundle = await getCockpit(projectId);
return { bundle, papers: extractPapers(bundle.project.content) };
}
/**
* Persist the whole papers array into `content.papers[]` via the merge endpoint.
* Returns the updated project.
*/
export function savePapers(projectId: string, papers: Paper[]): Promise<ResearchProject> {
return updateProjectDetail(projectId, { papers });
}