Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API: POST Company Certificates #468

Closed
Tracked by #326
jjeroch opened this issue Jan 30, 2024 · 8 comments
Closed
Tracked by #326

API: POST Company Certificates #468

jjeroch opened this issue Jan 30, 2024 · 8 comments
Assignees
Labels
Sub-task A small piece of work that's part of a larger task.

Comments

@jjeroch
Copy link
Contributor

jjeroch commented Jan 30, 2024

Summary

POST Company Certificate endpoint needed which created a db record of an company certificate uploaded incl. the document storage itself

the implementation of this ticket depends on #471

 

Detail

Suggested API Endpoint: POST /api/administration/companydata/companyCertificate

Request Parameter:

  • media file  (uploaded by the user)
  • certificate type (provided by the frontend - this is the certificate type which is available under the new table + DB Enablement Company Certificates #471 "company_certificate_types") - use the string value of the enum type
  • expiry date (format: yyyy-mm-dd)

Only PDF is allowed and up to 2MB file size

When the POST endpoint is triggered, following activities are executed:

  • document is getting stored inside the documents table 
    • id: new given uuid
    • date_created: upload timestamp 
    • document_hash: document hash
    • document_name: name of the document file
    • document_type_id: always id "15"
    • document_status_id: always "locked"
    • company_user_id: user uploaded the file
    • media_type_id: media type given by the file (content type of the file)
    • date_last_changed: upload timestamp 
    • last_editor_id: user uploaded the file
  • company_certificate table is getting filled and new uploaded document_id is added
    • valid from date is set with the current timestamp
    • type: depending on the type submitted
    • expiry date: handed over by FE or null

 

Validation:

  • Acting user must have the role „upload_certificates“ assigned

 

Related Tickets


DB Changes to enable the feature: #471

FrontEnd-Implementation Ticket: CPLP-3662

Backend API Development CPLP-3655, CPLP-3656


Components: N/A
Sprints: PI 12 - S1 - CPLP
Fix Versions: N/A
StoryPoints: N/A
Attachments: CPLP-3657-image-2023-12-27-13-15-51-660.png, CPLP-3657-image-2023-12-27-13-37-47-123.png

@jjeroch jjeroch added Back-End Sub-task A small piece of work that's part of a larger task. labels Jan 30, 2024
@jjeroch jjeroch added this to the Version CX Release 24.03 milestone Jan 30, 2024
@jjeroch jjeroch changed the title API: POST Company Certificates (ext: CPLP-3657) API: POST Company Certificates Jan 30, 2024
@jjeroch jjeroch removed the Back-End label Jan 30, 2024
@jjeroch jjeroch added this to Portal Jan 30, 2024
@github-project-automation github-project-automation bot moved this to NEW USER REQUEST in Portal Jan 30, 2024
@jjeroch jjeroch moved this from NEW USER REQUEST to IN PROGRESS in Portal Jan 30, 2024
@AnuragNagpure
Copy link
Contributor

AnuragNagpure commented Feb 7, 2024

Below PR is for CD portal
eclipse-tractusx/portal#174

@Phil91
Copy link
Member

Phil91 commented Feb 8, 2024

Not sure if I understand the ticket correctly, so I summarise my understanding:

The endpoint should provide the possibility to create a company certificate while uploading a document at the same time.

@jjeroch correct?

Then we should remove the certificateId from the url since we're creating the certificate and therefore no id is available.
If the ticket should only upload the document the description needs some updates

@jjeroch
Copy link
Contributor Author

jjeroch commented Feb 9, 2024

@Phil91 right - the endpoint is used to create the company certificate record in the portal db and automatically also stores the document itself inside the document table.
The certificateID is probably a wrong naming from my side - what I wanna state here is the certificate type:

image

or would you add this inside the POST endpoint?

@jjeroch
Copy link
Contributor Author

jjeroch commented Feb 9, 2024

ok I understood - we have the company certificate type in the body so we can change the
Endpoint Path
from: POST /api/administration/companydata/companyCertificate/{certificateId}/document
to: POST /api/administration/companydata/companyCertificate

Phil91 added a commit to catenax-ng/tx-portal-backend that referenced this issue Feb 13, 2024
Phil91 added a commit to catenax-ng/tx-portal-backend that referenced this issue Feb 13, 2024
Phil91 added a commit that referenced this issue Feb 13, 2024
* added endpoint POST /api/administration/companydata/companyCertificate to create company certificates
* added migration 

---------

Refs: #468
Co-authored-by: Phil Schneider <[email protected]>
Reviewed-by: Phil Schneider <[email protected]>
@AnuragNagpure AnuragNagpure moved this from IN PROGRESS to IN REVIEW in Portal Feb 14, 2024
@AnuragNagpure AnuragNagpure moved this from IN REVIEW to IN PROGRESS in Portal Feb 14, 2024
@Phil91
Copy link
Member

Phil91 commented Feb 14, 2024

successfully tested on the rc environment

@Phil91 Phil91 moved this from IN PROGRESS to IN REVIEW in Portal Feb 14, 2024
AnuragNagpure pushed a commit to catenax-ng/tx-portal-backend that referenced this issue Feb 14, 2024
Phil91 added a commit to catenax-ng/tx-portal-backend that referenced this issue Feb 17, 2024
@jjeroch
Copy link
Contributor Author

jjeroch commented Feb 22, 2024

@AnuragNagpure can you please recheck the implementation.
As per the description the document is supposed to get uploaded in status: document_status_id: "locked"

Can you please recheck this once and in case this is not yet implemented please raise a pr against the dev branch

@jjeroch jjeroch moved this from IN REVIEW to IN PROGRESS in Portal Feb 22, 2024
@jjeroch
Copy link
Contributor Author

jjeroch commented Mar 4, 2024

@AnuragNagpure is the comment above already solved?

@AnuragNagpure
Copy link
Contributor

@jjeroch No it needs to merge as #462 and #463 merging is pending after this that changes will get merged.

Phil91 pushed a commit that referenced this issue Mar 5, 2024
…icate (#551)

* adjust company certificate status to INACTIVE
----------
Refs: #468
Reviewed-By: Phil Schneider <[email protected]>
@AnuragNagpure AnuragNagpure moved this from IN PROGRESS to IN REVIEW in Portal Mar 5, 2024
@jjeroch jjeroch moved this from IN REVIEW to USER READY in Portal Mar 31, 2024
@msinamci msinamci closed this as completed Apr 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Sub-task A small piece of work that's part of a larger task.
Projects
Archived in project
Development

No branches or pull requests

4 participants