[FEATURE] New Project Display
This commit is contained in:
parent
c50c4ef647
commit
9204c1d332
18 changed files with 247 additions and 45 deletions
|
@ -18,6 +18,8 @@ type CreateCRC = ContractRouteContext<{
|
|||
RequestParamsContract: typeof ProjectContract.ProjectParams;
|
||||
}>;
|
||||
|
||||
type ListCRC = ContractRouteContext<{ RequestParamsContract: typeof ProjectContract.ProjectParams }>;
|
||||
|
||||
export default class ProjectController extends VixpressController {
|
||||
declare pg: PostgresService;
|
||||
constructor(app: Express) {
|
||||
|
@ -45,4 +47,13 @@ export default class ProjectController extends VixpressController {
|
|||
const publicKey = await decrypt(kp.encryptedPublicKey, config.SigningOptions.Keys.KeyPair);
|
||||
return { user: usr, project: proj, publicKey };
|
||||
}
|
||||
|
||||
async list(crc: any): Promise<CProjectContract["ListProjects"]> {
|
||||
const { project: parentProject } = crc.req as UserRequest;
|
||||
const projectPromise = this.pg.project.byId(parentProject.id);
|
||||
const childProjectsPromise = this.pg.project.listChildren(parentProject.id);
|
||||
const [project, childProjects] = await Promise.all([projectPromise, childProjectsPromise]);
|
||||
if (!project) throw ProjectErrors.NotFoundProject;
|
||||
return { project, childProjects };
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue