Skip to content

Commit

Permalink
Fix check product
Browse files Browse the repository at this point in the history
  • Loading branch information
FyreByrd committed Oct 7, 2024
1 parent f34c27d commit 1c523f9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
1 change: 1 addition & 0 deletions source/SIL.AppBuilder.Portal/common/BullJobTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ export interface CheckCreateProjectJob {
type: ScriptoriaJobType.CheckCreateProject;
workflowProjectId: number;
organizationId: number;
projectId: number;
}

export type ScriptoriaJob = JobTypeMap[keyof JobTypeMap];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export type ProjectConfig = {
export type ProjectResponse = SuccessResponse &
ProjectConfig & {
responseType: 'project';
status: 'initialized' | 'accepted' | 'complete' | 'delete' | 'deleting';
status: 'initialized' | 'accepted' | 'completed' | 'delete' | 'deleting';
result: 'SUCCESS' | 'FAILURE' | null;
error: string | null;
url: string;
Expand Down
13 changes: 10 additions & 3 deletions source/SIL.AppBuilder.Portal/node-server/job-executors/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ export class CreateProject extends ScriptoriaJobExecutor<BullMQ.ScriptoriaJobTyp
} else {
await DatabaseWrites.projects.update(job.data.projectId, {
WorkflowProjectId: response.id,
WorkflowProjectUrl: response.url,
WorkflowAppProjectUrl: `${process.env.UI_URL ?? 'http://localhost:5173'}/projects/${job.data.projectId}`,
DateUpdated: new Date()
});
Expand All @@ -53,7 +52,8 @@ export class CreateProject extends ScriptoriaJobExecutor<BullMQ.ScriptoriaJobTyp
{
type: BullMQ.ScriptoriaJobType.CheckCreateProject,
workflowProjectId: response.id,
organizationId: projectData.OrganizationId
organizationId: projectData.OrganizationId,
projectId: job.data.projectId
},
{
repeat: {
Expand All @@ -80,11 +80,18 @@ export class CheckCreateProject extends ScriptoriaJobExecutor<BullMQ.ScriptoriaJ
job.log(response.message);
throw new Error(response.message);
} else {
if (response.status === 'complete') {
if (response.status === 'completed') {
await scriptoriaQueue.removeRepeatableByKey(job.repeatJobKey);
if (response.error) {
job.log(response.error);
}
else {
await DatabaseWrites.projects.update(job.data.projectId, {
WorkflowProjectUrl: response.url,
DateUpdated: new Date()
});
}

job.updateProgress(100);
return response.id;
}
Expand Down

0 comments on commit 1c523f9

Please sign in to comment.