u
This commit is contained in:
@@ -9,6 +9,7 @@ export const entity = {
|
||||
* GET /api/entity → { entities: Entity[] }
|
||||
* Optional query: customergroupId
|
||||
*/
|
||||
// #region GET /api/entity — list
|
||||
list({ customergroupId } = {}) {
|
||||
const qs =
|
||||
customergroupId != null
|
||||
@@ -16,83 +17,110 @@ export const entity = {
|
||||
: '';
|
||||
return http(`/api/entity${qs}`);
|
||||
},
|
||||
// #endregion
|
||||
|
||||
/** GET /api/entity/:id → { entity: Entity } */
|
||||
// #region GET /api/entity/:id — get
|
||||
get(id) {
|
||||
return http(`/api/entity/${id}`);
|
||||
},
|
||||
// #endregion
|
||||
|
||||
/**
|
||||
* POST /api/entity
|
||||
* Body: { customergroupId, name, firstName? }
|
||||
* → 201 { entity: Entity }
|
||||
*/
|
||||
// #region POST /api/entity — create
|
||||
create(body) {
|
||||
return http('/api/entity', { method: 'POST', body });
|
||||
},
|
||||
// #endregion
|
||||
|
||||
/**
|
||||
* PATCH /api/entity/:id
|
||||
* Body: { name?, firstName? }
|
||||
* → 200 { entity: Entity }
|
||||
*/
|
||||
// #region PATCH /api/entity/:id — update
|
||||
update(id, body) {
|
||||
return http(`/api/entity/${id}`, { method: 'PATCH', body });
|
||||
},
|
||||
// #endregion
|
||||
|
||||
/** DELETE /api/entity/:id → 204 */
|
||||
// #region DELETE /api/entity/:id — delete
|
||||
delete(id) {
|
||||
return http(`/api/entity/${id}`, { method: 'DELETE' });
|
||||
},
|
||||
// #endregion
|
||||
|
||||
/** GET /api/entity/next-number → { number: string } */
|
||||
// #region GET /api/entity/next-number — nextNumber
|
||||
nextNumber() {
|
||||
return http('/api/entity/next-number');
|
||||
},
|
||||
// #endregion
|
||||
|
||||
/** GET /api/entity/:entityId/address → { addresses: EntityAddress[] } */
|
||||
// #region GET /api/entity/:entityId/address — listAddresses
|
||||
listAddresses(entityId) {
|
||||
return http(`/api/entity/${entityId}/address`);
|
||||
},
|
||||
// #endregion
|
||||
|
||||
/** POST /api/entity/:entityId/address → 201 { address } */
|
||||
// #region POST /api/entity/:entityId/address — createAddress
|
||||
createAddress(entityId, body) {
|
||||
return http(`/api/entity/${entityId}/address`, { method: 'POST', body });
|
||||
},
|
||||
// #endregion
|
||||
|
||||
/** PATCH /api/entity/:entityId/address/:id → { address } */
|
||||
// #region PATCH /api/entity/:entityId/address/:id — updateAddress
|
||||
updateAddress(entityId, id, body) {
|
||||
return http(`/api/entity/${entityId}/address/${id}`, {
|
||||
method: 'PATCH',
|
||||
body,
|
||||
});
|
||||
},
|
||||
// #endregion
|
||||
|
||||
/** DELETE /api/entity/:entityId/address/:id → 204 */
|
||||
// #region DELETE /api/entity/:entityId/address/:id — deleteAddress
|
||||
deleteAddress(entityId, id) {
|
||||
return http(`/api/entity/${entityId}/address/${id}`, { method: 'DELETE' });
|
||||
},
|
||||
// #endregion
|
||||
|
||||
/** GET /api/entity/:entityId/contact → { contacts: EntityContact[] } */
|
||||
// #region GET /api/entity/:entityId/contact — listContacts
|
||||
listContacts(entityId) {
|
||||
return http(`/api/entity/${entityId}/contact`);
|
||||
},
|
||||
// #endregion
|
||||
|
||||
/** POST /api/entity/:entityId/contact → 201 { contact } */
|
||||
// #region POST /api/entity/:entityId/contact — createContact
|
||||
createContact(entityId, body) {
|
||||
return http(`/api/entity/${entityId}/contact`, { method: 'POST', body });
|
||||
},
|
||||
// #endregion
|
||||
|
||||
/** PATCH /api/entity/:entityId/contact/:id → { contact } */
|
||||
// #region PATCH /api/entity/:entityId/contact/:id — updateContact
|
||||
updateContact(entityId, id, body) {
|
||||
return http(`/api/entity/${entityId}/contact/${id}`, {
|
||||
method: 'PATCH',
|
||||
body,
|
||||
});
|
||||
},
|
||||
// #endregion
|
||||
|
||||
/** DELETE /api/entity/:entityId/contact/:id → 204 */
|
||||
// #region DELETE /api/entity/:entityId/contact/:id — deleteContact
|
||||
deleteContact(entityId, id) {
|
||||
return http(`/api/entity/${entityId}/contact/${id}`, { method: 'DELETE' });
|
||||
},
|
||||
// #endregion
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user