mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
Simplify function input
This commit is contained in:
parent
1898e32607
commit
89537c13de
2 changed files with 18 additions and 3 deletions
|
|
@ -617,7 +617,6 @@ const processSubscription = async (
|
|||
|
||||
// update subscription lastFetchedAt
|
||||
const updatedSubscription = await updateSubscription(userId, subscriptionId, {
|
||||
id: subscriptionId,
|
||||
lastFetchedAt: lastItemFetchedAt,
|
||||
lastFetchedChecksum: updatedLastFetchedChecksum,
|
||||
scheduledAt: new Date(nextScheduledAt),
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
import { Subscription } from '../entity/subscription'
|
||||
import { UpdateSubscriptionInput } from '../generated/graphql'
|
||||
import {
|
||||
SubscriptionStatus,
|
||||
UpdateSubscriptionInput,
|
||||
} from '../generated/graphql'
|
||||
import { getRepository } from '../repository'
|
||||
|
||||
const ensureOwns = async (userId: string, subscriptionId: string) => {
|
||||
|
|
@ -14,10 +17,23 @@ const ensureOwns = async (userId: string, subscriptionId: string) => {
|
|||
}
|
||||
}
|
||||
|
||||
type UpdateSubscriptionData = {
|
||||
autoAddToLibrary?: boolean | null
|
||||
description?: string | null
|
||||
fetchContent?: boolean | null
|
||||
folder?: string | null
|
||||
isPrivate?: boolean | null
|
||||
lastFetchedAt?: Date | null
|
||||
lastFetchedChecksum?: string | null
|
||||
name?: string | null
|
||||
scheduledAt?: Date | null
|
||||
status?: SubscriptionStatus | null
|
||||
}
|
||||
|
||||
export const updateSubscription = async (
|
||||
userId: string,
|
||||
subscriptionId: string,
|
||||
newData: UpdateSubscriptionInput
|
||||
newData: UpdateSubscriptionData
|
||||
): Promise<Subscription> => {
|
||||
ensureOwns(userId, subscriptionId)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue