Skip to content

Commit

Permalink
remove filter in project service as not needed
Browse files Browse the repository at this point in the history
  • Loading branch information
horatiorosa committed Jan 9, 2025
1 parent 20c57fa commit 239a985
Showing 1 changed file with 1 addition and 15 deletions.
16 changes: 1 addition & 15 deletions server/src/projects/projects.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,28 +124,14 @@ export class ProjectsService {
'[email protected]': `/contacts(${attributes._dcp_applicantadministrator_customer_value})`,
};

const { records } = await this.crmService.get(
'dcp_projects',
// 3e5 = created within 5 minutes
`
$filter=
dcp_projectname eq '${encodeURIComponent(data.dcp_projectname)}'
and createdon ge '${new Date(Date.now() - 3e5).toISOString()}'
`
)

console.debug('LOGGER: crm records', records);
if (records.length > 0) throw new Error('Project already exists');

const project = await this.crmService.create('dcp_projects', data);
// console.debug("LOGGER: (service) project", project);

const dcpProjectId = project['dcp_projectid'];
if (dcpProjectId === undefined) throw new Error('Failed to create project');

const artifact =
await this.artifactService.createProjectInitiationArtifacts(dcpProjectId);

// console.debug('LOGGER: (service) artifact', artifact);
const dcpArtifactsId = artifact['dcp_artifactsid'];
if (dcpArtifactsId === undefined) throw new Error('Failed to create artifact for project');

Expand Down

0 comments on commit 239a985

Please sign in to comment.