u
This commit is contained in:
11
src/store/category/delete.js
Normal file
11
src/store/category/delete.js
Normal file
@@ -0,0 +1,11 @@
|
||||
import sql from 'mssql';
|
||||
import { DELETE } from '../../sql/category.js';
|
||||
|
||||
export default function del(pool) {
|
||||
return async (id) => {
|
||||
await pool
|
||||
.request()
|
||||
.input('id', sql.Int, id)
|
||||
.query(DELETE);
|
||||
};
|
||||
}
|
||||
12
src/store/category/updateParentId.js
Normal file
12
src/store/category/updateParentId.js
Normal file
@@ -0,0 +1,12 @@
|
||||
import sql from 'mssql';
|
||||
import { UPDATE_PARENT_ID } from '../../sql/category.js';
|
||||
|
||||
export default function updateParentId(pool) {
|
||||
return async (id, parentId) => {
|
||||
await pool
|
||||
.request()
|
||||
.input('id', sql.Int, id)
|
||||
.input('parentId', sql.Int, parentId)
|
||||
.query(UPDATE_PARENT_ID);
|
||||
};
|
||||
}
|
||||
@@ -1,11 +1,21 @@
|
||||
import sql from 'mssql';
|
||||
import { CREATE } from '../../sql/company.js';
|
||||
import { CREATE as CREATE_CATEGORY } from '../../sql/category.js';
|
||||
|
||||
export default function create(pool) {
|
||||
return async ({ name }) => {
|
||||
const category = await pool
|
||||
.request()
|
||||
.input('parentId', sql.Int, null)
|
||||
.input('sort', sql.Int, 0)
|
||||
.query(CREATE_CATEGORY);
|
||||
|
||||
const rootCategoryId = category.recordset[0].id;
|
||||
|
||||
const result = await pool
|
||||
.request()
|
||||
.input('name', sql.NVarChar(255), name)
|
||||
.input('rootCategoryId', sql.Int, rootCategoryId)
|
||||
.query(CREATE);
|
||||
|
||||
return result.recordset[0].id;
|
||||
|
||||
11
src/store/companyuser/delete.js
Normal file
11
src/store/companyuser/delete.js
Normal file
@@ -0,0 +1,11 @@
|
||||
import sql from 'mssql';
|
||||
import { DELETE } from '../../sql/companyuser.js';
|
||||
|
||||
export default function del(pool) {
|
||||
return async (id) => {
|
||||
await pool
|
||||
.request()
|
||||
.input('id', sql.Int, id)
|
||||
.query(DELETE);
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user