Skip to content

[$50] PUT requests work same like PATCH requests #142

Closed
@maxceem

Description

@maxceem

We have PUT and PATCH requests. Their logic suppose to be different, but they work the same and have the logic of the PATCH request.

Example:

Create Job with "workload": "full-time":

{
  "projectId": {{projectId}},
  "numPositions": 13,
  "resourceType": "Dummy Resource Type",
  "workload": "full-time",
  "skills": [],
  "title": "Dummy title - at most 64 characters"
}

Now PUT the same job using the same request, but without workload field:

{
  "projectId": {{projectId}},
  "numPositions": 13,
  "resourceType": "Dummy Resource Type",
  "skills": [],
  "title": "Dummy title - at most 64 characters UPDATED"
}

The expected outcome of the PUT operation is that it replaces the whole Job object with a new object. But it merges previous object with a new object like a PATCH request and the resulting object still has workload:

{
    "id": "0668312e-f60f-44e9-94e2-bf3172f173f2",
    "projectId": 111,
    "numPositions": 13,
    "resourceType": "Dummy Resource Type",
    "workload": "full-time",
    "skills": [],
    "title": "Dummy title - at most 64 characters UPDATED",
    "status": "sourcing",
    "createdBy": "57646ff9-1cd3-4d3c-88ba-eb09a395366c",
    "updatedAt": "2021-02-09T09:12:11.568Z",
    "createdAt": "2021-02-09T09:09:47.090Z",
    "externalId": null,
    "description": null,
    "startDate": null,
    "endDate": null,
    "rateType": null,
    "updatedBy": "57646ff9-1cd3-4d3c-88ba-eb09a395366c"
}

We have to fix the PUT logic, so when we PUT a new object all existent values are replaced with new values as if we created a new object using new data. All previous data of the object should disappear (except "createdBy"/"createdAt").

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions