Skip to content

Commit

Permalink
feat(db): change responsible user (#58)
Browse files Browse the repository at this point in the history
Allow to change responsible user on db record
  • Loading branch information
srennen authored Jan 3, 2022
1 parent 5fbe0ab commit 27ec3d6
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/components/db.js
Original file line number Diff line number Diff line change
Expand Up @@ -705,3 +705,33 @@ export async function getChildrenOfTerms({
result: response.result,
};
}

export async function changeResponsibility({
secretKey,
collectionName,
id,
newResponsibleUserId,
cluster,
}) {
const response = await server.loadJson(
`${Config.apiUrl}${Endpoints.PROJECT.DATABASE.COLLECTION.RECORD.RESPONSIBILITY(
collectionName,
)}`,
{
method: 'POST',
headers: {
'X-CM-ProjectId': Config.projectId,
'X-CM-Cluster': cluster,
Authorization: `Bearer ${secretKey || Config.secretKey}`,
Accept: 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify({
id,
newResponsibleUserId,
}),
}
);

return response ? response.result : null;
}
1 change: 1 addition & 0 deletions src/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export const CONFIG = {
DELETE_MANY: (collectionName) => `/v2/db/${collectionName}/bulk`,
COUNT: (collectionName) => `/v2/db/${collectionName}/count`,
DISTINCT: (collectionName) => `/v2/db/${collectionName}/distinct`,
RESPONSIBILITY: (collectionName) => `/v2/db/${collectionName}/responsibility`,
},
FILES: {
UPLOAD: (collectionName) => `/v2/db/${collectionName}/files`,
Expand Down

0 comments on commit 27ec3d6

Please sign in to comment.