| /******************************************************************************** |
| * Copyright (c) 2020 Contributors to the Eclipse Foundation |
| * |
| * See the NOTICE file(s) distributed with this work for additional |
| * information regarding copyright ownership. |
| * |
| * This program and the accompanying materials are made available under the |
| * terms of the Eclipse Public License 2.0 which is available at |
| * http://www.eclipse.org/legal/epl-2.0 |
| * |
| * SPDX-License-Identifier: EPL-2.0 |
| ********************************************************************************/ |
| |
| import {createAction, props} from "@ngrx/store"; |
| import {IAPIAttachmentModel} from "../../../core/api"; |
| import {IAttachmentError, IAttachmentFormValue, IAttachmentWithTags} from "../model"; |
| |
| export const fetchAttachmentsAction = createAction( |
| "[Details/Edit] Fetch attachments", |
| props<{ statementId: number }>() |
| ); |
| |
| export const submitAttachmentFormAction = createAction( |
| "[Edit/Details] Add or remove attachments", |
| props<{ |
| statementId: number, |
| taskId: string, |
| value?: IAttachmentFormValue; |
| }>() |
| ); |
| |
| export const addAttachmentErrorAction = createAction( |
| "[API] Add attachment error", |
| props<{ |
| statementId: number, |
| taskId: string, |
| addError: IAttachmentError<IAttachmentWithTags<File>>[], |
| removeError: IAttachmentError<number>[] |
| }>() |
| ); |
| |
| export const clearFileCacheAction = createAction( |
| "[Edit/API] Clear file cache", |
| props<{ statementId: number; }>() |
| ); |
| |
| export const setAttachmentsAction = createAction( |
| "[API] Set attachments", |
| props<{ statementId: number, entities: IAPIAttachmentModel[] }>() |
| ); |
| |
| export const addAttachmentEntityAction = createAction( |
| "[API] Add attachment", |
| props<{ statementId: number, entity: IAPIAttachmentModel }>() |
| ); |
| |
| export const deleteAttachmentsAction = createAction( |
| "[API] Delete attachments", |
| props<{ statementId: number, entityIds: number[] }>() |
| ); |