mirror of
https://github.com/plankanban/planka.git
synced 2025-12-19 17:23:27 +03:00
feat: Add ability to move lists between boards (#1208)
This commit is contained in:
@@ -52,13 +52,13 @@ const getOneTrashByBoardId = (boardId) =>
|
||||
});
|
||||
|
||||
const updateOne = async (criteria, values) => {
|
||||
if (values.type) {
|
||||
if (values.boardId || values.type) {
|
||||
return sails.getDatastore().transaction(async (db) => {
|
||||
const [whereQuery, whereQueryValues] = buildWhereQuery(criteria);
|
||||
|
||||
const queryResult = await sails
|
||||
.sendNativeQuery(
|
||||
`SELECT type FROM list WHERE ${whereQuery} LIMIT 1 FOR UPDATE`,
|
||||
`SELECT board_id, type FROM list WHERE ${whereQuery} LIMIT 1 FOR UPDATE`,
|
||||
whereQueryValues,
|
||||
)
|
||||
.usingConnection(db);
|
||||
@@ -68,6 +68,7 @@ const updateOne = async (criteria, values) => {
|
||||
}
|
||||
|
||||
const prev = {
|
||||
boardId: queryResult.rows[0].board_id,
|
||||
type: queryResult.rows[0].type,
|
||||
};
|
||||
|
||||
@@ -79,6 +80,17 @@ const updateOne = async (criteria, values) => {
|
||||
let tasks = [];
|
||||
|
||||
if (list) {
|
||||
if (list.boardId !== prev.boardId) {
|
||||
await Card.update(
|
||||
{
|
||||
listId: list.id,
|
||||
},
|
||||
{
|
||||
boardId: list.boardId,
|
||||
},
|
||||
).usingConnection(db);
|
||||
}
|
||||
|
||||
const prevTypeState = List.TYPE_STATE_BY_TYPE[prev.type];
|
||||
const typeState = List.TYPE_STATE_BY_TYPE[list.type];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user