Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8d74cc1732 | ||
|
|
ea94fe8bf3 | ||
|
|
6052f8999f | ||
|
|
67d1b1c194 | ||
|
|
b3cb8405f5 | ||
|
|
7acaec6d04 | ||
|
|
72896a66b3 | ||
|
|
4be4783251 | ||
|
|
5c6c6a0bcf | ||
|
|
ba178d66fa | ||
|
|
270ce29f87 | ||
|
|
de1ed3c784 | ||
|
|
caf8790f28 | ||
|
|
81436b373d | ||
|
|
cc1e886a31 | ||
|
|
f0e9fe7904 | ||
|
|
5fcea5d651 | ||
|
|
a963d85a66 | ||
|
|
04b42decef | ||
|
|
c065566c15 | ||
|
|
3779bdb053 | ||
|
|
4124ab17d2 |
@@ -0,0 +1,53 @@
|
|||||||
|
name: "🐛 Bug Report"
|
||||||
|
description: Report a bug found while using Planka
|
||||||
|
title: "[Bug]: "
|
||||||
|
labels: ["Type: Bug", "Status: Triage"]
|
||||||
|
body:
|
||||||
|
- type: dropdown
|
||||||
|
id: issue-type
|
||||||
|
attributes:
|
||||||
|
label: Where is the problem occurring?
|
||||||
|
description: Select the part of the application where you encountered the issue.
|
||||||
|
options:
|
||||||
|
- "I encountered the problem while using the application (Frontend)"
|
||||||
|
- "I encountered the problem while interacting with the server (Backend)"
|
||||||
|
- "I'm not sure"
|
||||||
|
- type: dropdown
|
||||||
|
id: browsers
|
||||||
|
attributes:
|
||||||
|
label: What browsers are you seeing the problem on?
|
||||||
|
multiple: true
|
||||||
|
options:
|
||||||
|
- Brave
|
||||||
|
- Chrome
|
||||||
|
- Firefox
|
||||||
|
- Microsoft Edge
|
||||||
|
- Safari
|
||||||
|
- Other
|
||||||
|
- type: textarea
|
||||||
|
id: current-behavior
|
||||||
|
attributes:
|
||||||
|
label: Current behaviour
|
||||||
|
description: A description of what is currently happening, including screenshots and other useful information (**DO NOT INCLUDE PRIVATE INFORMATION**).
|
||||||
|
placeholder: Currently...
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
- type: textarea
|
||||||
|
id: desired-behavior
|
||||||
|
attributes:
|
||||||
|
label: Desired behaviour
|
||||||
|
description: A clear description of what you think should happen.
|
||||||
|
placeholder: In this situation, I expected ...
|
||||||
|
- type: textarea
|
||||||
|
id: reproduction
|
||||||
|
attributes:
|
||||||
|
label: Steps to reproduce
|
||||||
|
description: Clearly describe which steps or actions you have taken to arrive at the problem. If you have some experience with the code, please link to the specific pieces of code.
|
||||||
|
placeholder: I did X, then Y, before arriving at Z, when ERROR ...
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
- type: textarea
|
||||||
|
id: other
|
||||||
|
attributes:
|
||||||
|
label: Other information
|
||||||
|
description: Any other details?
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
name: "✨ Feature Request"
|
||||||
|
description: Suggest a feature or enhancement to improve Planka.
|
||||||
|
labels: ["Type: Idea"]
|
||||||
|
body:
|
||||||
|
- type: dropdown
|
||||||
|
id: idea-type
|
||||||
|
attributes:
|
||||||
|
label: Is this a feature for the backend or frontend?
|
||||||
|
multiple: true
|
||||||
|
options:
|
||||||
|
- Backend
|
||||||
|
- Frontend
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
- type: textarea
|
||||||
|
id: feature
|
||||||
|
attributes:
|
||||||
|
label: What would you like?
|
||||||
|
description: A clear description of the feature or enhancement wanted.
|
||||||
|
placeholder: I'd like to be able to...
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
- type: textarea
|
||||||
|
id: reason
|
||||||
|
attributes:
|
||||||
|
label: Why is this needed?
|
||||||
|
description: A clear description of why this would be useful to have.
|
||||||
|
placeholder: I want this because...
|
||||||
|
- type: textarea
|
||||||
|
id: other
|
||||||
|
attributes:
|
||||||
|
label: Other information
|
||||||
|
placeholder: Any other details?
|
||||||
@@ -15,13 +15,13 @@ type: application
|
|||||||
# This is the chart version. This version number should be incremented each time you make changes
|
# This is the chart version. This version number should be incremented each time you make changes
|
||||||
# to the chart and its templates, including the app version.
|
# to the chart and its templates, including the app version.
|
||||||
# Versions are expected to follow Semantic Versioning (https://semver.org/)
|
# Versions are expected to follow Semantic Versioning (https://semver.org/)
|
||||||
version: 0.1.33
|
version: 0.2.3
|
||||||
|
|
||||||
# This is the version number of the application being deployed. This version number should be
|
# This is the version number of the application being deployed. This version number should be
|
||||||
# incremented each time you make changes to the application. Versions are not expected to
|
# incremented each time you make changes to the application. Versions are not expected to
|
||||||
# follow Semantic Versioning. They should reflect the version the application is using.
|
# follow Semantic Versioning. They should reflect the version the application is using.
|
||||||
# It is recommended to use it with quotes.
|
# It is recommended to use it with quotes.
|
||||||
appVersion: "1.17.5"
|
appVersion: "1.19.2"
|
||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
- alias: postgresql
|
- alias: postgresql
|
||||||
|
|||||||
@@ -90,17 +90,37 @@ spec:
|
|||||||
value: http://localhost:3000
|
value: http://localhost:3000
|
||||||
{{- end }}
|
{{- end }}
|
||||||
- name: SECRET_KEY
|
- name: SECRET_KEY
|
||||||
|
{{- if .Values.existingSecretkeySecret }}
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: {{ .Values.existingSecretkeySecret }}
|
||||||
|
key: key
|
||||||
|
{{- else }}
|
||||||
value: {{ required "A secret key needs to be generated using 'openssl rand -hex 64' and assigned to secretkey." .Values.secretkey }}
|
value: {{ required "A secret key needs to be generated using 'openssl rand -hex 64' and assigned to secretkey." .Values.secretkey }}
|
||||||
|
{{- end }}
|
||||||
- name: TRUST_PROXY
|
- name: TRUST_PROXY
|
||||||
value: "0"
|
value: "0"
|
||||||
- name: DEFAULT_ADMIN_EMAIL
|
- name: DEFAULT_ADMIN_EMAIL
|
||||||
value: {{ .Values.admin_email }}
|
value: {{ .Values.admin_email }}
|
||||||
- name: DEFAULT_ADMIN_PASSWORD
|
|
||||||
value: {{ .Values.admin_password }}
|
|
||||||
- name: DEFAULT_ADMIN_NAME
|
- name: DEFAULT_ADMIN_NAME
|
||||||
value: {{ .Values.admin_name }}
|
value: {{ .Values.admin_name }}
|
||||||
|
{{- if .Values.existingAdminCredsSecret }}
|
||||||
|
- name: DEFAULT_ADMIN_USERNAME
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: {{ .Values.existingAdminCredsSecret }}
|
||||||
|
key: username
|
||||||
|
- name: DEFAULT_ADMIN_PASSWORD
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: {{ .Values.existingAdminCredsSecret }}
|
||||||
|
key: password
|
||||||
|
{{- else }}
|
||||||
- name: DEFAULT_ADMIN_USERNAME
|
- name: DEFAULT_ADMIN_USERNAME
|
||||||
value: {{ .Values.admin_username }}
|
value: {{ .Values.admin_username }}
|
||||||
|
- name: DEFAULT_ADMIN_PASSWORD
|
||||||
|
value: {{ .Values.admin_password }}
|
||||||
|
{{- end }}
|
||||||
{{ range $k, $v := .Values.env }}
|
{{ range $k, $v := .Values.env }}
|
||||||
- name: {{ $k | quote }}
|
- name: {{ $k | quote }}
|
||||||
value: {{ $v | quote }}
|
value: {{ $v | quote }}
|
||||||
|
|||||||
@@ -17,6 +17,16 @@ fullnameOverride: ""
|
|||||||
# Generate a secret using openssl rand -base64 45
|
# Generate a secret using openssl rand -base64 45
|
||||||
secretkey: ""
|
secretkey: ""
|
||||||
|
|
||||||
|
## @param existingSecretkeySecret Name of an existing secret containing the session key string
|
||||||
|
## NOTE: Must contain key `key`
|
||||||
|
## NOTE: When it's set, the secretkey parameter is ignored
|
||||||
|
existingSecretkeySecret: ""
|
||||||
|
|
||||||
|
## @param existingAdminCredsSecret Name of an existing secret containing the admin username and password
|
||||||
|
## NOTE: Must contain keys `username` and `password`
|
||||||
|
## NOTE: When it's set, the `admin_username` and `admin_password` parameters are ignored
|
||||||
|
existingAdminCredsSecret: ""
|
||||||
|
|
||||||
# Base url for Planka. Will override `ingress.hosts[0].host`
|
# Base url for Planka. Will override `ingress.hosts[0].host`
|
||||||
# Defaults to `http://localhost:3000` if ingress is disabled.
|
# Defaults to `http://localhost:3000` if ingress is disabled.
|
||||||
baseUrl: ""
|
baseUrl: ""
|
||||||
|
|||||||
+1
-1
@@ -1 +1 @@
|
|||||||
REACT_APP_VERSION=1.17.5
|
REACT_APP_VERSION=1.19.2
|
||||||
|
|||||||
@@ -57,10 +57,15 @@ updateCard.failure = (id, error) => ({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const handleCardUpdate = (card) => ({
|
const handleCardUpdate = (card, isFetched, cardMemberships, cardLabels, tasks, attachments) => ({
|
||||||
type: ActionTypes.CARD_UPDATE_HANDLE,
|
type: ActionTypes.CARD_UPDATE_HANDLE,
|
||||||
payload: {
|
payload: {
|
||||||
card,
|
card,
|
||||||
|
isFetched,
|
||||||
|
cardMemberships,
|
||||||
|
cardLabels,
|
||||||
|
tasks,
|
||||||
|
attachments,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import TextareaAutosize from 'react-textarea-autosize';
|
|||||||
import { Button, Form, TextArea } from 'semantic-ui-react';
|
import { Button, Form, TextArea } from 'semantic-ui-react';
|
||||||
|
|
||||||
import { useClosableForm, useField } from '../../hooks';
|
import { useClosableForm, useField } from '../../hooks';
|
||||||
|
import { focusEnd } from '../../utils/element-helpers';
|
||||||
|
|
||||||
import styles from './NameEdit.module.scss';
|
import styles from './NameEdit.module.scss';
|
||||||
|
|
||||||
@@ -79,7 +80,7 @@ const NameEdit = React.forwardRef(({ children, defaultValue, onUpdate }, ref) =>
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (isOpened) {
|
if (isOpened) {
|
||||||
field.current.ref.current.focus();
|
focusEnd(field.current.ref.current);
|
||||||
}
|
}
|
||||||
}, [isOpened]);
|
}, [isOpened]);
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import TextareaAutosize from 'react-textarea-autosize';
|
|||||||
import { Button, Form, TextArea } from 'semantic-ui-react';
|
import { Button, Form, TextArea } from 'semantic-ui-react';
|
||||||
|
|
||||||
import { useForm } from '../../../hooks';
|
import { useForm } from '../../../hooks';
|
||||||
|
import { focusEnd } from '../../../utils/element-helpers';
|
||||||
|
|
||||||
import styles from './CommentEdit.module.scss';
|
import styles from './CommentEdit.module.scss';
|
||||||
|
|
||||||
@@ -70,7 +71,7 @@ const CommentEdit = React.forwardRef(({ children, defaultData, onUpdate }, ref)
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (isOpened) {
|
if (isOpened) {
|
||||||
textField.current.ref.current.focus();
|
focusEnd(textField.current.ref.current);
|
||||||
}
|
}
|
||||||
}, [isOpened]);
|
}, [isOpened]);
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import React, { useCallback, useRef } from 'react';
|
import React, { useCallback, useRef, useState } from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
@@ -81,6 +81,7 @@ const CardModal = React.memo(
|
|||||||
onClose,
|
onClose,
|
||||||
}) => {
|
}) => {
|
||||||
const [t] = useTranslation();
|
const [t] = useTranslation();
|
||||||
|
const [isLinkCopied, setIsLinkCopied] = useState(false);
|
||||||
|
|
||||||
const isGalleryOpened = useRef(false);
|
const isGalleryOpened = useRef(false);
|
||||||
|
|
||||||
@@ -146,6 +147,14 @@ const CardModal = React.memo(
|
|||||||
onClose();
|
onClose();
|
||||||
}, [onDuplicate, onClose]);
|
}, [onDuplicate, onClose]);
|
||||||
|
|
||||||
|
const handleCopyLinkClick = useCallback(() => {
|
||||||
|
navigator.clipboard.writeText(window.location.href);
|
||||||
|
setIsLinkCopied(true);
|
||||||
|
setTimeout(() => {
|
||||||
|
setIsLinkCopied(false);
|
||||||
|
}, 5000);
|
||||||
|
}, []);
|
||||||
|
|
||||||
const handleGalleryOpen = useCallback(() => {
|
const handleGalleryOpen = useCallback(() => {
|
||||||
isGalleryOpened.current = true;
|
isGalleryOpened.current = true;
|
||||||
}, []);
|
}, []);
|
||||||
@@ -506,6 +515,14 @@ const CardModal = React.memo(
|
|||||||
<Icon name="copy outline" className={styles.actionIcon} />
|
<Icon name="copy outline" className={styles.actionIcon} />
|
||||||
{t('action.duplicate')}
|
{t('action.duplicate')}
|
||||||
</Button>
|
</Button>
|
||||||
|
<Button fluid className={styles.actionButton} onClick={handleCopyLinkClick}>
|
||||||
|
<Icon name={isLinkCopied ? 'linkify' : 'unlink'} className={styles.actionIcon} />
|
||||||
|
{isLinkCopied
|
||||||
|
? t('common.linkIsCopied')
|
||||||
|
: t('action.copyLink', {
|
||||||
|
context: 'title',
|
||||||
|
})}
|
||||||
|
</Button>
|
||||||
<DeletePopup
|
<DeletePopup
|
||||||
title="common.deleteCard"
|
title="common.deleteCard"
|
||||||
content="common.areYouSureYouWantToDeleteThisCard"
|
content="common.areYouSureYouWantToDeleteThisCard"
|
||||||
|
|||||||
@@ -20,7 +20,6 @@
|
|||||||
|
|
||||||
.actionIcon {
|
.actionIcon {
|
||||||
color: #17394d;
|
color: #17394d;
|
||||||
display: inline;
|
|
||||||
margin-right: 8px;
|
margin-right: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import TextareaAutosize from 'react-textarea-autosize';
|
|||||||
import { Button, Form, TextArea } from 'semantic-ui-react';
|
import { Button, Form, TextArea } from 'semantic-ui-react';
|
||||||
|
|
||||||
import { useField } from '../../../hooks';
|
import { useField } from '../../../hooks';
|
||||||
|
import { focusEnd } from '../../../utils/element-helpers';
|
||||||
|
|
||||||
import styles from './NameEdit.module.scss';
|
import styles from './NameEdit.module.scss';
|
||||||
|
|
||||||
@@ -65,7 +66,7 @@ const NameEdit = React.forwardRef(({ children, defaultValue, onUpdate }, ref) =>
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (isOpened) {
|
if (isOpened) {
|
||||||
field.current.ref.current.focus();
|
focusEnd(field.current.ref.current);
|
||||||
}
|
}
|
||||||
}, [isOpened]);
|
}, [isOpened]);
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import TextareaAutosize from 'react-textarea-autosize';
|
|||||||
import { TextArea } from 'semantic-ui-react';
|
import { TextArea } from 'semantic-ui-react';
|
||||||
|
|
||||||
import { useField } from '../../hooks';
|
import { useField } from '../../hooks';
|
||||||
|
import { focusEnd } from '../../utils/element-helpers';
|
||||||
|
|
||||||
import styles from './NameEdit.module.scss';
|
import styles from './NameEdit.module.scss';
|
||||||
|
|
||||||
@@ -71,7 +72,7 @@ const NameEdit = React.forwardRef(({ children, defaultValue, onUpdate }, ref) =>
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (isOpened) {
|
if (isOpened) {
|
||||||
field.current.ref.current.select();
|
focusEnd(field.current.ref.current);
|
||||||
}
|
}
|
||||||
}, [isOpened]);
|
}, [isOpened]);
|
||||||
|
|
||||||
|
|||||||
@@ -195,9 +195,6 @@ export default {
|
|||||||
CARD_UPDATE__SUCCESS: 'CARD_UPDATE__SUCCESS',
|
CARD_UPDATE__SUCCESS: 'CARD_UPDATE__SUCCESS',
|
||||||
CARD_UPDATE__FAILURE: 'CARD_UPDATE__FAILURE',
|
CARD_UPDATE__FAILURE: 'CARD_UPDATE__FAILURE',
|
||||||
CARD_UPDATE_HANDLE: 'CARD_UPDATE_HANDLE',
|
CARD_UPDATE_HANDLE: 'CARD_UPDATE_HANDLE',
|
||||||
CARD_TRANSFER: 'CARD_TRANSFER',
|
|
||||||
CARD_TRANSFER__SUCCESS: 'CARD_TRANSFER__SUCCESS',
|
|
||||||
CARD_TRANSFER__FAILURE: 'CARD_TRANSFER__FAILURE',
|
|
||||||
CARD_DUPLICATE: 'CARD_DUPLICATE',
|
CARD_DUPLICATE: 'CARD_DUPLICATE',
|
||||||
CARD_DUPLICATE__SUCCESS: 'CARD_DUPLICATE__SUCCESS',
|
CARD_DUPLICATE__SUCCESS: 'CARD_DUPLICATE__SUCCESS',
|
||||||
CARD_DUPLICATE__FAILURE: 'CARD_DUPLICATE__FAILURE',
|
CARD_DUPLICATE__FAILURE: 'CARD_DUPLICATE__FAILURE',
|
||||||
|
|||||||
@@ -6,12 +6,13 @@ import entryActions from '../entry-actions';
|
|||||||
import Projects from '../components/Projects';
|
import Projects from '../components/Projects';
|
||||||
|
|
||||||
const mapStateToProps = (state) => {
|
const mapStateToProps = (state) => {
|
||||||
|
const { allowAllToCreateProjects } = selectors.selectConfig(state);
|
||||||
const { isAdmin } = selectors.selectCurrentUser(state);
|
const { isAdmin } = selectors.selectCurrentUser(state);
|
||||||
const projects = selectors.selectProjectsForCurrentUser(state);
|
const projects = selectors.selectProjectsForCurrentUser(state);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
items: projects,
|
items: projects,
|
||||||
canAdd: isAdmin,
|
canAdd: allowAllToCreateProjects || isAdmin,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -104,6 +104,7 @@ export default {
|
|||||||
language: 'Sprache',
|
language: 'Sprache',
|
||||||
leaveBoard_title: 'Board verlassen',
|
leaveBoard_title: 'Board verlassen',
|
||||||
leaveProject_title: 'Projekt verlassen',
|
leaveProject_title: 'Projekt verlassen',
|
||||||
|
linkIsCopied: 'Link kopiert',
|
||||||
list: 'Listen',
|
list: 'Listen',
|
||||||
listActions_title: 'Aufgaben auflisten',
|
listActions_title: 'Aufgaben auflisten',
|
||||||
managers: 'Manager',
|
managers: 'Manager',
|
||||||
@@ -169,6 +170,7 @@ export default {
|
|||||||
addTask: 'Aufgabe hinzufügen',
|
addTask: 'Aufgabe hinzufügen',
|
||||||
addToCard: 'Zu Karte hinzufügen',
|
addToCard: 'Zu Karte hinzufügen',
|
||||||
addUser: 'Benutzer hinzufügen',
|
addUser: 'Benutzer hinzufügen',
|
||||||
|
copyLink_title: 'Link kopieren',
|
||||||
createBoard: 'Board erstellen',
|
createBoard: 'Board erstellen',
|
||||||
createFile: 'Datei erstellen',
|
createFile: 'Datei erstellen',
|
||||||
createLabel: 'Label erstellen',
|
createLabel: 'Label erstellen',
|
||||||
@@ -190,6 +192,8 @@ export default {
|
|||||||
deleteTask: 'Aufgabe löschen',
|
deleteTask: 'Aufgabe löschen',
|
||||||
deleteTask_title: 'Aufgabe löschen',
|
deleteTask_title: 'Aufgabe löschen',
|
||||||
deleteUser: 'Benutzer löschen',
|
deleteUser: 'Benutzer löschen',
|
||||||
|
duplicate: 'Kopieren',
|
||||||
|
duplicateCard_title: 'Karte kopieren',
|
||||||
edit: 'Bearbeiten',
|
edit: 'Bearbeiten',
|
||||||
editDueDate_title: 'Fälligkeitsdatum bearbeiten',
|
editDueDate_title: 'Fälligkeitsdatum bearbeiten',
|
||||||
editDescription_title: 'Beschreibung ändern',
|
editDescription_title: 'Beschreibung ändern',
|
||||||
|
|||||||
@@ -106,6 +106,7 @@ export default {
|
|||||||
language: 'Language',
|
language: 'Language',
|
||||||
leaveBoard_title: 'Leave Board',
|
leaveBoard_title: 'Leave Board',
|
||||||
leaveProject_title: 'Leave Project',
|
leaveProject_title: 'Leave Project',
|
||||||
|
linkIsCopied: 'Link is copied',
|
||||||
list: 'List',
|
list: 'List',
|
||||||
listActions_title: 'List Actions',
|
listActions_title: 'List Actions',
|
||||||
managers: 'Managers',
|
managers: 'Managers',
|
||||||
@@ -183,6 +184,7 @@ export default {
|
|||||||
addTask: 'Add task',
|
addTask: 'Add task',
|
||||||
addToCard: 'Add to card',
|
addToCard: 'Add to card',
|
||||||
addUser: 'Add user',
|
addUser: 'Add user',
|
||||||
|
copyLink_title: 'Copy Link',
|
||||||
createBoard: 'Create board',
|
createBoard: 'Create board',
|
||||||
createFile: 'Create file',
|
createFile: 'Create file',
|
||||||
createLabel: 'Create label',
|
createLabel: 'Create label',
|
||||||
|
|||||||
@@ -15,6 +15,16 @@ export default {
|
|||||||
|
|
||||||
translation: {
|
translation: {
|
||||||
common: {
|
common: {
|
||||||
|
aboutPlanka: 'Plankáról',
|
||||||
|
account: 'Fiók',
|
||||||
|
actions: 'Műveletek',
|
||||||
|
addAttachment_title: 'Melléklet hozzáadása',
|
||||||
|
addComment: 'Megjegyzés hozzáadása',
|
||||||
|
addManager_title: 'Menedzser hozzáadása',
|
||||||
|
addMember_title: 'Tag létrehozása',
|
||||||
|
addUser_title: 'Felhasználó hozzáadása',
|
||||||
|
administrator: 'Rendszergazda',
|
||||||
|
all: 'Összes',
|
||||||
allChangesWillBeAutomaticallySavedAfterConnectionRestored:
|
allChangesWillBeAutomaticallySavedAfterConnectionRestored:
|
||||||
'Az összes változás automatikusan mentésre kerül a kapcsolat helyreállása után.',
|
'Az összes változás automatikusan mentésre kerül a kapcsolat helyreállása után.',
|
||||||
areYouSureYouWantToDeleteThisAttachment: 'Biztosan törölni szeretné ezt a mellékletet?',
|
areYouSureYouWantToDeleteThisAttachment: 'Biztosan törölni szeretné ezt a mellékletet?',
|
||||||
@@ -29,7 +39,7 @@ export default {
|
|||||||
areYouSureYouWantToLeaveBoard: 'Biztosan el akarja hagyni a táblát?',
|
areYouSureYouWantToLeaveBoard: 'Biztosan el akarja hagyni a táblát?',
|
||||||
areYouSureYouWantToLeaveProject: 'Biztosan el akarja hagyni a projektet?',
|
areYouSureYouWantToLeaveProject: 'Biztosan el akarja hagyni a projektet?',
|
||||||
areYouSureYouWantToRemoveThisManagerFromProject:
|
areYouSureYouWantToRemoveThisManagerFromProject:
|
||||||
'Biztosan eltávolítja ezt a vezetőt a projektből?',
|
'Biztosan eltávolítja ezt a menedzsert a projektből?',
|
||||||
areYouSureYouWantToRemoveThisMemberFromBoard: 'Biztosan eltávolítja ezt a tagot a tábláról?',
|
areYouSureYouWantToRemoveThisMemberFromBoard: 'Biztosan eltávolítja ezt a tagot a tábláról?',
|
||||||
attachment: 'Melléklet',
|
attachment: 'Melléklet',
|
||||||
attachments: 'Mellékletek',
|
attachments: 'Mellékletek',
|
||||||
@@ -44,6 +54,7 @@ export default {
|
|||||||
cardNotFound_title: 'Kártya nem található',
|
cardNotFound_title: 'Kártya nem található',
|
||||||
cardOrActionAreDeleted: 'A kártya vagy művelet törölve lett.',
|
cardOrActionAreDeleted: 'A kártya vagy művelet törölve lett.',
|
||||||
color: 'Szín',
|
color: 'Szín',
|
||||||
|
copy_inline: 'másolás',
|
||||||
createBoard_title: 'Tábla létrehozása',
|
createBoard_title: 'Tábla létrehozása',
|
||||||
createLabel_title: 'Címke létrehozása',
|
createLabel_title: 'Címke létrehozása',
|
||||||
createNewOneOrSelectExistingOne: 'Hozzon létre egy újat, vagy válasszon ki egy meglévőt.',
|
createNewOneOrSelectExistingOne: 'Hozzon létre egy újat, vagy válasszon ki egy meglévőt.',
|
||||||
@@ -52,6 +63,7 @@ export default {
|
|||||||
currentPassword: 'Jelenlegi jelszó',
|
currentPassword: 'Jelenlegi jelszó',
|
||||||
dangerZone_title: 'Veszélyzóna',
|
dangerZone_title: 'Veszélyzóna',
|
||||||
date: 'Dátum',
|
date: 'Dátum',
|
||||||
|
dueDate: 'Határidő',
|
||||||
dueDate_title: 'Esedékesség dátuma',
|
dueDate_title: 'Esedékesség dátuma',
|
||||||
deleteAttachment_title: 'Melléklet törlése',
|
deleteAttachment_title: 'Melléklet törlése',
|
||||||
deleteBoard_title: 'Tábla törlése',
|
deleteBoard_title: 'Tábla törlése',
|
||||||
@@ -97,13 +109,17 @@ export default {
|
|||||||
language: 'Nyelv',
|
language: 'Nyelv',
|
||||||
leaveBoard_title: 'Tábla elhagyása',
|
leaveBoard_title: 'Tábla elhagyása',
|
||||||
leaveProject_title: 'Projekt elhagyása',
|
leaveProject_title: 'Projekt elhagyása',
|
||||||
|
linkIsCopied: 'Link másolva',
|
||||||
list: 'Lista',
|
list: 'Lista',
|
||||||
listActions_title: 'Lista műveletek',
|
listActions_title: 'Lista műveletek',
|
||||||
managers: 'Vezetők',
|
managers: 'Menedzserek',
|
||||||
|
managerActions_title: 'Menedzseri műveletek',
|
||||||
members: 'Tagok',
|
members: 'Tagok',
|
||||||
|
memberActions_title: 'Tag műveletek',
|
||||||
minutes: 'Percek',
|
minutes: 'Percek',
|
||||||
moveCard_title: 'Kártya áthelyezése',
|
moveCard_title: 'Kártya áthelyezése',
|
||||||
name: 'Név',
|
name: 'Név',
|
||||||
|
newestFirst: 'Újabbak előre',
|
||||||
newEmail: 'Új e-mail',
|
newEmail: 'Új e-mail',
|
||||||
newPassword: 'Új jelszó',
|
newPassword: 'Új jelszó',
|
||||||
newUsername: 'Új felhasználónév',
|
newUsername: 'Új felhasználónév',
|
||||||
@@ -113,6 +129,7 @@ export default {
|
|||||||
noProjects: 'Nincsenek projektek',
|
noProjects: 'Nincsenek projektek',
|
||||||
notifications: 'Értesítések',
|
notifications: 'Értesítések',
|
||||||
noUnreadNotifications: 'Nincsenek olvasatlan értesítések.',
|
noUnreadNotifications: 'Nincsenek olvasatlan értesítések.',
|
||||||
|
oldestFirst: 'Régebbi előre',
|
||||||
openBoard_title: 'Tábla megnyitása',
|
openBoard_title: 'Tábla megnyitása',
|
||||||
optional_inline: 'opcionális',
|
optional_inline: 'opcionális',
|
||||||
organization: 'Szervezet',
|
organization: 'Szervezet',
|
||||||
@@ -122,17 +139,19 @@ export default {
|
|||||||
'Tipp: nyomja meg a Ctrl-V (Cmd-V a Mac-en) billentyűkombinációt a vágólapról történő melléklet hozzáadásához.',
|
'Tipp: nyomja meg a Ctrl-V (Cmd-V a Mac-en) billentyűkombinációt a vágólapról történő melléklet hozzáadásához.',
|
||||||
project: 'Projekt',
|
project: 'Projekt',
|
||||||
projectNotFound_title: 'Projekt nem található',
|
projectNotFound_title: 'Projekt nem található',
|
||||||
removeManager_title: 'Vezető eltávolítása',
|
removeManager_title: 'Menedzser eltávolítása',
|
||||||
removeMember_title: 'Tag eltávolítása',
|
removeMember_title: 'Tag eltávolítása',
|
||||||
searchLabels: 'Címkék keresése...',
|
searchLabels: 'Címkék keresése...',
|
||||||
searchMembers: 'Tagok keresése...',
|
searchMembers: 'Tagok keresése...',
|
||||||
searchUsers: 'Felhasználók keresése...',
|
searchUsers: 'Felhasználók keresése...',
|
||||||
|
searchCards: 'Kártyák keresése..',
|
||||||
seconds: 'Másodpercek',
|
seconds: 'Másodpercek',
|
||||||
selectBoard: 'Válassza ki a táblát',
|
selectBoard: 'Válassza ki a táblát',
|
||||||
selectList: 'Válassza ki a listát',
|
selectList: 'Válassza ki a listát',
|
||||||
selectPermissions_title: 'Jogosultságok kiválasztása',
|
selectPermissions_title: 'Jogosultságok kiválasztása',
|
||||||
selectProject: 'Válassza ki a projektet',
|
selectProject: 'Válassza ki a projektet',
|
||||||
settings: 'Beállítások',
|
settings: 'Beállítások',
|
||||||
|
sortList_title: 'Rendezés listában',
|
||||||
stopwatch: 'Stopper',
|
stopwatch: 'Stopper',
|
||||||
subscribeToMyOwnCardsByDefault: 'Alapértelmezés szerint feliratkozás a saját kártyáimra',
|
subscribeToMyOwnCardsByDefault: 'Alapértelmezés szerint feliratkozás a saját kártyáimra',
|
||||||
taskActions_title: 'Feladat műveletek',
|
taskActions_title: 'Feladat műveletek',
|
||||||
@@ -170,6 +189,7 @@ export default {
|
|||||||
addTask: 'Feladat hozzáadása',
|
addTask: 'Feladat hozzáadása',
|
||||||
addToCard: 'Kártyához hozzáadása',
|
addToCard: 'Kártyához hozzáadása',
|
||||||
addUser: 'Felhasználó hozzáadása',
|
addUser: 'Felhasználó hozzáadása',
|
||||||
|
copyLink_title: 'Link másolása',
|
||||||
createBoard: 'Tábla létrehozása',
|
createBoard: 'Tábla létrehozása',
|
||||||
createFile: 'Fájl létrehozása',
|
createFile: 'Fájl létrehozása',
|
||||||
createLabel: 'Címke létrehozása',
|
createLabel: 'Címke létrehozása',
|
||||||
@@ -191,6 +211,8 @@ export default {
|
|||||||
deleteTask: 'Feladat törlése',
|
deleteTask: 'Feladat törlése',
|
||||||
deleteTask_title: 'Feladat törlése',
|
deleteTask_title: 'Feladat törlése',
|
||||||
deleteUser: 'Felhasználó törlése',
|
deleteUser: 'Felhasználó törlése',
|
||||||
|
duplicate: 'Másolás',
|
||||||
|
duplicateCard_title: 'Kártya másolása',
|
||||||
edit: 'Szerkesztés',
|
edit: 'Szerkesztés',
|
||||||
editDueDate_title: 'Esedékesség dátumának szerkesztése',
|
editDueDate_title: 'Esedékesség dátumának szerkesztése',
|
||||||
editDescription_title: 'Leírás szerkesztése',
|
editDescription_title: 'Leírás szerkesztése',
|
||||||
@@ -214,12 +236,13 @@ export default {
|
|||||||
removeCover_title: 'Borító eltávolítása',
|
removeCover_title: 'Borító eltávolítása',
|
||||||
removeFromBoard: 'Eltávolítás a tábláról',
|
removeFromBoard: 'Eltávolítás a tábláról',
|
||||||
removeFromProject: 'Eltávolítás a projektről',
|
removeFromProject: 'Eltávolítás a projektről',
|
||||||
removeManager: 'Vezető eltávolítása',
|
removeManager: 'Menedzser eltávolítása',
|
||||||
removeMember: 'Tag eltávolítása',
|
removeMember: 'Tag eltávolítása',
|
||||||
save: 'Mentés',
|
save: 'Mentés',
|
||||||
showAllAttachments: 'Összes melléklet megjelenítése ({{hidden}} rejtve)',
|
showAllAttachments: 'Összes melléklet megjelenítése ({{hidden}} rejtve)',
|
||||||
showDetails: 'Részletek megjelenítése',
|
showDetails: 'Részletek megjelenítése',
|
||||||
showFewerAttachments: 'Kevesebb melléklet megjelenítése',
|
showFewerAttachments: 'Kevesebb melléklet megjelenítése',
|
||||||
|
sortList_title: 'Rendezés listában',
|
||||||
start: 'Indítás',
|
start: 'Indítás',
|
||||||
stop: 'Megállítás',
|
stop: 'Megállítás',
|
||||||
subscribe: 'Feliratkozás',
|
subscribe: 'Feliratkozás',
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ export default class extends BaseModel {
|
|||||||
case ActionTypes.CORE_INITIALIZE:
|
case ActionTypes.CORE_INITIALIZE:
|
||||||
case ActionTypes.PROJECT_MANAGER_CREATE_HANDLE:
|
case ActionTypes.PROJECT_MANAGER_CREATE_HANDLE:
|
||||||
case ActionTypes.BOARD_MEMBERSHIP_CREATE_HANDLE:
|
case ActionTypes.BOARD_MEMBERSHIP_CREATE_HANDLE:
|
||||||
|
case ActionTypes.CARD_UPDATE_HANDLE:
|
||||||
if (payload.attachments) {
|
if (payload.attachments) {
|
||||||
payload.attachments.forEach((attachment) => {
|
payload.attachments.forEach((attachment) => {
|
||||||
Attachment.upsert(attachment);
|
Attachment.upsert(attachment);
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import orderBy from 'lodash/orderBy';
|
||||||
import { attr, fk, many } from 'redux-orm';
|
import { attr, fk, many } from 'redux-orm';
|
||||||
|
|
||||||
import BaseModel from './BaseModel';
|
import BaseModel from './BaseModel';
|
||||||
@@ -218,10 +219,6 @@ export default class extends BaseModel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getOrderedMembershipsQuerySet() {
|
|
||||||
return this.memberships.orderBy('createdAt');
|
|
||||||
}
|
|
||||||
|
|
||||||
getOrderedLabelsQuerySet() {
|
getOrderedLabelsQuerySet() {
|
||||||
return this.labels.orderBy('position');
|
return this.labels.orderBy('position');
|
||||||
}
|
}
|
||||||
@@ -230,6 +227,12 @@ export default class extends BaseModel {
|
|||||||
return this.lists.orderBy('position');
|
return this.lists.orderBy('position');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getOrderedMembershipsModelArray() {
|
||||||
|
return orderBy(this.memberships.toModelArray(), (boardMembershipModel) =>
|
||||||
|
boardMembershipModel.user.name.toLocaleLowerCase(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
getMembershipModelForUser(userId) {
|
getMembershipModelForUser(userId) {
|
||||||
return this.memberships
|
return this.memberships
|
||||||
.filter({
|
.filter({
|
||||||
|
|||||||
@@ -180,7 +180,6 @@ export default class extends BaseModel {
|
|||||||
break;
|
break;
|
||||||
case ActionTypes.CARD_CREATE:
|
case ActionTypes.CARD_CREATE:
|
||||||
case ActionTypes.CARD_UPDATE__SUCCESS:
|
case ActionTypes.CARD_UPDATE__SUCCESS:
|
||||||
case ActionTypes.CARD_UPDATE_HANDLE:
|
|
||||||
Card.upsert(payload.card);
|
Card.upsert(payload.card);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@@ -202,8 +201,40 @@ export default class extends BaseModel {
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ActionTypes.CARD_UPDATE:
|
case ActionTypes.CARD_UPDATE: {
|
||||||
Card.withId(payload.id).update(payload.data);
|
const cardModel = Card.withId(payload.id);
|
||||||
|
|
||||||
|
// TODO: introduce separate action?
|
||||||
|
if (payload.data.boardId && payload.data.boardId !== cardModel.boardId) {
|
||||||
|
cardModel.deleteWithRelated();
|
||||||
|
} else {
|
||||||
|
cardModel.update(payload.data);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case ActionTypes.CARD_UPDATE_HANDLE:
|
||||||
|
if (payload.isFetched) {
|
||||||
|
const cardModel = Card.withId(payload.card.id);
|
||||||
|
|
||||||
|
if (cardModel) {
|
||||||
|
cardModel.deleteWithRelated();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Card.upsert(payload.card);
|
||||||
|
|
||||||
|
if (payload.cardMemberships) {
|
||||||
|
payload.cardMemberships.forEach(({ cardId, userId }) => {
|
||||||
|
Card.withId(cardId).users.add(userId);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (payload.cardLabels) {
|
||||||
|
payload.cardLabels.forEach(({ cardId, labelId }) => {
|
||||||
|
Card.withId(cardId).labels.add(labelId);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case ActionTypes.CARD_DUPLICATE: {
|
case ActionTypes.CARD_DUPLICATE: {
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ export default class extends BaseModel {
|
|||||||
case ActionTypes.CORE_INITIALIZE:
|
case ActionTypes.CORE_INITIALIZE:
|
||||||
case ActionTypes.PROJECT_MANAGER_CREATE_HANDLE:
|
case ActionTypes.PROJECT_MANAGER_CREATE_HANDLE:
|
||||||
case ActionTypes.BOARD_MEMBERSHIP_CREATE_HANDLE:
|
case ActionTypes.BOARD_MEMBERSHIP_CREATE_HANDLE:
|
||||||
|
case ActionTypes.CARD_UPDATE_HANDLE:
|
||||||
if (payload.tasks) {
|
if (payload.tasks) {
|
||||||
payload.tasks.forEach((task) => {
|
payload.tasks.forEach((task) => {
|
||||||
Task.upsert(task);
|
Task.upsert(task);
|
||||||
|
|||||||
@@ -298,7 +298,7 @@ export default class extends BaseModel {
|
|||||||
static getOrderedUndeletedQuerySet() {
|
static getOrderedUndeletedQuerySet() {
|
||||||
return this.filter({
|
return this.filter({
|
||||||
deletedAt: null,
|
deletedAt: null,
|
||||||
}).orderBy('createdAt');
|
}).orderBy((user) => user.name.toLocaleLowerCase());
|
||||||
}
|
}
|
||||||
|
|
||||||
getOrderedProjectManagersQuerySet() {
|
getOrderedProjectManagersQuerySet() {
|
||||||
|
|||||||
@@ -81,9 +81,30 @@ export function* updateCurrentCard(data) {
|
|||||||
yield call(updateCard, cardId, data);
|
yield call(updateCard, cardId, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: handle card transfer
|
|
||||||
export function* handleCardUpdate(card) {
|
export function* handleCardUpdate(card) {
|
||||||
yield put(actions.handleCardUpdate(card));
|
let fetch = false;
|
||||||
|
if (card.boardId) {
|
||||||
|
const prevCard = yield select(selectors.selectCardById, card.id);
|
||||||
|
fetch = !prevCard || prevCard.boardId !== card.boardId;
|
||||||
|
}
|
||||||
|
|
||||||
|
let cardMemberships;
|
||||||
|
let cardLabels;
|
||||||
|
let tasks;
|
||||||
|
let attachments;
|
||||||
|
|
||||||
|
if (fetch) {
|
||||||
|
try {
|
||||||
|
({
|
||||||
|
item: card, // eslint-disable-line no-param-reassign
|
||||||
|
included: { cardMemberships, cardLabels, tasks, attachments },
|
||||||
|
} = yield call(request, api.getCard, card.id));
|
||||||
|
} catch (error) {
|
||||||
|
fetch = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
yield put(actions.handleCardUpdate(card, fetch, cardMemberships, cardLabels, tasks, attachments));
|
||||||
}
|
}
|
||||||
|
|
||||||
export function* moveCard(id, listId, index = 0) {
|
export function* moveCard(id, listId, index = 0) {
|
||||||
|
|||||||
@@ -55,17 +55,14 @@ export const selectMembershipsForCurrentBoard = createSelector(
|
|||||||
return boardModel;
|
return boardModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
return boardModel
|
return boardModel.getOrderedMembershipsModelArray().map((boardMembershipModel) => ({
|
||||||
.getOrderedMembershipsQuerySet()
|
...boardMembershipModel.ref,
|
||||||
.toModelArray()
|
isPersisted: !isLocalId(boardMembershipModel.id),
|
||||||
.map((boardMembershipModel) => ({
|
user: {
|
||||||
...boardMembershipModel.ref,
|
...boardMembershipModel.user.ref,
|
||||||
isPersisted: !isLocalId(boardMembershipModel.id),
|
isCurrent: boardMembershipModel.user.id === currentUserId,
|
||||||
user: {
|
},
|
||||||
...boardMembershipModel.user.ref,
|
}));
|
||||||
isCurrent: boardMembershipModel.user.id === currentUserId,
|
|
||||||
},
|
|
||||||
}));
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
// eslint-disable-next-line import/prefer-default-export
|
||||||
|
export const focusEnd = (element) => {
|
||||||
|
element.focus();
|
||||||
|
element.setSelectionRange(element.value.length + 1, element.value.length + 1);
|
||||||
|
};
|
||||||
+14
-4
@@ -1,7 +1,6 @@
|
|||||||
version: '3.8'
|
version: '3.8'
|
||||||
|
|
||||||
services:
|
services:
|
||||||
|
|
||||||
server:
|
server:
|
||||||
build:
|
build:
|
||||||
context: ./server
|
context: ./server
|
||||||
@@ -13,6 +12,7 @@ services:
|
|||||||
- NODE_ENV=development
|
- NODE_ENV=development
|
||||||
- DATABASE_URL=postgresql://user:password@postgres:5432/planka_db
|
- DATABASE_URL=postgresql://user:password@postgres:5432/planka_db
|
||||||
- SECRET_KEY=notsecretkey
|
- SECRET_KEY=notsecretkey
|
||||||
|
|
||||||
# - TRUST_PROXY=0
|
# - TRUST_PROXY=0
|
||||||
# - TOKEN_EXPIRES_IN=365 # In days
|
# - TOKEN_EXPIRES_IN=365 # In days
|
||||||
|
|
||||||
@@ -23,6 +23,9 @@ services:
|
|||||||
|
|
||||||
# Configure knex to accept SSL certificates
|
# Configure knex to accept SSL certificates
|
||||||
# - KNEX_REJECT_UNAUTHORIZED_SSL_CERTIFICATE=false
|
# - KNEX_REJECT_UNAUTHORIZED_SSL_CERTIFICATE=false
|
||||||
|
|
||||||
|
# - ALLOW_ALL_TO_CREATE_PROJECTS=true
|
||||||
|
|
||||||
# - OIDC_ISSUER=
|
# - OIDC_ISSUER=
|
||||||
# - OIDC_CLIENT_ID=
|
# - OIDC_CLIENT_ID=
|
||||||
# - OIDC_CLIENT_SECRET=
|
# - OIDC_CLIENT_SECRET=
|
||||||
@@ -45,9 +48,17 @@ services:
|
|||||||
# - SMTP_PASSWORD=
|
# - SMTP_PASSWORD=
|
||||||
# - SMTP_FROM="Demo Demo" <demo@demo.demo>
|
# - SMTP_FROM="Demo Demo" <demo@demo.demo>
|
||||||
|
|
||||||
|
# Optional fields: accessToken, events, excludedEvents
|
||||||
|
# - |
|
||||||
|
# WEBHOOKS=[{
|
||||||
|
# "url": "http://localhost:3001",
|
||||||
|
# "accessToken": "notaccesstoken",
|
||||||
|
# "events": ["cardCreate", "cardUpdate", "cardDelete"],
|
||||||
|
# "excludedEvents": ["notificationCreate", "notificationUpdate"]
|
||||||
|
# }]
|
||||||
|
|
||||||
# - SLACK_BOT_TOKEN=
|
# - SLACK_BOT_TOKEN=
|
||||||
# - SLACK_CHANNEL_ID=
|
# - SLACK_CHANNEL_ID=
|
||||||
|
|
||||||
working_dir: /app
|
working_dir: /app
|
||||||
command: ["sh", "-c", "npm run start"]
|
command: ["sh", "-c", "npm run start"]
|
||||||
depends_on:
|
depends_on:
|
||||||
@@ -76,11 +87,11 @@ services:
|
|||||||
dockerfile: ../config/development/Dockerfile.server
|
dockerfile: ../config/development/Dockerfile.server
|
||||||
environment:
|
environment:
|
||||||
- DATABASE_URL=postgresql://user:password@postgres:5432/planka_db
|
- DATABASE_URL=postgresql://user:password@postgres:5432/planka_db
|
||||||
|
|
||||||
# - DEFAULT_ADMIN_EMAIL=demo@demo.demo # Do not remove if you want to prevent this user from being edited/deleted
|
# - DEFAULT_ADMIN_EMAIL=demo@demo.demo # Do not remove if you want to prevent this user from being edited/deleted
|
||||||
# - DEFAULT_ADMIN_PASSWORD=demo
|
# - DEFAULT_ADMIN_PASSWORD=demo
|
||||||
# - DEFAULT_ADMIN_NAME=Demo Demo
|
# - DEFAULT_ADMIN_NAME=Demo Demo
|
||||||
# - DEFAULT_ADMIN_USERNAME=demo
|
# - DEFAULT_ADMIN_USERNAME=demo
|
||||||
|
|
||||||
working_dir: /app
|
working_dir: /app
|
||||||
command: ["sh", "-c", "npm run db:init"]
|
command: ["sh", "-c", "npm run db:init"]
|
||||||
volumes:
|
volumes:
|
||||||
@@ -117,6 +128,5 @@ services:
|
|||||||
- server
|
- server
|
||||||
- client
|
- client
|
||||||
|
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
db-data:
|
db-data:
|
||||||
|
|||||||
@@ -31,6 +31,8 @@ services:
|
|||||||
# - DEFAULT_ADMIN_NAME=Demo Demo
|
# - DEFAULT_ADMIN_NAME=Demo Demo
|
||||||
# - DEFAULT_ADMIN_USERNAME=demo
|
# - DEFAULT_ADMIN_USERNAME=demo
|
||||||
|
|
||||||
|
# - ALLOW_ALL_TO_CREATE_PROJECTS=true
|
||||||
|
|
||||||
# - OIDC_ISSUER=
|
# - OIDC_ISSUER=
|
||||||
# - OIDC_CLIENT_ID=
|
# - OIDC_CLIENT_ID=
|
||||||
# - OIDC_CLIENT_SECRET=
|
# - OIDC_CLIENT_SECRET=
|
||||||
@@ -53,6 +55,15 @@ services:
|
|||||||
# - SMTP_PASSWORD=
|
# - SMTP_PASSWORD=
|
||||||
# - SMTP_FROM="Demo Demo" <demo@demo.demo>
|
# - SMTP_FROM="Demo Demo" <demo@demo.demo>
|
||||||
|
|
||||||
|
# Optional fields: accessToken, events, excludedEvents
|
||||||
|
# - |
|
||||||
|
# WEBHOOKS=[{
|
||||||
|
# "url": "http://localhost:3001",
|
||||||
|
# "accessToken": "notaccesstoken",
|
||||||
|
# "events": ["cardCreate", "cardUpdate", "cardDelete"],
|
||||||
|
# "excludedEvents": ["notificationCreate", "notificationUpdate"]
|
||||||
|
# }]
|
||||||
|
|
||||||
# - SLACK_BOT_TOKEN=
|
# - SLACK_BOT_TOKEN=
|
||||||
# - SLACK_CHANNEL_ID=
|
# - SLACK_CHANNEL_ID=
|
||||||
depends_on:
|
depends_on:
|
||||||
|
|||||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "planka",
|
"name": "planka",
|
||||||
"version": "1.17.5",
|
"version": "1.19.2",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "planka",
|
"name": "planka",
|
||||||
"version": "1.17.5",
|
"version": "1.19.2",
|
||||||
"hasInstallScript": true,
|
"hasInstallScript": true,
|
||||||
"license": "AGPL-3.0",
|
"license": "AGPL-3.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "planka",
|
"name": "planka",
|
||||||
"version": "1.17.5",
|
"version": "1.19.2",
|
||||||
"private": true,
|
"private": true,
|
||||||
"homepage": "https://plankanban.github.io/planka",
|
"homepage": "https://plankanban.github.io/planka",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|||||||
@@ -22,6 +22,8 @@ SECRET_KEY=notsecretkey
|
|||||||
# DEFAULT_ADMIN_NAME=Demo Demo
|
# DEFAULT_ADMIN_NAME=Demo Demo
|
||||||
# DEFAULT_ADMIN_USERNAME=demo
|
# DEFAULT_ADMIN_USERNAME=demo
|
||||||
|
|
||||||
|
# ALLOW_ALL_TO_CREATE_PROJECTS=true
|
||||||
|
|
||||||
# OIDC_ISSUER=
|
# OIDC_ISSUER=
|
||||||
# OIDC_CLIENT_ID=
|
# OIDC_CLIENT_ID=
|
||||||
# OIDC_CLIENT_SECRET=
|
# OIDC_CLIENT_SECRET=
|
||||||
@@ -43,6 +45,14 @@ SECRET_KEY=notsecretkey
|
|||||||
# SMTP_PASSWORD=
|
# SMTP_PASSWORD=
|
||||||
# SMTP_FROM="Demo Demo" <demo@demo.demo>
|
# SMTP_FROM="Demo Demo" <demo@demo.demo>
|
||||||
|
|
||||||
|
# Optional fields: accessToken, events, excludedEvents
|
||||||
|
# WEBHOOKS='[{
|
||||||
|
# "url": "http://localhost:3001",
|
||||||
|
# "accessToken": "notaccesstoken",
|
||||||
|
# "events": ["cardCreate", "cardUpdate", "cardDelete"],
|
||||||
|
# "excludedEvents": ["notificationCreate", "notificationUpdate"]
|
||||||
|
# }]'
|
||||||
|
|
||||||
# SLACK_BOT_TOKEN=
|
# SLACK_BOT_TOKEN=
|
||||||
# SLACK_CHANNEL_ID=
|
# SLACK_CHANNEL_ID=
|
||||||
|
|
||||||
|
|||||||
@@ -44,12 +44,12 @@ module.exports = {
|
|||||||
async fn(inputs, exits) {
|
async fn(inputs, exits) {
|
||||||
const { currentUser } = this.req;
|
const { currentUser } = this.req;
|
||||||
|
|
||||||
const { card } = await sails.helpers.cards
|
const { card, list, board, project } = await sails.helpers.cards
|
||||||
.getProjectPath(inputs.cardId)
|
.getProjectPath(inputs.cardId)
|
||||||
.intercept('pathNotFound', () => Errors.CARD_NOT_FOUND);
|
.intercept('pathNotFound', () => Errors.CARD_NOT_FOUND);
|
||||||
|
|
||||||
const boardMembership = await BoardMembership.findOne({
|
const boardMembership = await BoardMembership.findOne({
|
||||||
boardId: card.boardId,
|
boardId: board.id,
|
||||||
userId: currentUser.id,
|
userId: currentUser.id,
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -83,6 +83,9 @@ module.exports = {
|
|||||||
const fileData = await sails.helpers.attachments.processUploadedFile(file);
|
const fileData = await sails.helpers.attachments.processUploadedFile(file);
|
||||||
|
|
||||||
const attachment = await sails.helpers.attachments.createOne.with({
|
const attachment = await sails.helpers.attachments.createOne.with({
|
||||||
|
project,
|
||||||
|
board,
|
||||||
|
list,
|
||||||
values: {
|
values: {
|
||||||
...fileData,
|
...fileData,
|
||||||
card,
|
card,
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ module.exports = {
|
|||||||
.intercept('pathNotFound', () => Errors.ATTACHMENT_NOT_FOUND);
|
.intercept('pathNotFound', () => Errors.ATTACHMENT_NOT_FOUND);
|
||||||
|
|
||||||
let { attachment } = path;
|
let { attachment } = path;
|
||||||
const { card, board } = path;
|
const { card, list, board, project } = path;
|
||||||
|
|
||||||
const boardMembership = await BoardMembership.findOne({
|
const boardMembership = await BoardMembership.findOne({
|
||||||
boardId: board.id,
|
boardId: board.id,
|
||||||
@@ -49,9 +49,12 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
attachment = await sails.helpers.attachments.deleteOne.with({
|
attachment = await sails.helpers.attachments.deleteOne.with({
|
||||||
|
project,
|
||||||
board,
|
board,
|
||||||
|
list,
|
||||||
card,
|
card,
|
||||||
record: attachment,
|
record: attachment,
|
||||||
|
actorUser: currentUser,
|
||||||
request: this.req,
|
request: this.req,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ module.exports = {
|
|||||||
.intercept('pathNotFound', () => Errors.ATTACHMENT_NOT_FOUND);
|
.intercept('pathNotFound', () => Errors.ATTACHMENT_NOT_FOUND);
|
||||||
|
|
||||||
let { attachment } = path;
|
let { attachment } = path;
|
||||||
const { board } = path;
|
const { card, list, board, project } = path;
|
||||||
|
|
||||||
const boardMembership = await BoardMembership.findOne({
|
const boardMembership = await BoardMembership.findOne({
|
||||||
boardId: board.id,
|
boardId: board.id,
|
||||||
@@ -56,8 +56,12 @@ module.exports = {
|
|||||||
|
|
||||||
attachment = await sails.helpers.attachments.updateOne.with({
|
attachment = await sails.helpers.attachments.updateOne.with({
|
||||||
values,
|
values,
|
||||||
|
project,
|
||||||
board,
|
board,
|
||||||
|
list,
|
||||||
|
card,
|
||||||
record: attachment,
|
record: attachment,
|
||||||
|
actorUser: currentUser,
|
||||||
request: this.req,
|
request: this.req,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -48,14 +48,11 @@ module.exports = {
|
|||||||
async fn(inputs) {
|
async fn(inputs) {
|
||||||
const { currentUser } = this.req;
|
const { currentUser } = this.req;
|
||||||
|
|
||||||
const { board } = await sails.helpers.boards
|
const { board, project } = await sails.helpers.boards
|
||||||
.getProjectPath(inputs.boardId)
|
.getProjectPath(inputs.boardId)
|
||||||
.intercept('pathNotFound', () => Errors.BOARD_NOT_FOUND);
|
.intercept('pathNotFound', () => Errors.BOARD_NOT_FOUND);
|
||||||
|
|
||||||
const isProjectManager = await sails.helpers.users.isProjectManager(
|
const isProjectManager = await sails.helpers.users.isProjectManager(currentUser.id, project.id);
|
||||||
currentUser.id,
|
|
||||||
board.projectId,
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!isProjectManager) {
|
if (!isProjectManager) {
|
||||||
throw Errors.BOARD_NOT_FOUND; // Forbidden
|
throw Errors.BOARD_NOT_FOUND; // Forbidden
|
||||||
@@ -71,11 +68,13 @@ module.exports = {
|
|||||||
|
|
||||||
const boardMembership = await sails.helpers.boardMemberships.createOne
|
const boardMembership = await sails.helpers.boardMemberships.createOne
|
||||||
.with({
|
.with({
|
||||||
|
project,
|
||||||
values: {
|
values: {
|
||||||
...values,
|
...values,
|
||||||
board,
|
board,
|
||||||
user,
|
user,
|
||||||
},
|
},
|
||||||
|
actorUser: currentUser,
|
||||||
request: this.req,
|
request: this.req,
|
||||||
})
|
})
|
||||||
.intercept('userAlreadyBoardMember', () => Errors.USER_ALREADY_BOARD_MEMBER);
|
.intercept('userAlreadyBoardMember', () => Errors.USER_ALREADY_BOARD_MEMBER);
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ module.exports = {
|
|||||||
.intercept('pathNotFound', () => Errors.BOARD_MEMBERSHIP_NOT_FOUND);
|
.intercept('pathNotFound', () => Errors.BOARD_MEMBERSHIP_NOT_FOUND);
|
||||||
|
|
||||||
let { boardMembership } = path;
|
let { boardMembership } = path;
|
||||||
const { project } = path;
|
const { board, project } = path;
|
||||||
|
|
||||||
if (boardMembership.userId !== currentUser.id) {
|
if (boardMembership.userId !== currentUser.id) {
|
||||||
const isProjectManager = await sails.helpers.users.isProjectManager(
|
const isProjectManager = await sails.helpers.users.isProjectManager(
|
||||||
@@ -42,7 +42,9 @@ module.exports = {
|
|||||||
|
|
||||||
boardMembership = await sails.helpers.boardMemberships.deleteOne.with({
|
boardMembership = await sails.helpers.boardMemberships.deleteOne.with({
|
||||||
project,
|
project,
|
||||||
|
board,
|
||||||
record: boardMembership,
|
record: boardMembership,
|
||||||
|
actorUser: currentUser,
|
||||||
request: this.req,
|
request: this.req,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ module.exports = {
|
|||||||
.intercept('pathNotFound', () => Errors.BOARD_MEMBERSHIP_NOT_FOUND);
|
.intercept('pathNotFound', () => Errors.BOARD_MEMBERSHIP_NOT_FOUND);
|
||||||
|
|
||||||
let { boardMembership } = path;
|
let { boardMembership } = path;
|
||||||
const { project } = path;
|
const { board, project } = path;
|
||||||
|
|
||||||
const isProjectManager = await sails.helpers.users.isProjectManager(currentUser.id, project.id);
|
const isProjectManager = await sails.helpers.users.isProjectManager(currentUser.id, project.id);
|
||||||
|
|
||||||
@@ -47,7 +47,10 @@ module.exports = {
|
|||||||
|
|
||||||
boardMembership = await sails.helpers.boardMemberships.updateOne.with({
|
boardMembership = await sails.helpers.boardMemberships.updateOne.with({
|
||||||
values,
|
values,
|
||||||
|
project,
|
||||||
|
board,
|
||||||
record: boardMembership,
|
record: boardMembership,
|
||||||
|
actorUser: currentUser,
|
||||||
request: this.req,
|
request: this.req,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ module.exports = {
|
|||||||
project,
|
project,
|
||||||
},
|
},
|
||||||
import: boardImport,
|
import: boardImport,
|
||||||
user: currentUser,
|
actorUser: currentUser,
|
||||||
requestId: inputs.requestId,
|
requestId: inputs.requestId,
|
||||||
request: this.req,
|
request: this.req,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -22,25 +22,27 @@ module.exports = {
|
|||||||
async fn(inputs) {
|
async fn(inputs) {
|
||||||
const { currentUser } = this.req;
|
const { currentUser } = this.req;
|
||||||
|
|
||||||
let { board } = await sails.helpers.boards
|
const path = await sails.helpers.boards
|
||||||
.getProjectPath(inputs.id)
|
.getProjectPath(inputs.id)
|
||||||
.intercept('pathNotFound', () => Errors.BOARD_NOT_FOUND);
|
.intercept('pathNotFound', () => Errors.BOARD_NOT_FOUND);
|
||||||
|
|
||||||
|
let { board } = path;
|
||||||
|
const { project } = path;
|
||||||
|
|
||||||
if (!board) {
|
if (!board) {
|
||||||
throw Errors.BOARD_NOT_FOUND;
|
throw Errors.BOARD_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
const isProjectManager = await sails.helpers.users.isProjectManager(
|
const isProjectManager = await sails.helpers.users.isProjectManager(currentUser.id, project.id);
|
||||||
currentUser.id,
|
|
||||||
board.projectId,
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!isProjectManager) {
|
if (!isProjectManager) {
|
||||||
throw Errors.BOARD_NOT_FOUND; // Forbidden
|
throw Errors.BOARD_NOT_FOUND; // Forbidden
|
||||||
}
|
}
|
||||||
|
|
||||||
board = await sails.helpers.boards.deleteOne.with({
|
board = await sails.helpers.boards.deleteOne.with({
|
||||||
|
project,
|
||||||
record: board,
|
record: board,
|
||||||
|
actorUser: currentUser,
|
||||||
request: this.req,
|
request: this.req,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -29,18 +29,18 @@ module.exports = {
|
|||||||
async fn(inputs) {
|
async fn(inputs) {
|
||||||
const { currentUser } = this.req;
|
const { currentUser } = this.req;
|
||||||
|
|
||||||
let { board } = await sails.helpers.boards
|
const path = await sails.helpers.boards
|
||||||
.getProjectPath(inputs.id)
|
.getProjectPath(inputs.id)
|
||||||
.intercept('pathNotFound', () => Errors.BOARD_NOT_FOUND);
|
.intercept('pathNotFound', () => Errors.BOARD_NOT_FOUND);
|
||||||
|
|
||||||
|
let { board } = path;
|
||||||
|
const { project } = path;
|
||||||
|
|
||||||
if (!board) {
|
if (!board) {
|
||||||
throw Errors.BOARD_NOT_FOUND;
|
throw Errors.BOARD_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
const isProjectManager = await sails.helpers.users.isProjectManager(
|
const isProjectManager = await sails.helpers.users.isProjectManager(currentUser.id, project.id);
|
||||||
currentUser.id,
|
|
||||||
board.projectId,
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!isProjectManager) {
|
if (!isProjectManager) {
|
||||||
throw Errors.BOARD_NOT_FOUND; // Forbidden
|
throw Errors.BOARD_NOT_FOUND; // Forbidden
|
||||||
@@ -50,7 +50,9 @@ module.exports = {
|
|||||||
|
|
||||||
board = await sails.helpers.boards.updateOne.with({
|
board = await sails.helpers.boards.updateOne.with({
|
||||||
values,
|
values,
|
||||||
|
project,
|
||||||
record: board,
|
record: board,
|
||||||
|
actorUser: currentUser,
|
||||||
request: this.req,
|
request: this.req,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -45,12 +45,12 @@ module.exports = {
|
|||||||
async fn(inputs) {
|
async fn(inputs) {
|
||||||
const { currentUser } = this.req;
|
const { currentUser } = this.req;
|
||||||
|
|
||||||
const { card } = await sails.helpers.cards
|
const { card, list, board, project } = await sails.helpers.cards
|
||||||
.getProjectPath(inputs.cardId)
|
.getProjectPath(inputs.cardId)
|
||||||
.intercept('pathNotFound', () => Errors.CARD_NOT_FOUND);
|
.intercept('pathNotFound', () => Errors.CARD_NOT_FOUND);
|
||||||
|
|
||||||
const boardMembership = await BoardMembership.findOne({
|
const boardMembership = await BoardMembership.findOne({
|
||||||
boardId: card.boardId,
|
boardId: board.id,
|
||||||
userId: currentUser.id,
|
userId: currentUser.id,
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -64,7 +64,7 @@ module.exports = {
|
|||||||
|
|
||||||
const label = await Label.findOne({
|
const label = await Label.findOne({
|
||||||
id: inputs.labelId,
|
id: inputs.labelId,
|
||||||
boardId: card.boardId,
|
boardId: board.id,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!label) {
|
if (!label) {
|
||||||
@@ -73,10 +73,14 @@ module.exports = {
|
|||||||
|
|
||||||
const cardLabel = await sails.helpers.cardLabels.createOne
|
const cardLabel = await sails.helpers.cardLabels.createOne
|
||||||
.with({
|
.with({
|
||||||
|
project,
|
||||||
|
board,
|
||||||
|
list,
|
||||||
values: {
|
values: {
|
||||||
card,
|
card,
|
||||||
label,
|
label,
|
||||||
},
|
},
|
||||||
|
actorUser: currentUser,
|
||||||
request: this.req,
|
request: this.req,
|
||||||
})
|
})
|
||||||
.intercept('labelAlreadyInCard', () => Errors.LABEL_ALREADY_IN_CARD);
|
.intercept('labelAlreadyInCard', () => Errors.LABEL_ALREADY_IN_CARD);
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ module.exports = {
|
|||||||
async fn(inputs) {
|
async fn(inputs) {
|
||||||
const { currentUser } = this.req;
|
const { currentUser } = this.req;
|
||||||
|
|
||||||
const { board } = await sails.helpers.cards
|
const { card, list, board, project } = await sails.helpers.cards
|
||||||
.getProjectPath(inputs.cardId)
|
.getProjectPath(inputs.cardId)
|
||||||
.intercept('pathNotFound', () => Errors.CARD_NOT_FOUND);
|
.intercept('pathNotFound', () => Errors.CARD_NOT_FOUND);
|
||||||
|
|
||||||
@@ -66,8 +66,12 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
cardLabel = await sails.helpers.cardLabels.deleteOne.with({
|
cardLabel = await sails.helpers.cardLabels.deleteOne.with({
|
||||||
|
project,
|
||||||
board,
|
board,
|
||||||
|
list,
|
||||||
|
card,
|
||||||
record: cardLabel,
|
record: cardLabel,
|
||||||
|
actorUser: currentUser,
|
||||||
request: this.req,
|
request: this.req,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -45,12 +45,12 @@ module.exports = {
|
|||||||
async fn(inputs) {
|
async fn(inputs) {
|
||||||
const { currentUser } = this.req;
|
const { currentUser } = this.req;
|
||||||
|
|
||||||
const { card } = await sails.helpers.cards
|
const { card, list, board, project } = await sails.helpers.cards
|
||||||
.getProjectPath(inputs.cardId)
|
.getProjectPath(inputs.cardId)
|
||||||
.intercept('pathNotFound', () => Errors.CARD_NOT_FOUND);
|
.intercept('pathNotFound', () => Errors.CARD_NOT_FOUND);
|
||||||
|
|
||||||
const boardMembership = await BoardMembership.findOne({
|
const boardMembership = await BoardMembership.findOne({
|
||||||
boardId: card.boardId,
|
boardId: board.id,
|
||||||
userId: currentUser.id,
|
userId: currentUser.id,
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -62,7 +62,7 @@ module.exports = {
|
|||||||
throw Errors.NOT_ENOUGH_RIGHTS;
|
throw Errors.NOT_ENOUGH_RIGHTS;
|
||||||
}
|
}
|
||||||
|
|
||||||
const isBoardMember = await sails.helpers.users.isBoardMember(inputs.userId, card.boardId);
|
const isBoardMember = await sails.helpers.users.isBoardMember(inputs.userId, board.id);
|
||||||
|
|
||||||
if (!isBoardMember) {
|
if (!isBoardMember) {
|
||||||
throw Errors.USER_NOT_FOUND;
|
throw Errors.USER_NOT_FOUND;
|
||||||
@@ -70,10 +70,14 @@ module.exports = {
|
|||||||
|
|
||||||
const cardMembership = await sails.helpers.cardMemberships.createOne
|
const cardMembership = await sails.helpers.cardMemberships.createOne
|
||||||
.with({
|
.with({
|
||||||
|
project,
|
||||||
|
board,
|
||||||
|
list,
|
||||||
values: {
|
values: {
|
||||||
card,
|
card,
|
||||||
userId: inputs.userId,
|
userId: inputs.userId,
|
||||||
},
|
},
|
||||||
|
actorUser: currentUser,
|
||||||
request: this.req,
|
request: this.req,
|
||||||
})
|
})
|
||||||
.intercept('userAlreadyCardMember', () => Errors.USER_ALREADY_CARD_MEMBER);
|
.intercept('userAlreadyCardMember', () => Errors.USER_ALREADY_CARD_MEMBER);
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ module.exports = {
|
|||||||
async fn(inputs) {
|
async fn(inputs) {
|
||||||
const { currentUser } = this.req;
|
const { currentUser } = this.req;
|
||||||
|
|
||||||
const { board } = await sails.helpers.cards
|
const { card, list, board, project } = await sails.helpers.cards
|
||||||
.getProjectPath(inputs.cardId)
|
.getProjectPath(inputs.cardId)
|
||||||
.intercept('pathNotFound', () => Errors.CARD_NOT_FOUND);
|
.intercept('pathNotFound', () => Errors.CARD_NOT_FOUND);
|
||||||
|
|
||||||
@@ -66,8 +66,12 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
cardMembership = await sails.helpers.cardMemberships.deleteOne.with({
|
cardMembership = await sails.helpers.cardMemberships.deleteOne.with({
|
||||||
|
project,
|
||||||
board,
|
board,
|
||||||
|
list,
|
||||||
|
card,
|
||||||
record: cardMembership,
|
record: cardMembership,
|
||||||
|
actorUser: currentUser,
|
||||||
request: this.req,
|
request: this.req,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ module.exports = {
|
|||||||
async fn(inputs) {
|
async fn(inputs) {
|
||||||
const { currentUser } = this.req;
|
const { currentUser } = this.req;
|
||||||
|
|
||||||
const { board, list } = await sails.helpers.lists
|
const { list, board, project } = await sails.helpers.lists
|
||||||
.getProjectPath(inputs.listId)
|
.getProjectPath(inputs.listId)
|
||||||
.intercept('pathNotFound', () => Errors.LIST_NOT_FOUND);
|
.intercept('pathNotFound', () => Errors.LIST_NOT_FOUND);
|
||||||
|
|
||||||
@@ -99,6 +99,7 @@ module.exports = {
|
|||||||
|
|
||||||
const card = await sails.helpers.cards.createOne
|
const card = await sails.helpers.cards.createOne
|
||||||
.with({
|
.with({
|
||||||
|
project,
|
||||||
board,
|
board,
|
||||||
values: {
|
values: {
|
||||||
...values,
|
...values,
|
||||||
|
|||||||
@@ -28,12 +28,15 @@ module.exports = {
|
|||||||
async fn(inputs) {
|
async fn(inputs) {
|
||||||
const { currentUser } = this.req;
|
const { currentUser } = this.req;
|
||||||
|
|
||||||
let { card } = await sails.helpers.cards
|
const path = await sails.helpers.cards
|
||||||
.getProjectPath(inputs.id)
|
.getProjectPath(inputs.id)
|
||||||
.intercept('pathNotFound', () => Errors.CARD_NOT_FOUND);
|
.intercept('pathNotFound', () => Errors.CARD_NOT_FOUND);
|
||||||
|
|
||||||
|
let { card } = path;
|
||||||
|
const { list, board, project } = path;
|
||||||
|
|
||||||
const boardMembership = await BoardMembership.findOne({
|
const boardMembership = await BoardMembership.findOne({
|
||||||
boardId: card.boardId,
|
boardId: board.id,
|
||||||
userId: currentUser.id,
|
userId: currentUser.id,
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -46,8 +49,11 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
card = await sails.helpers.cards.deleteOne.with({
|
card = await sails.helpers.cards.deleteOne.with({
|
||||||
|
project,
|
||||||
|
board,
|
||||||
|
list,
|
||||||
record: card,
|
record: card,
|
||||||
user: currentUser,
|
actorUser: currentUser,
|
||||||
request: this.req,
|
request: this.req,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -35,12 +35,12 @@ module.exports = {
|
|||||||
async fn(inputs) {
|
async fn(inputs) {
|
||||||
const { currentUser } = this.req;
|
const { currentUser } = this.req;
|
||||||
|
|
||||||
const { card, list, board } = await sails.helpers.cards
|
const { card, list, board, project } = await sails.helpers.cards
|
||||||
.getProjectPath(inputs.id)
|
.getProjectPath(inputs.id)
|
||||||
.intercept('pathNotFound', () => Errors.CARD_NOT_FOUND);
|
.intercept('pathNotFound', () => Errors.CARD_NOT_FOUND);
|
||||||
|
|
||||||
const boardMembership = await BoardMembership.findOne({
|
const boardMembership = await BoardMembership.findOne({
|
||||||
boardId: card.boardId,
|
boardId: board.id,
|
||||||
userId: currentUser.id,
|
userId: currentUser.id,
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -60,6 +60,7 @@ module.exports = {
|
|||||||
cardLabels,
|
cardLabels,
|
||||||
tasks,
|
tasks,
|
||||||
} = await sails.helpers.cards.duplicateOne.with({
|
} = await sails.helpers.cards.duplicateOne.with({
|
||||||
|
project,
|
||||||
board,
|
board,
|
||||||
list,
|
list,
|
||||||
record: card,
|
record: card,
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ module.exports = {
|
|||||||
.intercept('pathNotFound', () => Errors.CARD_NOT_FOUND);
|
.intercept('pathNotFound', () => Errors.CARD_NOT_FOUND);
|
||||||
|
|
||||||
let { card } = path;
|
let { card } = path;
|
||||||
const { list, board } = path;
|
const { list, board, project } = path;
|
||||||
|
|
||||||
let boardMembership = await BoardMembership.findOne({
|
let boardMembership = await BoardMembership.findOne({
|
||||||
boardId: board.id,
|
boardId: board.id,
|
||||||
@@ -133,9 +133,11 @@ module.exports = {
|
|||||||
throw Errors.NOT_ENOUGH_RIGHTS;
|
throw Errors.NOT_ENOUGH_RIGHTS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let nextProject;
|
||||||
let nextBoard;
|
let nextBoard;
|
||||||
|
|
||||||
if (!_.isUndefined(inputs.boardId)) {
|
if (!_.isUndefined(inputs.boardId)) {
|
||||||
({ board: nextBoard } = await sails.helpers.boards
|
({ board: nextBoard, project: nextProject } = await sails.helpers.boards
|
||||||
.getProjectPath(inputs.boardId)
|
.getProjectPath(inputs.boardId)
|
||||||
.intercept('pathNotFound', () => Errors.BOARD_NOT_FOUND));
|
.intercept('pathNotFound', () => Errors.BOARD_NOT_FOUND));
|
||||||
|
|
||||||
@@ -177,15 +179,17 @@ module.exports = {
|
|||||||
|
|
||||||
card = await sails.helpers.cards.updateOne
|
card = await sails.helpers.cards.updateOne
|
||||||
.with({
|
.with({
|
||||||
|
project,
|
||||||
board,
|
board,
|
||||||
list,
|
list,
|
||||||
record: card,
|
record: card,
|
||||||
values: {
|
values: {
|
||||||
...values,
|
...values,
|
||||||
|
project: nextProject,
|
||||||
board: nextBoard,
|
board: nextBoard,
|
||||||
list: nextList,
|
list: nextList,
|
||||||
},
|
},
|
||||||
user: currentUser,
|
actorUser: currentUser,
|
||||||
request: this.req,
|
request: this.req,
|
||||||
})
|
})
|
||||||
.intercept('positionMustBeInValues', () => Errors.POSITION_MUST_BE_PRESENT)
|
.intercept('positionMustBeInValues', () => Errors.POSITION_MUST_BE_PRESENT)
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ module.exports = {
|
|||||||
async fn(inputs) {
|
async fn(inputs) {
|
||||||
const { currentUser } = this.req;
|
const { currentUser } = this.req;
|
||||||
|
|
||||||
const { board, card } = await sails.helpers.cards
|
const { card, list, board, project } = await sails.helpers.cards
|
||||||
.getProjectPath(inputs.cardId)
|
.getProjectPath(inputs.cardId)
|
||||||
.intercept('pathNotFound', () => Errors.CARD_NOT_FOUND);
|
.intercept('pathNotFound', () => Errors.CARD_NOT_FOUND);
|
||||||
|
|
||||||
@@ -55,7 +55,9 @@ module.exports = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const action = await sails.helpers.actions.createOne.with({
|
const action = await sails.helpers.actions.createOne.with({
|
||||||
|
project,
|
||||||
board,
|
board,
|
||||||
|
list,
|
||||||
values: {
|
values: {
|
||||||
...values,
|
...values,
|
||||||
card,
|
card,
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ module.exports = {
|
|||||||
.intercept('pathNotFound', () => Errors.COMMENT_ACTION_NOT_FOUND);
|
.intercept('pathNotFound', () => Errors.COMMENT_ACTION_NOT_FOUND);
|
||||||
|
|
||||||
let { action } = path;
|
let { action } = path;
|
||||||
const { board, project } = path;
|
const { card, list, board, project } = path;
|
||||||
|
|
||||||
const isProjectManager = await sails.helpers.users.isProjectManager(currentUser.id, project.id);
|
const isProjectManager = await sails.helpers.users.isProjectManager(currentUser.id, project.id);
|
||||||
|
|
||||||
@@ -60,8 +60,12 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
action = await sails.helpers.actions.deleteOne.with({
|
action = await sails.helpers.actions.deleteOne.with({
|
||||||
|
project,
|
||||||
board,
|
board,
|
||||||
|
list,
|
||||||
|
card,
|
||||||
record: action,
|
record: action,
|
||||||
|
actorUser: currentUser,
|
||||||
request: this.req,
|
request: this.req,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ module.exports = {
|
|||||||
.intercept('pathNotFound', () => Errors.COMMENT_ACTION_NOT_FOUND);
|
.intercept('pathNotFound', () => Errors.COMMENT_ACTION_NOT_FOUND);
|
||||||
|
|
||||||
let { action } = path;
|
let { action } = path;
|
||||||
const { board, project } = path;
|
const { card, list, board, project } = path;
|
||||||
|
|
||||||
const isProjectManager = await sails.helpers.users.isProjectManager(currentUser.id, project.id);
|
const isProjectManager = await sails.helpers.users.isProjectManager(currentUser.id, project.id);
|
||||||
|
|
||||||
@@ -69,8 +69,12 @@ module.exports = {
|
|||||||
|
|
||||||
action = await sails.helpers.actions.updateOne.with({
|
action = await sails.helpers.actions.updateOne.with({
|
||||||
values,
|
values,
|
||||||
|
project,
|
||||||
board,
|
board,
|
||||||
|
list,
|
||||||
|
card,
|
||||||
record: action,
|
record: action,
|
||||||
|
actorUser: currentUser,
|
||||||
request: this.req,
|
request: this.req,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ module.exports = {
|
|||||||
async fn(inputs) {
|
async fn(inputs) {
|
||||||
const { currentUser } = this.req;
|
const { currentUser } = this.req;
|
||||||
|
|
||||||
const { board } = await sails.helpers.boards
|
const { board, project } = await sails.helpers.boards
|
||||||
.getProjectPath(inputs.boardId)
|
.getProjectPath(inputs.boardId)
|
||||||
.intercept('pathNotFound', () => Errors.BOARD_NOT_FOUND);
|
.intercept('pathNotFound', () => Errors.BOARD_NOT_FOUND);
|
||||||
|
|
||||||
@@ -62,10 +62,12 @@ module.exports = {
|
|||||||
const values = _.pick(inputs, ['position', 'name', 'color']);
|
const values = _.pick(inputs, ['position', 'name', 'color']);
|
||||||
|
|
||||||
const label = await sails.helpers.labels.createOne.with({
|
const label = await sails.helpers.labels.createOne.with({
|
||||||
|
project,
|
||||||
values: {
|
values: {
|
||||||
...values,
|
...values,
|
||||||
board,
|
board,
|
||||||
},
|
},
|
||||||
|
actorUser: currentUser,
|
||||||
request: this.req,
|
request: this.req,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -28,12 +28,15 @@ module.exports = {
|
|||||||
async fn(inputs) {
|
async fn(inputs) {
|
||||||
const { currentUser } = this.req;
|
const { currentUser } = this.req;
|
||||||
|
|
||||||
let { label } = await sails.helpers.labels
|
const path = await sails.helpers.labels
|
||||||
.getProjectPath(inputs.id)
|
.getProjectPath(inputs.id)
|
||||||
.intercept('pathNotFound', () => Errors.LABEL_NOT_FOUND);
|
.intercept('pathNotFound', () => Errors.LABEL_NOT_FOUND);
|
||||||
|
|
||||||
|
let { label } = path;
|
||||||
|
const { board, project } = path;
|
||||||
|
|
||||||
const boardMembership = await BoardMembership.findOne({
|
const boardMembership = await BoardMembership.findOne({
|
||||||
boardId: label.boardId,
|
boardId: board.id,
|
||||||
userId: currentUser.id,
|
userId: currentUser.id,
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -46,7 +49,10 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
label = await sails.helpers.labels.deleteOne.with({
|
label = await sails.helpers.labels.deleteOne.with({
|
||||||
|
project,
|
||||||
|
board,
|
||||||
record: label,
|
record: label,
|
||||||
|
actorUser: currentUser,
|
||||||
request: this.req,
|
request: this.req,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -40,12 +40,15 @@ module.exports = {
|
|||||||
async fn(inputs) {
|
async fn(inputs) {
|
||||||
const { currentUser } = this.req;
|
const { currentUser } = this.req;
|
||||||
|
|
||||||
let { label } = await sails.helpers.labels
|
const path = await sails.helpers.labels
|
||||||
.getProjectPath(inputs.id)
|
.getProjectPath(inputs.id)
|
||||||
.intercept('pathNotFound', () => Errors.LABEL_NOT_FOUND);
|
.intercept('pathNotFound', () => Errors.LABEL_NOT_FOUND);
|
||||||
|
|
||||||
|
let { label } = path;
|
||||||
|
const { board, project } = path;
|
||||||
|
|
||||||
const boardMembership = await BoardMembership.findOne({
|
const boardMembership = await BoardMembership.findOne({
|
||||||
boardId: label.boardId,
|
boardId: board.id,
|
||||||
userId: currentUser.id,
|
userId: currentUser.id,
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -61,7 +64,10 @@ module.exports = {
|
|||||||
|
|
||||||
label = await sails.helpers.labels.updateOne.with({
|
label = await sails.helpers.labels.updateOne.with({
|
||||||
values,
|
values,
|
||||||
|
project,
|
||||||
|
board,
|
||||||
record: label,
|
record: label,
|
||||||
|
actorUser: currentUser,
|
||||||
request: this.req,
|
request: this.req,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ module.exports = {
|
|||||||
async fn(inputs) {
|
async fn(inputs) {
|
||||||
const { currentUser } = this.req;
|
const { currentUser } = this.req;
|
||||||
|
|
||||||
const { board } = await sails.helpers.boards
|
const { board, project } = await sails.helpers.boards
|
||||||
.getProjectPath(inputs.boardId)
|
.getProjectPath(inputs.boardId)
|
||||||
.intercept('pathNotFound', () => Errors.BOARD_NOT_FOUND);
|
.intercept('pathNotFound', () => Errors.BOARD_NOT_FOUND);
|
||||||
|
|
||||||
@@ -56,10 +56,12 @@ module.exports = {
|
|||||||
const values = _.pick(inputs, ['position', 'name']);
|
const values = _.pick(inputs, ['position', 'name']);
|
||||||
|
|
||||||
const list = await sails.helpers.lists.createOne.with({
|
const list = await sails.helpers.lists.createOne.with({
|
||||||
|
project,
|
||||||
values: {
|
values: {
|
||||||
...values,
|
...values,
|
||||||
board,
|
board,
|
||||||
},
|
},
|
||||||
|
actorUser: currentUser,
|
||||||
request: this.req,
|
request: this.req,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -28,12 +28,15 @@ module.exports = {
|
|||||||
async fn(inputs) {
|
async fn(inputs) {
|
||||||
const { currentUser } = this.req;
|
const { currentUser } = this.req;
|
||||||
|
|
||||||
let { list } = await sails.helpers.lists
|
const path = await sails.helpers.lists
|
||||||
.getProjectPath(inputs.id)
|
.getProjectPath(inputs.id)
|
||||||
.intercept('pathNotFound', () => Errors.LIST_NOT_FOUND);
|
.intercept('pathNotFound', () => Errors.LIST_NOT_FOUND);
|
||||||
|
|
||||||
|
let { list } = path;
|
||||||
|
const { board, project } = path;
|
||||||
|
|
||||||
const boardMembership = await BoardMembership.findOne({
|
const boardMembership = await BoardMembership.findOne({
|
||||||
boardId: list.boardId,
|
boardId: board.id,
|
||||||
userId: currentUser.id,
|
userId: currentUser.id,
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -46,7 +49,10 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
list = await sails.helpers.lists.deleteOne.with({
|
list = await sails.helpers.lists.deleteOne.with({
|
||||||
|
project,
|
||||||
|
board,
|
||||||
record: list,
|
record: list,
|
||||||
|
actorUser: currentUser,
|
||||||
request: this.req,
|
request: this.req,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -32,12 +32,12 @@ module.exports = {
|
|||||||
async fn(inputs) {
|
async fn(inputs) {
|
||||||
const { currentUser } = this.req;
|
const { currentUser } = this.req;
|
||||||
|
|
||||||
const { list } = await sails.helpers.lists
|
const { list, board, project } = await sails.helpers.lists
|
||||||
.getProjectPath(inputs.id)
|
.getProjectPath(inputs.id)
|
||||||
.intercept('pathNotFound', () => Errors.LIST_NOT_FOUND);
|
.intercept('pathNotFound', () => Errors.LIST_NOT_FOUND);
|
||||||
|
|
||||||
const boardMembership = await BoardMembership.findOne({
|
const boardMembership = await BoardMembership.findOne({
|
||||||
boardId: list.boardId,
|
boardId: board.id,
|
||||||
userId: currentUser.id,
|
userId: currentUser.id,
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -50,8 +50,11 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const cards = await sails.helpers.lists.sortOne.with({
|
const cards = await sails.helpers.lists.sortOne.with({
|
||||||
|
project,
|
||||||
|
board,
|
||||||
record: list,
|
record: list,
|
||||||
type: inputs.type,
|
type: inputs.type,
|
||||||
|
actorUser: currentUser,
|
||||||
request: this.req,
|
request: this.req,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -35,12 +35,15 @@ module.exports = {
|
|||||||
async fn(inputs) {
|
async fn(inputs) {
|
||||||
const { currentUser } = this.req;
|
const { currentUser } = this.req;
|
||||||
|
|
||||||
let { list } = await sails.helpers.lists
|
const path = await sails.helpers.lists
|
||||||
.getProjectPath(inputs.id)
|
.getProjectPath(inputs.id)
|
||||||
.intercept('pathNotFound', () => Errors.LIST_NOT_FOUND);
|
.intercept('pathNotFound', () => Errors.LIST_NOT_FOUND);
|
||||||
|
|
||||||
|
let { list } = path;
|
||||||
|
const { board, project } = path;
|
||||||
|
|
||||||
const boardMembership = await BoardMembership.findOne({
|
const boardMembership = await BoardMembership.findOne({
|
||||||
boardId: list.boardId,
|
boardId: board.id,
|
||||||
userId: currentUser.id,
|
userId: currentUser.id,
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -56,7 +59,10 @@ module.exports = {
|
|||||||
|
|
||||||
list = await sails.helpers.lists.updateOne.with({
|
list = await sails.helpers.lists.updateOne.with({
|
||||||
values,
|
values,
|
||||||
|
project,
|
||||||
|
board,
|
||||||
record: list,
|
record: list,
|
||||||
|
actorUser: currentUser,
|
||||||
request: this.req,
|
request: this.req,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ module.exports = {
|
|||||||
const notifications = await sails.helpers.notifications.updateMany.with({
|
const notifications = await sails.helpers.notifications.updateMany.with({
|
||||||
values,
|
values,
|
||||||
recordsOrIds: inputs.ids.split(','),
|
recordsOrIds: inputs.ids.split(','),
|
||||||
user: currentUser,
|
actorUser: currentUser,
|
||||||
request: this.req,
|
request: this.req,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ module.exports = {
|
|||||||
project,
|
project,
|
||||||
user,
|
user,
|
||||||
},
|
},
|
||||||
|
actorUser: currentUser,
|
||||||
request: this.req,
|
request: this.req,
|
||||||
})
|
})
|
||||||
.intercept('userAlreadyProjectManager', () => Errors.USER_ALREADY_PROJECT_MANAGER);
|
.intercept('userAlreadyProjectManager', () => Errors.USER_ALREADY_PROJECT_MANAGER);
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ module.exports = {
|
|||||||
// TODO: check if the last one
|
// TODO: check if the last one
|
||||||
projectManager = await sails.helpers.projectManagers.deleteOne.with({
|
projectManager = await sails.helpers.projectManagers.deleteOne.with({
|
||||||
record: projectManager,
|
record: projectManager,
|
||||||
|
actorUser: currentUser,
|
||||||
request: this.req,
|
request: this.req,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,9 @@
|
|||||||
|
const Errors = {
|
||||||
|
NOT_ENOUGH_RIGHTS: {
|
||||||
|
notEnoughRights: 'Not enough rights',
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
inputs: {
|
inputs: {
|
||||||
name: {
|
name: {
|
||||||
@@ -6,14 +12,24 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
exits: {
|
||||||
|
notEnoughRights: {
|
||||||
|
responseType: 'forbidden',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
async fn(inputs) {
|
async fn(inputs) {
|
||||||
const { currentUser } = this.req;
|
const { currentUser } = this.req;
|
||||||
|
|
||||||
|
if (!currentUser.isAdmin && !sails.config.custom.allowAllToCreateProjects) {
|
||||||
|
throw Errors.NOT_ENOUGH_RIGHTS;
|
||||||
|
}
|
||||||
|
|
||||||
const values = _.pick(inputs, ['name']);
|
const values = _.pick(inputs, ['name']);
|
||||||
|
|
||||||
const { project, projectManager } = await sails.helpers.projects.createOne.with({
|
const { project, projectManager } = await sails.helpers.projects.createOne.with({
|
||||||
values,
|
values,
|
||||||
user: currentUser,
|
actorUser: currentUser,
|
||||||
request: this.req,
|
request: this.req,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ module.exports = {
|
|||||||
|
|
||||||
project = await sails.helpers.projects.deleteOne.with({
|
project = await sails.helpers.projects.deleteOne.with({
|
||||||
record: project,
|
record: project,
|
||||||
|
actorUser: currentUser,
|
||||||
request: this.req,
|
request: this.req,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -90,6 +90,7 @@ module.exports = {
|
|||||||
values: {
|
values: {
|
||||||
backgroundImage: fileData,
|
backgroundImage: fileData,
|
||||||
},
|
},
|
||||||
|
actorUser: currentUser,
|
||||||
request: this.req,
|
request: this.req,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -81,6 +81,7 @@ module.exports = {
|
|||||||
project = await sails.helpers.projects.updateOne.with({
|
project = await sails.helpers.projects.updateOne.with({
|
||||||
values,
|
values,
|
||||||
record: project,
|
record: project,
|
||||||
|
actorUser: currentUser,
|
||||||
request: this.req,
|
request: this.req,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ module.exports = {
|
|||||||
return {
|
return {
|
||||||
item: {
|
item: {
|
||||||
oidc,
|
oidc,
|
||||||
|
allowAllToCreateProjects: sails.config.custom.allowAllToCreateProjects,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -39,12 +39,12 @@ module.exports = {
|
|||||||
async fn(inputs) {
|
async fn(inputs) {
|
||||||
const { currentUser } = this.req;
|
const { currentUser } = this.req;
|
||||||
|
|
||||||
const { card } = await sails.helpers.cards
|
const { card, list, board, project } = await sails.helpers.cards
|
||||||
.getProjectPath(inputs.cardId)
|
.getProjectPath(inputs.cardId)
|
||||||
.intercept('pathNotFound', () => Errors.CARD_NOT_FOUND);
|
.intercept('pathNotFound', () => Errors.CARD_NOT_FOUND);
|
||||||
|
|
||||||
const boardMembership = await BoardMembership.findOne({
|
const boardMembership = await BoardMembership.findOne({
|
||||||
boardId: card.boardId,
|
boardId: board.id,
|
||||||
userId: currentUser.id,
|
userId: currentUser.id,
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -59,10 +59,14 @@ module.exports = {
|
|||||||
const values = _.pick(inputs, ['position', 'name', 'isCompleted']);
|
const values = _.pick(inputs, ['position', 'name', 'isCompleted']);
|
||||||
|
|
||||||
const task = await sails.helpers.tasks.createOne.with({
|
const task = await sails.helpers.tasks.createOne.with({
|
||||||
|
project,
|
||||||
|
board,
|
||||||
|
list,
|
||||||
values: {
|
values: {
|
||||||
...values,
|
...values,
|
||||||
card,
|
card,
|
||||||
},
|
},
|
||||||
|
actorUser: currentUser,
|
||||||
request: this.req,
|
request: this.req,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ module.exports = {
|
|||||||
.intercept('pathNotFound', () => Errors.TASK_NOT_FOUND);
|
.intercept('pathNotFound', () => Errors.TASK_NOT_FOUND);
|
||||||
|
|
||||||
let { task } = path;
|
let { task } = path;
|
||||||
const { board } = path;
|
const { card, list, board, project } = path;
|
||||||
|
|
||||||
const boardMembership = await BoardMembership.findOne({
|
const boardMembership = await BoardMembership.findOne({
|
||||||
boardId: board.id,
|
boardId: board.id,
|
||||||
@@ -49,8 +49,12 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
task = await sails.helpers.tasks.deleteOne.with({
|
task = await sails.helpers.tasks.deleteOne.with({
|
||||||
|
project,
|
||||||
board,
|
board,
|
||||||
|
list,
|
||||||
|
card,
|
||||||
record: task,
|
record: task,
|
||||||
|
actorUser: currentUser,
|
||||||
request: this.req,
|
request: this.req,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ module.exports = {
|
|||||||
.intercept('pathNotFound', () => Errors.TASK_NOT_FOUND);
|
.intercept('pathNotFound', () => Errors.TASK_NOT_FOUND);
|
||||||
|
|
||||||
let { task } = path;
|
let { task } = path;
|
||||||
const { board } = path;
|
const { card, list, board, project } = path;
|
||||||
|
|
||||||
const boardMembership = await BoardMembership.findOne({
|
const boardMembership = await BoardMembership.findOne({
|
||||||
boardId: board.id,
|
boardId: board.id,
|
||||||
@@ -62,8 +62,12 @@ module.exports = {
|
|||||||
|
|
||||||
task = await sails.helpers.tasks.updateOne.with({
|
task = await sails.helpers.tasks.updateOne.with({
|
||||||
values,
|
values,
|
||||||
|
project,
|
||||||
board,
|
board,
|
||||||
|
list,
|
||||||
|
card,
|
||||||
record: task,
|
record: task,
|
||||||
|
actorUser: currentUser,
|
||||||
request: this.req,
|
request: this.req,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -71,6 +71,8 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
async fn(inputs) {
|
async fn(inputs) {
|
||||||
|
const { currentUser } = this.req;
|
||||||
|
|
||||||
if (sails.config.custom.oidcEnforced) {
|
if (sails.config.custom.oidcEnforced) {
|
||||||
throw Errors.NOT_ENOUGH_RIGHTS;
|
throw Errors.NOT_ENOUGH_RIGHTS;
|
||||||
}
|
}
|
||||||
@@ -89,6 +91,7 @@ module.exports = {
|
|||||||
const user = await sails.helpers.users.createOne
|
const user = await sails.helpers.users.createOne
|
||||||
.with({
|
.with({
|
||||||
values,
|
values,
|
||||||
|
actorUser: currentUser,
|
||||||
request: this.req,
|
request: this.req,
|
||||||
})
|
})
|
||||||
.intercept('emailAlreadyInUse', () => Errors.EMAIL_ALREADY_IN_USE)
|
.intercept('emailAlreadyInUse', () => Errors.EMAIL_ALREADY_IN_USE)
|
||||||
|
|||||||
@@ -26,6 +26,8 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
async fn(inputs) {
|
async fn(inputs) {
|
||||||
|
const { currentUser } = this.req;
|
||||||
|
|
||||||
let user = await sails.helpers.users.getOne(inputs.id);
|
let user = await sails.helpers.users.getOne(inputs.id);
|
||||||
|
|
||||||
if (!user) {
|
if (!user) {
|
||||||
@@ -38,6 +40,7 @@ module.exports = {
|
|||||||
|
|
||||||
user = await sails.helpers.users.deleteOne.with({
|
user = await sails.helpers.users.deleteOne.with({
|
||||||
record: user,
|
record: user,
|
||||||
|
actorUser: currentUser,
|
||||||
request: this.req,
|
request: this.req,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ module.exports = {
|
|||||||
values: {
|
values: {
|
||||||
avatar: fileData,
|
avatar: fileData,
|
||||||
},
|
},
|
||||||
user: currentUser,
|
actorUser: currentUser,
|
||||||
request: this.req,
|
request: this.req,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ module.exports = {
|
|||||||
.with({
|
.with({
|
||||||
values,
|
values,
|
||||||
record: user,
|
record: user,
|
||||||
user: currentUser,
|
actorUser: currentUser,
|
||||||
request: this.req,
|
request: this.req,
|
||||||
})
|
})
|
||||||
.intercept('emailAlreadyInUse', () => Errors.EMAIL_ALREADY_IN_USE);
|
.intercept('emailAlreadyInUse', () => Errors.EMAIL_ALREADY_IN_USE);
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ module.exports = {
|
|||||||
user = await sails.helpers.users.updateOne.with({
|
user = await sails.helpers.users.updateOne.with({
|
||||||
values,
|
values,
|
||||||
record: user,
|
record: user,
|
||||||
user: currentUser,
|
actorUser: currentUser,
|
||||||
request: this.req,
|
request: this.req,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ module.exports = {
|
|||||||
.with({
|
.with({
|
||||||
values,
|
values,
|
||||||
record: user,
|
record: user,
|
||||||
user: currentUser,
|
actorUser: currentUser,
|
||||||
request: this.req,
|
request: this.req,
|
||||||
})
|
})
|
||||||
.intercept('usernameAlreadyInUse', () => Errors.USERNAME_ALREADY_IN_USE);
|
.intercept('usernameAlreadyInUse', () => Errors.USERNAME_ALREADY_IN_USE);
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ module.exports = {
|
|||||||
user = await sails.helpers.users.updateOne.with({
|
user = await sails.helpers.users.updateOne.with({
|
||||||
values,
|
values,
|
||||||
record: user,
|
record: user,
|
||||||
user: currentUser,
|
actorUser: currentUser,
|
||||||
request: this.req,
|
request: this.req,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -14,21 +14,21 @@ const valuesValidator = (value) => {
|
|||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
const buildAndSendSlackMessage = async (user, card, action) => {
|
const buildAndSendSlackMessage = async (card, action, actorUser) => {
|
||||||
const cardLink = `<${sails.config.custom.baseUrl}/cards/${card.id}|${card.name}>`;
|
const cardLink = `<${sails.config.custom.baseUrl}/cards/${card.id}|${card.name}>`;
|
||||||
|
|
||||||
let markdown;
|
let markdown;
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case Action.Types.CREATE_CARD:
|
case Action.Types.CREATE_CARD:
|
||||||
markdown = `${cardLink} was created by ${user.name} in *${action.data.list.name}*`;
|
markdown = `${cardLink} was created by ${actorUser.name} in *${action.data.list.name}*`;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case Action.Types.MOVE_CARD:
|
case Action.Types.MOVE_CARD:
|
||||||
markdown = `${cardLink} was moved by ${user.name} to *${action.data.toList.name}*`;
|
markdown = `${cardLink} was moved by ${actorUser.name} to *${action.data.toList.name}*`;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case Action.Types.COMMENT_CARD:
|
case Action.Types.COMMENT_CARD:
|
||||||
markdown = `*${user.name}* commented on ${cardLink}:\n>${action.data.text}`;
|
markdown = `*${actorUser.name}* commented on ${cardLink}:\n>${action.data.text}`;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -45,10 +45,18 @@ module.exports = {
|
|||||||
custom: valuesValidator,
|
custom: valuesValidator,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
|
project: {
|
||||||
|
type: 'ref',
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
board: {
|
board: {
|
||||||
type: 'ref',
|
type: 'ref',
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
|
list: {
|
||||||
|
type: 'ref',
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
request: {
|
request: {
|
||||||
type: 'ref',
|
type: 'ref',
|
||||||
},
|
},
|
||||||
@@ -72,6 +80,24 @@ module.exports = {
|
|||||||
inputs.request,
|
inputs.request,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
sails.helpers.utils.sendWebhooks.with({
|
||||||
|
event: 'actionCreate',
|
||||||
|
data: {
|
||||||
|
item: action,
|
||||||
|
included: {
|
||||||
|
projects: [inputs.project],
|
||||||
|
boards: [inputs.board],
|
||||||
|
lists: [inputs.list],
|
||||||
|
cards: [values.card],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
user: values.user,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (sails.config.custom.slackBotToken) {
|
||||||
|
buildAndSendSlackMessage(values.card, action, values.user);
|
||||||
|
}
|
||||||
|
|
||||||
const subscriptionUserIds = await sails.helpers.cards.getSubscriptionUserIds(
|
const subscriptionUserIds = await sails.helpers.cards.getSubscriptionUserIds(
|
||||||
action.cardId,
|
action.cardId,
|
||||||
action.userId,
|
action.userId,
|
||||||
@@ -84,17 +110,15 @@ module.exports = {
|
|||||||
userId,
|
userId,
|
||||||
action,
|
action,
|
||||||
},
|
},
|
||||||
user: values.user,
|
project: inputs.project,
|
||||||
board: inputs.board,
|
board: inputs.board,
|
||||||
|
list: inputs.list,
|
||||||
card: values.card,
|
card: values.card,
|
||||||
|
actorUser: values.user,
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
if (sails.config.custom.slackBotToken) {
|
|
||||||
buildAndSendSlackMessage(values.user, values.card, action);
|
|
||||||
}
|
|
||||||
|
|
||||||
return action;
|
return action;
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -4,10 +4,26 @@ module.exports = {
|
|||||||
type: 'ref',
|
type: 'ref',
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
|
project: {
|
||||||
|
type: 'ref',
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
board: {
|
board: {
|
||||||
type: 'ref',
|
type: 'ref',
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
|
list: {
|
||||||
|
type: 'ref',
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
card: {
|
||||||
|
type: 'ref',
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
actorUser: {
|
||||||
|
type: 'ref',
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
request: {
|
request: {
|
||||||
type: 'ref',
|
type: 'ref',
|
||||||
},
|
},
|
||||||
@@ -25,6 +41,20 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
inputs.request,
|
inputs.request,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
sails.helpers.utils.sendWebhooks.with({
|
||||||
|
event: 'actionDelete',
|
||||||
|
data: {
|
||||||
|
item: action,
|
||||||
|
included: {
|
||||||
|
projects: [inputs.project],
|
||||||
|
boards: [inputs.board],
|
||||||
|
lists: [inputs.list],
|
||||||
|
cards: [inputs.card],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
user: inputs.actorUser,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return action;
|
return action;
|
||||||
|
|||||||
@@ -8,10 +8,26 @@ module.exports = {
|
|||||||
type: 'json',
|
type: 'json',
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
|
project: {
|
||||||
|
type: 'ref',
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
board: {
|
board: {
|
||||||
type: 'ref',
|
type: 'ref',
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
|
list: {
|
||||||
|
type: 'ref',
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
card: {
|
||||||
|
type: 'ref',
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
actorUser: {
|
||||||
|
type: 'ref',
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
request: {
|
request: {
|
||||||
type: 'ref',
|
type: 'ref',
|
||||||
},
|
},
|
||||||
@@ -31,6 +47,20 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
inputs.request,
|
inputs.request,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
sails.helpers.utils.sendWebhooks.with({
|
||||||
|
event: 'actionUpdate',
|
||||||
|
data: {
|
||||||
|
item: action,
|
||||||
|
included: {
|
||||||
|
projects: [inputs.project],
|
||||||
|
boards: [inputs.board],
|
||||||
|
lists: [inputs.list],
|
||||||
|
cards: [inputs.card],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
user: inputs.actorUser,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return action;
|
return action;
|
||||||
|
|||||||
@@ -21,6 +21,18 @@ module.exports = {
|
|||||||
custom: valuesValidator,
|
custom: valuesValidator,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
|
project: {
|
||||||
|
type: 'ref',
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
board: {
|
||||||
|
type: 'ref',
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
list: {
|
||||||
|
type: 'ref',
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
requestId: {
|
requestId: {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
isNotEmptyString: true,
|
isNotEmptyString: true,
|
||||||
@@ -49,12 +61,30 @@ module.exports = {
|
|||||||
inputs.request,
|
inputs.request,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
sails.helpers.utils.sendWebhooks.with({
|
||||||
|
event: 'attachmentCreate',
|
||||||
|
data: {
|
||||||
|
item: attachment,
|
||||||
|
included: {
|
||||||
|
projects: [inputs.project],
|
||||||
|
boards: [inputs.board],
|
||||||
|
lists: [inputs.list],
|
||||||
|
cards: [values.card],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
user: values.creatorUser,
|
||||||
|
});
|
||||||
|
|
||||||
if (!values.card.coverAttachmentId && attachment.image) {
|
if (!values.card.coverAttachmentId && attachment.image) {
|
||||||
await sails.helpers.cards.updateOne.with({
|
await sails.helpers.cards.updateOne.with({
|
||||||
record: values.card,
|
record: values.card,
|
||||||
values: {
|
values: {
|
||||||
coverAttachmentId: attachment.id,
|
coverAttachmentId: attachment.id,
|
||||||
},
|
},
|
||||||
|
project: inputs.project,
|
||||||
|
board: inputs.board,
|
||||||
|
list: inputs.list,
|
||||||
|
actorUser: values.creatorUser,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,14 +7,26 @@ module.exports = {
|
|||||||
type: 'ref',
|
type: 'ref',
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
|
project: {
|
||||||
|
type: 'ref',
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
board: {
|
board: {
|
||||||
type: 'ref',
|
type: 'ref',
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
|
list: {
|
||||||
|
type: 'ref',
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
card: {
|
card: {
|
||||||
type: 'ref',
|
type: 'ref',
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
|
actorUser: {
|
||||||
|
type: 'ref',
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
request: {
|
request: {
|
||||||
type: 'ref',
|
type: 'ref',
|
||||||
},
|
},
|
||||||
@@ -27,6 +39,10 @@ module.exports = {
|
|||||||
values: {
|
values: {
|
||||||
coverAttachmentId: null,
|
coverAttachmentId: null,
|
||||||
},
|
},
|
||||||
|
project: inputs.project,
|
||||||
|
board: inputs.board,
|
||||||
|
list: inputs.list,
|
||||||
|
actorUser: inputs.actorUser,
|
||||||
request: inputs.request,
|
request: inputs.request,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -48,6 +64,20 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
inputs.request,
|
inputs.request,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
sails.helpers.utils.sendWebhooks.with({
|
||||||
|
event: 'attachmentDelete',
|
||||||
|
data: {
|
||||||
|
item: attachment,
|
||||||
|
included: {
|
||||||
|
projects: [inputs.project],
|
||||||
|
boards: [inputs.board],
|
||||||
|
lists: [inputs.list],
|
||||||
|
cards: [inputs.card],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
user: inputs.actorUser,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return attachment;
|
return attachment;
|
||||||
|
|||||||
@@ -8,10 +8,26 @@ module.exports = {
|
|||||||
type: 'json',
|
type: 'json',
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
|
project: {
|
||||||
|
type: 'ref',
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
board: {
|
board: {
|
||||||
type: 'ref',
|
type: 'ref',
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
|
list: {
|
||||||
|
type: 'ref',
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
card: {
|
||||||
|
type: 'ref',
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
actorUser: {
|
||||||
|
type: 'ref',
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
request: {
|
request: {
|
||||||
type: 'ref',
|
type: 'ref',
|
||||||
},
|
},
|
||||||
@@ -31,6 +47,20 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
inputs.request,
|
inputs.request,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
sails.helpers.utils.sendWebhooks.with({
|
||||||
|
event: 'attachmentUpdate',
|
||||||
|
data: {
|
||||||
|
item: attachment,
|
||||||
|
included: {
|
||||||
|
projects: [inputs.project],
|
||||||
|
boards: [inputs.board],
|
||||||
|
lists: [inputs.list],
|
||||||
|
cards: [inputs.card],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
user: inputs.actorUser,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return attachment;
|
return attachment;
|
||||||
|
|||||||
@@ -21,6 +21,14 @@ module.exports = {
|
|||||||
custom: valuesValidator,
|
custom: valuesValidator,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
|
project: {
|
||||||
|
type: 'ref',
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
actorUser: {
|
||||||
|
type: 'ref',
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
request: {
|
request: {
|
||||||
type: 'ref',
|
type: 'ref',
|
||||||
},
|
},
|
||||||
@@ -67,6 +75,19 @@ module.exports = {
|
|||||||
inputs.request,
|
inputs.request,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
sails.helpers.utils.sendWebhooks.with({
|
||||||
|
event: 'boardMembershipCreate',
|
||||||
|
data: {
|
||||||
|
item: boardMembership,
|
||||||
|
included: {
|
||||||
|
users: [values.user],
|
||||||
|
projects: [inputs.project],
|
||||||
|
boards: [values.board],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
user: inputs.actorUser,
|
||||||
|
});
|
||||||
|
|
||||||
return boardMembership;
|
return boardMembership;
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -10,6 +10,14 @@ module.exports = {
|
|||||||
type: 'ref',
|
type: 'ref',
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
|
board: {
|
||||||
|
type: 'ref',
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
actorUser: {
|
||||||
|
type: 'ref',
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
request: {
|
request: {
|
||||||
type: 'ref',
|
type: 'ref',
|
||||||
},
|
},
|
||||||
@@ -73,6 +81,18 @@ module.exports = {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sails.helpers.utils.sendWebhooks.with({
|
||||||
|
event: 'boardMembershipDelete',
|
||||||
|
data: {
|
||||||
|
item: boardMembership,
|
||||||
|
included: {
|
||||||
|
projects: [inputs.project],
|
||||||
|
boards: [inputs.board],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
user: inputs.actorUser,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return boardMembership;
|
return boardMembership;
|
||||||
|
|||||||
@@ -8,6 +8,18 @@ module.exports = {
|
|||||||
type: 'json',
|
type: 'json',
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
|
project: {
|
||||||
|
type: 'ref',
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
board: {
|
||||||
|
type: 'ref',
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
actorUser: {
|
||||||
|
type: 'ref',
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
request: {
|
request: {
|
||||||
type: 'ref',
|
type: 'ref',
|
||||||
},
|
},
|
||||||
@@ -40,6 +52,18 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
inputs.request,
|
inputs.request,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
sails.helpers.utils.sendWebhooks.with({
|
||||||
|
event: 'boardMembershipUpdate',
|
||||||
|
data: {
|
||||||
|
item: boardMembership,
|
||||||
|
included: {
|
||||||
|
projects: [inputs.project],
|
||||||
|
boards: [inputs.board],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
user: inputs.actorUser,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return boardMembership;
|
return boardMembership;
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ module.exports = {
|
|||||||
type: 'json',
|
type: 'json',
|
||||||
custom: importValidator,
|
custom: importValidator,
|
||||||
},
|
},
|
||||||
user: {
|
actorUser: {
|
||||||
type: 'ref',
|
type: 'ref',
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
@@ -80,6 +80,8 @@ module.exports = {
|
|||||||
position: nextPosition,
|
position: nextPosition,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// TODO: send webhooks
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -90,12 +92,12 @@ module.exports = {
|
|||||||
}).fetch();
|
}).fetch();
|
||||||
|
|
||||||
if (inputs.import && inputs.import.type === Board.ImportTypes.TRELLO) {
|
if (inputs.import && inputs.import.type === Board.ImportTypes.TRELLO) {
|
||||||
await sails.helpers.boards.importFromTrello(inputs.user, board, inputs.import.board);
|
await sails.helpers.boards.importFromTrello(board, inputs.import.board, inputs.actorUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
const boardMembership = await BoardMembership.create({
|
const boardMembership = await BoardMembership.create({
|
||||||
boardId: board.id,
|
boardId: board.id,
|
||||||
userId: inputs.user.id,
|
userId: inputs.actorUser.id,
|
||||||
role: BoardMembership.Roles.EDITOR,
|
role: BoardMembership.Roles.EDITOR,
|
||||||
}).fetch();
|
}).fetch();
|
||||||
|
|
||||||
@@ -111,6 +113,17 @@ module.exports = {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
sails.helpers.utils.sendWebhooks.with({
|
||||||
|
event: 'boardCreate',
|
||||||
|
data: {
|
||||||
|
item: board,
|
||||||
|
included: {
|
||||||
|
projects: [values.project],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
user: inputs.actorUser,
|
||||||
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
board,
|
board,
|
||||||
boardMembership,
|
boardMembership,
|
||||||
|
|||||||
@@ -4,6 +4,14 @@ module.exports = {
|
|||||||
type: 'ref',
|
type: 'ref',
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
|
project: {
|
||||||
|
type: 'ref',
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
actorUser: {
|
||||||
|
type: 'ref',
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
request: {
|
request: {
|
||||||
type: 'ref',
|
type: 'ref',
|
||||||
},
|
},
|
||||||
@@ -33,6 +41,17 @@ module.exports = {
|
|||||||
inputs.request,
|
inputs.request,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
sails.helpers.utils.sendWebhooks.with({
|
||||||
|
event: 'boardDelete',
|
||||||
|
data: {
|
||||||
|
item: board,
|
||||||
|
included: {
|
||||||
|
projects: [inputs.project],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
user: inputs.actorUser,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return board;
|
return board;
|
||||||
|
|||||||
@@ -2,10 +2,6 @@ const POSITION_GAP = 65535; // TODO: move to config
|
|||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
inputs: {
|
inputs: {
|
||||||
user: {
|
|
||||||
type: 'ref',
|
|
||||||
required: true,
|
|
||||||
},
|
|
||||||
board: {
|
board: {
|
||||||
type: 'ref',
|
type: 'ref',
|
||||||
required: true,
|
required: true,
|
||||||
@@ -14,6 +10,10 @@ module.exports = {
|
|||||||
type: 'json',
|
type: 'json',
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
|
actorUser: {
|
||||||
|
type: 'ref',
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
async fn(inputs) {
|
async fn(inputs) {
|
||||||
@@ -87,7 +87,7 @@ module.exports = {
|
|||||||
trelloComments.map(async (trelloComment) => {
|
trelloComments.map(async (trelloComment) => {
|
||||||
return Action.create({
|
return Action.create({
|
||||||
cardId: plankaCard.id,
|
cardId: plankaCard.id,
|
||||||
userId: inputs.user.id,
|
userId: inputs.actorUser.id,
|
||||||
type: 'commentCard',
|
type: 'commentCard',
|
||||||
data: {
|
data: {
|
||||||
text:
|
text:
|
||||||
@@ -105,7 +105,7 @@ module.exports = {
|
|||||||
const plankaCard = await Card.create({
|
const plankaCard = await Card.create({
|
||||||
boardId: inputs.board.id,
|
boardId: inputs.board.id,
|
||||||
listId: plankaList.id,
|
listId: plankaList.id,
|
||||||
creatorUserId: inputs.user.id,
|
creatorUserId: inputs.actorUser.id,
|
||||||
position: trelloCard.pos,
|
position: trelloCard.pos,
|
||||||
name: trelloCard.name,
|
name: trelloCard.name,
|
||||||
description: trelloCard.desc || null,
|
description: trelloCard.desc || null,
|
||||||
|
|||||||
@@ -21,6 +21,14 @@ module.exports = {
|
|||||||
custom: valuesValidator,
|
custom: valuesValidator,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
|
project: {
|
||||||
|
type: 'ref',
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
actorUser: {
|
||||||
|
type: 'ref',
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
request: {
|
request: {
|
||||||
type: 'ref',
|
type: 'ref',
|
||||||
},
|
},
|
||||||
@@ -64,6 +72,8 @@ module.exports = {
|
|||||||
position: nextPosition,
|
position: nextPosition,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// TODO: send webhooks
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -81,6 +91,17 @@ module.exports = {
|
|||||||
inputs.request,
|
inputs.request,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
sails.helpers.utils.sendWebhooks.with({
|
||||||
|
event: 'boardUpdate',
|
||||||
|
data: {
|
||||||
|
item: board,
|
||||||
|
included: {
|
||||||
|
projects: [inputs.project],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
user: inputs.actorUser,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return board;
|
return board;
|
||||||
|
|||||||
@@ -21,6 +21,22 @@ module.exports = {
|
|||||||
custom: valuesValidator,
|
custom: valuesValidator,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
|
project: {
|
||||||
|
type: 'ref',
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
board: {
|
||||||
|
type: 'ref',
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
list: {
|
||||||
|
type: 'ref',
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
actorUser: {
|
||||||
|
type: 'ref',
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
request: {
|
request: {
|
||||||
type: 'ref',
|
type: 'ref',
|
||||||
},
|
},
|
||||||
@@ -50,6 +66,21 @@ module.exports = {
|
|||||||
inputs.request,
|
inputs.request,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
sails.helpers.utils.sendWebhooks.with({
|
||||||
|
event: 'cardLabelCreate',
|
||||||
|
data: {
|
||||||
|
item: cardLabel,
|
||||||
|
included: {
|
||||||
|
projects: [inputs.project],
|
||||||
|
boards: [inputs.board],
|
||||||
|
labels: [values.label],
|
||||||
|
lists: [inputs.list],
|
||||||
|
cards: [values.card],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
user: inputs.actorUser,
|
||||||
|
});
|
||||||
|
|
||||||
return cardLabel;
|
return cardLabel;
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -4,10 +4,26 @@ module.exports = {
|
|||||||
type: 'ref',
|
type: 'ref',
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
|
project: {
|
||||||
|
type: 'ref',
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
board: {
|
board: {
|
||||||
type: 'ref',
|
type: 'ref',
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
|
list: {
|
||||||
|
type: 'ref',
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
card: {
|
||||||
|
type: 'ref',
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
actorUser: {
|
||||||
|
type: 'ref',
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
request: {
|
request: {
|
||||||
type: 'ref',
|
type: 'ref',
|
||||||
},
|
},
|
||||||
@@ -25,6 +41,20 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
inputs.request,
|
inputs.request,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
sails.helpers.utils.sendWebhooks.with({
|
||||||
|
event: 'cardLabelDelete',
|
||||||
|
data: {
|
||||||
|
item: cardLabel,
|
||||||
|
included: {
|
||||||
|
projects: [inputs.project],
|
||||||
|
boards: [inputs.board],
|
||||||
|
lists: [inputs.list],
|
||||||
|
cards: [inputs.card],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
user: inputs.actorUser,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return cardLabel;
|
return cardLabel;
|
||||||
|
|||||||
@@ -21,6 +21,22 @@ module.exports = {
|
|||||||
custom: valuesValidator,
|
custom: valuesValidator,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
|
project: {
|
||||||
|
type: 'ref',
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
board: {
|
||||||
|
type: 'ref',
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
list: {
|
||||||
|
type: 'ref',
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
actorUser: {
|
||||||
|
type: 'ref',
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
request: {
|
request: {
|
||||||
type: 'ref',
|
type: 'ref',
|
||||||
},
|
},
|
||||||
@@ -53,6 +69,20 @@ module.exports = {
|
|||||||
inputs.request,
|
inputs.request,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
sails.helpers.utils.sendWebhooks.with({
|
||||||
|
event: 'cardMembershipCreate',
|
||||||
|
data: {
|
||||||
|
item: cardMembership,
|
||||||
|
included: {
|
||||||
|
projects: [inputs.project],
|
||||||
|
boards: [inputs.board],
|
||||||
|
lists: [inputs.list],
|
||||||
|
cards: [values.card],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
user: inputs.actorUser,
|
||||||
|
});
|
||||||
|
|
||||||
const cardSubscription = await CardSubscription.create({
|
const cardSubscription = await CardSubscription.create({
|
||||||
cardId: cardMembership.cardId,
|
cardId: cardMembership.cardId,
|
||||||
userId: cardMembership.userId,
|
userId: cardMembership.userId,
|
||||||
@@ -73,6 +103,8 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
inputs.request,
|
inputs.request,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// TODO: send webhooks
|
||||||
}
|
}
|
||||||
|
|
||||||
return cardMembership;
|
return cardMembership;
|
||||||
|
|||||||
@@ -4,10 +4,26 @@ module.exports = {
|
|||||||
type: 'ref',
|
type: 'ref',
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
|
project: {
|
||||||
|
type: 'ref',
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
board: {
|
board: {
|
||||||
type: 'ref',
|
type: 'ref',
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
|
list: {
|
||||||
|
type: 'ref',
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
card: {
|
||||||
|
type: 'ref',
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
actorUser: {
|
||||||
|
type: 'ref',
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
request: {
|
request: {
|
||||||
type: 'ref',
|
type: 'ref',
|
||||||
},
|
},
|
||||||
@@ -26,6 +42,20 @@ module.exports = {
|
|||||||
inputs.request,
|
inputs.request,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
sails.helpers.utils.sendWebhooks.with({
|
||||||
|
event: 'cardMembershipDelete',
|
||||||
|
data: {
|
||||||
|
item: cardMembership,
|
||||||
|
included: {
|
||||||
|
projects: [inputs.project],
|
||||||
|
boards: [inputs.board],
|
||||||
|
lists: [inputs.list],
|
||||||
|
cards: [inputs.card],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
user: inputs.actorUser,
|
||||||
|
});
|
||||||
|
|
||||||
const cardSubscription = await CardSubscription.destroyOne({
|
const cardSubscription = await CardSubscription.destroyOne({
|
||||||
cardId: cardMembership.cardId,
|
cardId: cardMembership.cardId,
|
||||||
userId: cardMembership.userId,
|
userId: cardMembership.userId,
|
||||||
@@ -39,6 +69,8 @@ module.exports = {
|
|||||||
isSubscribed: false,
|
isSubscribed: false,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// TODO: send webhook
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,10 @@ module.exports = {
|
|||||||
custom: valuesValidator,
|
custom: valuesValidator,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
|
project: {
|
||||||
|
type: 'ref',
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
board: {
|
board: {
|
||||||
type: 'ref',
|
type: 'ref',
|
||||||
required: true,
|
required: true,
|
||||||
@@ -66,6 +70,8 @@ module.exports = {
|
|||||||
position: nextPosition,
|
position: nextPosition,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// TODO: send webhooks
|
||||||
});
|
});
|
||||||
|
|
||||||
const card = await Card.create({
|
const card = await Card.create({
|
||||||
@@ -85,6 +91,19 @@ module.exports = {
|
|||||||
inputs.request,
|
inputs.request,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
sails.helpers.utils.sendWebhooks.with({
|
||||||
|
event: 'cardCreate',
|
||||||
|
data: {
|
||||||
|
item: card,
|
||||||
|
included: {
|
||||||
|
projects: [inputs.project],
|
||||||
|
boards: [inputs.board],
|
||||||
|
lists: [values.list],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
user: values.creatorUser,
|
||||||
|
});
|
||||||
|
|
||||||
if (values.creatorUser.subscribeToOwnCards) {
|
if (values.creatorUser.subscribeToOwnCards) {
|
||||||
await CardSubscription.create({
|
await CardSubscription.create({
|
||||||
cardId: card.id,
|
cardId: card.id,
|
||||||
@@ -97,6 +116,8 @@ module.exports = {
|
|||||||
isSubscribed: true,
|
isSubscribed: true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// TODO: send webhooks
|
||||||
}
|
}
|
||||||
|
|
||||||
await sails.helpers.actions.createOne.with({
|
await sails.helpers.actions.createOne.with({
|
||||||
@@ -108,7 +129,10 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
user: values.creatorUser,
|
user: values.creatorUser,
|
||||||
},
|
},
|
||||||
|
project: inputs.project,
|
||||||
board: inputs.board,
|
board: inputs.board,
|
||||||
|
list: values.list,
|
||||||
|
request: inputs.request,
|
||||||
});
|
});
|
||||||
|
|
||||||
return card;
|
return card;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
const buildAndSendSlackMessage = async (user, card) => {
|
const buildAndSendSlackMessage = async (card, actorUser) => {
|
||||||
await sails.helpers.utils.sendSlackMessage(`*${card.name}* was deleted by ${user.name}`);
|
await sails.helpers.utils.sendSlackMessage(`*${card.name}* was deleted by ${actorUser.name}`);
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
@@ -8,7 +8,19 @@ module.exports = {
|
|||||||
type: 'ref',
|
type: 'ref',
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
user: {
|
project: {
|
||||||
|
type: 'ref',
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
board: {
|
||||||
|
type: 'ref',
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
list: {
|
||||||
|
type: 'ref',
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
actorUser: {
|
||||||
type: 'ref',
|
type: 'ref',
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
@@ -30,8 +42,21 @@ module.exports = {
|
|||||||
inputs.request,
|
inputs.request,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
sails.helpers.utils.sendWebhooks.with({
|
||||||
|
event: 'cardDelete',
|
||||||
|
data: {
|
||||||
|
item: card,
|
||||||
|
included: {
|
||||||
|
projects: [inputs.project],
|
||||||
|
boards: [inputs.board],
|
||||||
|
lists: [inputs.list],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
user: inputs.actorUser,
|
||||||
|
});
|
||||||
|
|
||||||
if (sails.config.custom.slackBotToken) {
|
if (sails.config.custom.slackBotToken) {
|
||||||
buildAndSendSlackMessage(inputs.user, card);
|
buildAndSendSlackMessage(card, inputs.actorUser);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,10 @@ module.exports = {
|
|||||||
custom: valuesValidator,
|
custom: valuesValidator,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
|
project: {
|
||||||
|
type: 'ref',
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
board: {
|
board: {
|
||||||
type: 'ref',
|
type: 'ref',
|
||||||
required: true,
|
required: true,
|
||||||
@@ -62,6 +66,8 @@ module.exports = {
|
|||||||
position: nextPosition,
|
position: nextPosition,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// TODO: send webhooks
|
||||||
});
|
});
|
||||||
|
|
||||||
const card = await Card.create({
|
const card = await Card.create({
|
||||||
@@ -108,6 +114,19 @@ module.exports = {
|
|||||||
inputs.request,
|
inputs.request,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
sails.helpers.utils.sendWebhooks.with({
|
||||||
|
event: 'cardCreate',
|
||||||
|
data: {
|
||||||
|
item: card,
|
||||||
|
included: {
|
||||||
|
projects: [inputs.project],
|
||||||
|
boards: [inputs.board],
|
||||||
|
lists: [inputs.list],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
user: values.creatorUser,
|
||||||
|
});
|
||||||
|
|
||||||
if (values.creatorUser.subscribeToOwnCards) {
|
if (values.creatorUser.subscribeToOwnCards) {
|
||||||
await CardSubscription.create({
|
await CardSubscription.create({
|
||||||
cardId: card.id,
|
cardId: card.id,
|
||||||
@@ -120,6 +139,8 @@ module.exports = {
|
|||||||
isSubscribed: true,
|
isSubscribed: true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// TODO: send webhooks
|
||||||
}
|
}
|
||||||
|
|
||||||
await sails.helpers.actions.createOne.with({
|
await sails.helpers.actions.createOne.with({
|
||||||
@@ -131,7 +152,10 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
user: values.creatorUser,
|
user: values.creatorUser,
|
||||||
},
|
},
|
||||||
|
project: inputs.project,
|
||||||
board: inputs.board,
|
board: inputs.board,
|
||||||
|
list: inputs.list,
|
||||||
|
request: inputs.request,
|
||||||
});
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -7,8 +7,14 @@ const valuesValidator = (value) => {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_.isUndefined(value.board) && !_.isPlainObject(value.board)) {
|
if (!_.isUndefined(value.board)) {
|
||||||
return false;
|
if (!_.isPlainObject(value.project)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!_.isPlainObject(value.board)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_.isUndefined(value.list) && !_.isPlainObject(value.list)) {
|
if (!_.isUndefined(value.list) && !_.isPlainObject(value.list)) {
|
||||||
@@ -29,14 +35,21 @@ module.exports = {
|
|||||||
custom: valuesValidator,
|
custom: valuesValidator,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
user: {
|
project: {
|
||||||
type: 'ref',
|
type: 'ref',
|
||||||
|
required: true,
|
||||||
},
|
},
|
||||||
board: {
|
board: {
|
||||||
type: 'ref',
|
type: 'ref',
|
||||||
|
required: true,
|
||||||
},
|
},
|
||||||
list: {
|
list: {
|
||||||
type: 'ref',
|
type: 'ref',
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
actorUser: {
|
||||||
|
type: 'ref',
|
||||||
|
required: true,
|
||||||
},
|
},
|
||||||
request: {
|
request: {
|
||||||
type: 'ref',
|
type: 'ref',
|
||||||
@@ -45,65 +58,56 @@ module.exports = {
|
|||||||
|
|
||||||
exits: {
|
exits: {
|
||||||
positionMustBeInValues: {},
|
positionMustBeInValues: {},
|
||||||
|
boardInValuesMustBelongToProject: {},
|
||||||
listMustBeInValues: {},
|
listMustBeInValues: {},
|
||||||
listInValuesMustBelongToBoard: {},
|
listInValuesMustBelongToBoard: {},
|
||||||
userMustBePresent: {},
|
|
||||||
boardMustBePresent: {},
|
|
||||||
listMustBePresent: {},
|
|
||||||
},
|
},
|
||||||
|
|
||||||
async fn(inputs) {
|
async fn(inputs) {
|
||||||
const { isSubscribed, ...values } = inputs.values;
|
const { isSubscribed, ...values } = inputs.values;
|
||||||
|
|
||||||
if (values.board || values.list || !_.isUndefined(values.position)) {
|
if (values.project && values.project.id === inputs.project.id) {
|
||||||
if (!inputs.board) {
|
delete values.project;
|
||||||
throw 'boardMustBePresent';
|
}
|
||||||
|
|
||||||
|
const project = values.project || inputs.project;
|
||||||
|
|
||||||
|
if (values.board) {
|
||||||
|
if (values.board.projectId !== project.id) {
|
||||||
|
throw 'boardInValuesMustBelongToProject';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (values.board) {
|
if (values.board.id === inputs.board.id) {
|
||||||
if (values.board.id === inputs.board.id) {
|
delete values.board;
|
||||||
delete values.board;
|
} else {
|
||||||
} else {
|
values.boardId = values.board.id;
|
||||||
values.boardId = values.board.id;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const board = values.board || inputs.board;
|
|
||||||
|
|
||||||
if (values.list) {
|
|
||||||
if (!inputs.list) {
|
|
||||||
throw 'listMustBePresent';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (values.list.boardId !== board.id) {
|
|
||||||
throw 'listInValuesMustBelongToBoard';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (values.list.id === inputs.list.id) {
|
|
||||||
delete values.list;
|
|
||||||
} else {
|
|
||||||
values.listId = values.list.id;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (values.list) {
|
|
||||||
if (_.isUndefined(values.position)) {
|
|
||||||
throw 'positionMustBeInValues';
|
|
||||||
}
|
|
||||||
} else if (values.board) {
|
|
||||||
throw 'listMustBeInValues';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((!_.isUndefined(isSubscribed) || values.board || values.list) && !inputs.user) {
|
const board = values.board || inputs.board;
|
||||||
throw 'userMustBePresent';
|
|
||||||
|
if (values.list) {
|
||||||
|
if (values.list.boardId !== board.id) {
|
||||||
|
throw 'listInValuesMustBelongToBoard';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (values.list.id === inputs.list.id) {
|
||||||
|
delete values.list;
|
||||||
|
} else {
|
||||||
|
values.listId = values.list.id;
|
||||||
|
}
|
||||||
|
} else if (values.board) {
|
||||||
|
throw 'listMustBeInValues';
|
||||||
|
}
|
||||||
|
|
||||||
|
const list = values.list || inputs.list;
|
||||||
|
|
||||||
|
if (values.list && _.isUndefined(values.position)) {
|
||||||
|
throw 'positionMustBeInValues';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_.isUndefined(values.position)) {
|
if (!_.isUndefined(values.position)) {
|
||||||
const boardId = values.boardId || inputs.record.boardId;
|
const cards = await sails.helpers.lists.getCards(list.id, inputs.record.id);
|
||||||
const listId = values.listId || inputs.record.listId;
|
|
||||||
|
|
||||||
const cards = await sails.helpers.lists.getCards(listId, inputs.record.id);
|
|
||||||
|
|
||||||
const { position, repositions } = sails.helpers.utils.insertToPositionables(
|
const { position, repositions } = sails.helpers.utils.insertToPositionables(
|
||||||
values.position,
|
values.position,
|
||||||
@@ -115,17 +119,19 @@ module.exports = {
|
|||||||
repositions.forEach(async ({ id, position: nextPosition }) => {
|
repositions.forEach(async ({ id, position: nextPosition }) => {
|
||||||
await Card.update({
|
await Card.update({
|
||||||
id,
|
id,
|
||||||
listId,
|
listId: list.id,
|
||||||
}).set({
|
}).set({
|
||||||
position: nextPosition,
|
position: nextPosition,
|
||||||
});
|
});
|
||||||
|
|
||||||
sails.sockets.broadcast(`board:${boardId}`, 'cardUpdate', {
|
sails.sockets.broadcast(`board:${board.id}`, 'cardUpdate', {
|
||||||
item: {
|
item: {
|
||||||
id,
|
id,
|
||||||
position: nextPosition,
|
position: nextPosition,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// TODO: send webhooks
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -175,10 +181,12 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const { id } = await sails.helpers.labels.createOne.with({
|
const { id } = await sails.helpers.labels.createOne.with({
|
||||||
|
project,
|
||||||
values: {
|
values: {
|
||||||
..._.omit(label, ['id', 'boardId']),
|
..._.omit(label, ['id', 'boardId']),
|
||||||
board: values.board,
|
board: values.board,
|
||||||
},
|
},
|
||||||
|
actorUser: inputs.actorUser,
|
||||||
});
|
});
|
||||||
|
|
||||||
return id;
|
return id;
|
||||||
@@ -196,6 +204,15 @@ module.exports = {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
sails.sockets.broadcast(
|
||||||
|
`board:${inputs.record.boardId}`,
|
||||||
|
'cardDelete', // TODO: introduce separate event
|
||||||
|
{
|
||||||
|
item: inputs.record,
|
||||||
|
},
|
||||||
|
inputs.request,
|
||||||
|
);
|
||||||
|
|
||||||
sails.sockets.broadcast(`board:${card.boardId}`, 'cardUpdate', {
|
sails.sockets.broadcast(`board:${card.boardId}`, 'cardUpdate', {
|
||||||
item: card,
|
item: card,
|
||||||
});
|
});
|
||||||
@@ -209,6 +226,8 @@ module.exports = {
|
|||||||
isSubscribed: true,
|
isSubscribed: true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// TODO: send webhooks
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
sails.sockets.broadcast(
|
sails.sockets.broadcast(
|
||||||
@@ -221,18 +240,34 @@ module.exports = {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sails.helpers.utils.sendWebhooks.with({
|
||||||
|
event: 'cardUpdate',
|
||||||
|
data: {
|
||||||
|
item: card,
|
||||||
|
included: {
|
||||||
|
projects: [project],
|
||||||
|
boards: [board],
|
||||||
|
lists: [list],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
user: inputs.actorUser,
|
||||||
|
});
|
||||||
|
|
||||||
if (!values.board && values.list) {
|
if (!values.board && values.list) {
|
||||||
await sails.helpers.actions.createOne.with({
|
await sails.helpers.actions.createOne.with({
|
||||||
|
project,
|
||||||
|
board,
|
||||||
|
list,
|
||||||
values: {
|
values: {
|
||||||
card,
|
card,
|
||||||
user: inputs.user,
|
user: inputs.actorUser,
|
||||||
type: Action.Types.MOVE_CARD,
|
type: Action.Types.MOVE_CARD,
|
||||||
data: {
|
data: {
|
||||||
fromList: _.pick(inputs.list, ['id', 'name']),
|
fromList: _.pick(inputs.list, ['id', 'name']),
|
||||||
toList: _.pick(values.list, ['id', 'name']),
|
toList: _.pick(values.list, ['id', 'name']),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
board: inputs.board,
|
request: inputs.request,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -240,23 +275,26 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!_.isUndefined(isSubscribed)) {
|
if (!_.isUndefined(isSubscribed)) {
|
||||||
const prevIsSubscribed = await sails.helpers.users.isCardSubscriber(inputs.user.id, card.id);
|
const prevIsSubscribed = await sails.helpers.users.isCardSubscriber(
|
||||||
|
inputs.actorUser.id,
|
||||||
|
card.id,
|
||||||
|
);
|
||||||
|
|
||||||
if (isSubscribed !== prevIsSubscribed) {
|
if (isSubscribed !== prevIsSubscribed) {
|
||||||
if (isSubscribed) {
|
if (isSubscribed) {
|
||||||
await CardSubscription.create({
|
await CardSubscription.create({
|
||||||
cardId: card.id,
|
cardId: card.id,
|
||||||
userId: inputs.user.id,
|
userId: inputs.actorUser.id,
|
||||||
}).tolerate('E_UNIQUE');
|
}).tolerate('E_UNIQUE');
|
||||||
} else {
|
} else {
|
||||||
await CardSubscription.destroyOne({
|
await CardSubscription.destroyOne({
|
||||||
cardId: card.id,
|
cardId: card.id,
|
||||||
userId: inputs.user.id,
|
userId: inputs.actorUser.id,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
sails.sockets.broadcast(
|
sails.sockets.broadcast(
|
||||||
`user:${inputs.user.id}`,
|
`user:${inputs.actorUser.id}`,
|
||||||
'cardUpdate',
|
'cardUpdate',
|
||||||
{
|
{
|
||||||
item: {
|
item: {
|
||||||
@@ -266,6 +304,8 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
inputs.request,
|
inputs.request,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// TODO: send webhooks
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,14 @@ module.exports = {
|
|||||||
custom: valuesValidator,
|
custom: valuesValidator,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
|
project: {
|
||||||
|
type: 'ref',
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
actorUser: {
|
||||||
|
type: 'ref',
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
request: {
|
request: {
|
||||||
type: 'ref',
|
type: 'ref',
|
||||||
},
|
},
|
||||||
@@ -50,6 +58,8 @@ module.exports = {
|
|||||||
position: nextPosition,
|
position: nextPosition,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// TODO: send webhooks
|
||||||
});
|
});
|
||||||
|
|
||||||
const label = await Label.create({
|
const label = await Label.create({
|
||||||
@@ -67,6 +77,18 @@ module.exports = {
|
|||||||
inputs.request,
|
inputs.request,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
sails.helpers.utils.sendWebhooks.with({
|
||||||
|
event: 'labelCreate',
|
||||||
|
data: {
|
||||||
|
item: label,
|
||||||
|
included: {
|
||||||
|
projects: [inputs.project],
|
||||||
|
boards: [values.board],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
user: inputs.actorUser,
|
||||||
|
});
|
||||||
|
|
||||||
return label;
|
return label;
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -4,6 +4,18 @@ module.exports = {
|
|||||||
type: 'ref',
|
type: 'ref',
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
|
project: {
|
||||||
|
type: 'ref',
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
board: {
|
||||||
|
type: 'ref',
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
actorUser: {
|
||||||
|
type: 'ref',
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
request: {
|
request: {
|
||||||
type: 'ref',
|
type: 'ref',
|
||||||
},
|
},
|
||||||
@@ -25,6 +37,18 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
inputs.request,
|
inputs.request,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
sails.helpers.utils.sendWebhooks.with({
|
||||||
|
event: 'labelDelete',
|
||||||
|
data: {
|
||||||
|
item: label,
|
||||||
|
included: {
|
||||||
|
projects: [inputs.project],
|
||||||
|
boards: [inputs.board],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
user: inputs.actorUser,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return label;
|
return label;
|
||||||
|
|||||||
@@ -21,6 +21,18 @@ module.exports = {
|
|||||||
custom: valuesValidator,
|
custom: valuesValidator,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
|
project: {
|
||||||
|
type: 'ref',
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
board: {
|
||||||
|
type: 'ref',
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
actorUser: {
|
||||||
|
type: 'ref',
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
request: {
|
request: {
|
||||||
type: 'ref',
|
type: 'ref',
|
||||||
},
|
},
|
||||||
@@ -53,6 +65,8 @@ module.exports = {
|
|||||||
position: nextPosition,
|
position: nextPosition,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// TODO: send webhooks
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,6 +81,18 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
inputs.request,
|
inputs.request,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
sails.helpers.utils.sendWebhooks.with({
|
||||||
|
event: 'labelUpdate',
|
||||||
|
data: {
|
||||||
|
item: label,
|
||||||
|
included: {
|
||||||
|
projects: [inputs.project],
|
||||||
|
boards: [inputs.board],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
user: inputs.actorUser,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return label;
|
return label;
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user