u
This commit is contained in:
@@ -117,7 +117,7 @@ Backend mapping:
|
|||||||
| --- | --- | --- |
|
| --- | --- | --- |
|
||||||
| `create` | `({ parentId, sort })` | `id` |
|
| `create` | `({ parentId, sort })` | `id` |
|
||||||
| `updateParentId` | `(id, parentId)` | `void` |
|
| `updateParentId` | `(id, parentId)` | `void` |
|
||||||
| `delete` | `(id)` | `void` |
|
| `delete` | `(id)` | `void` — blocked by FK if `categoryarticle` (or child categories) still reference it |
|
||||||
| `getTree` | `(rootId)` | `{ id, parentId, sort }[]` |
|
| `getTree` | `(rootId)` | `{ id, parentId, sort }[]` |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|||||||
@@ -332,7 +332,7 @@ BEGIN
|
|||||||
id INT IDENTITY(1,1) PRIMARY KEY,
|
id INT IDENTITY(1,1) PRIMARY KEY,
|
||||||
category_id INT NOT NULL,
|
category_id INT NOT NULL,
|
||||||
article_id INT NOT NULL,
|
article_id INT NOT NULL,
|
||||||
CONSTRAINT FK_categoryarticle_category FOREIGN KEY (category_id) REFERENCES category(id) ON DELETE CASCADE,
|
CONSTRAINT FK_categoryarticle_category FOREIGN KEY (category_id) REFERENCES category(id) ON DELETE NO ACTION,
|
||||||
CONSTRAINT FK_categoryarticle_article FOREIGN KEY (article_id) REFERENCES article(id) ON DELETE CASCADE,
|
CONSTRAINT FK_categoryarticle_article FOREIGN KEY (article_id) REFERENCES article(id) ON DELETE CASCADE,
|
||||||
CONSTRAINT UQ_categoryarticle_category_article UNIQUE (category_id, article_id)
|
CONSTRAINT UQ_categoryarticle_category_article UNIQUE (category_id, article_id)
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -46,11 +46,14 @@ SELECT
|
|||||||
c.name,
|
c.name,
|
||||||
c.root_category_id AS rootCategoryId,
|
c.root_category_id AS rootCategoryId,
|
||||||
c.default_language_id AS languageId,
|
c.default_language_id AS languageId,
|
||||||
c.taxrate,
|
tr.rate AS taxrate,
|
||||||
c.reducedtaxrate,
|
rtr.rate AS reducedtaxrate,
|
||||||
c.taxfreerate
|
tfr.rate AS taxfreerate
|
||||||
FROM company c
|
FROM company c
|
||||||
INNER JOIN companyuser cu ON cu.company_id = c.id
|
INNER JOIN companyuser cu ON cu.company_id = c.id
|
||||||
|
LEFT JOIN tax tr ON tr.id = c.taxrate
|
||||||
|
LEFT JOIN tax rtr ON rtr.id = c.reducedtaxrate
|
||||||
|
LEFT JOIN tax tfr ON tfr.id = c.taxfreerate
|
||||||
WHERE cu.google_auth_id = @authId
|
WHERE cu.google_auth_id = @authId
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,6 @@ import { DELETE } from '../../sql/category.js';
|
|||||||
|
|
||||||
export default function del(pool) {
|
export default function del(pool) {
|
||||||
return async (id) => {
|
return async (id) => {
|
||||||
await pool
|
await pool.request().input('id', id).query(DELETE);
|
||||||
.request()
|
|
||||||
.input('id', id)
|
|
||||||
.query(DELETE);
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user