Merge pull request #3568 from omnivore-app/feat/rules-delete-item-rule
Add a rule to delete items
This commit is contained in:
@ -12,6 +12,7 @@ import { User } from './user'
|
||||
export enum RuleActionType {
|
||||
AddLabel = 'ADD_LABEL',
|
||||
Archive = 'ARCHIVE',
|
||||
Delete = 'DELETE',
|
||||
MarkAsRead = 'MARK_AS_READ',
|
||||
SendNotification = 'SEND_NOTIFICATION',
|
||||
}
|
||||
|
||||
@ -2215,6 +2215,7 @@ export type RuleActionInput = {
|
||||
export enum RuleActionType {
|
||||
AddLabel = 'ADD_LABEL',
|
||||
Archive = 'ARCHIVE',
|
||||
Delete = 'DELETE',
|
||||
MarkAsRead = 'MARK_AS_READ',
|
||||
SendNotification = 'SEND_NOTIFICATION'
|
||||
}
|
||||
|
||||
@ -1655,6 +1655,7 @@ input RuleActionInput {
|
||||
enum RuleActionType {
|
||||
ADD_LABEL
|
||||
ARCHIVE
|
||||
DELETE
|
||||
MARK_AS_READ
|
||||
SEND_NOTIFICATION
|
||||
}
|
||||
|
||||
@ -5,6 +5,7 @@ import { addLabelsToLibraryItem } from '../services/labels'
|
||||
import {
|
||||
SearchArgs,
|
||||
searchLibraryItems,
|
||||
softDeleteLibraryItem,
|
||||
updateLibraryItem,
|
||||
} from '../services/library_item'
|
||||
import { findEnabledRules } from '../services/rules'
|
||||
@ -38,6 +39,10 @@ const addLabels = async (obj: RuleActionObj) => {
|
||||
)
|
||||
}
|
||||
|
||||
const deleteLibraryItem = async (obj: RuleActionObj) => {
|
||||
return softDeleteLibraryItem(obj.libraryItem.id, obj.userId)
|
||||
}
|
||||
|
||||
const archivePage = async (obj: RuleActionObj) => {
|
||||
return updateLibraryItem(
|
||||
obj.libraryItem.id,
|
||||
@ -76,6 +81,8 @@ const getRuleAction = (actionType: RuleActionType): RuleActionFunc => {
|
||||
return addLabels
|
||||
case RuleActionType.Archive:
|
||||
return archivePage
|
||||
case RuleActionType.Delete:
|
||||
return deleteLibraryItem
|
||||
case RuleActionType.MarkAsRead:
|
||||
return markPageAsRead
|
||||
case RuleActionType.SendNotification:
|
||||
|
||||
@ -2135,6 +2135,7 @@ const schema = gql`
|
||||
enum RuleActionType {
|
||||
ADD_LABEL
|
||||
ARCHIVE
|
||||
DELETE
|
||||
MARK_AS_READ
|
||||
SEND_NOTIFICATION
|
||||
}
|
||||
|
||||
@ -11,6 +11,7 @@ export enum RuleActionType {
|
||||
AddLabel = 'ADD_LABEL',
|
||||
Archive = 'ARCHIVE',
|
||||
MarkAsRead = 'MARK_AS_READ',
|
||||
Delete = 'DELETE',
|
||||
SendNotification = 'SEND_NOTIFICATION',
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user