fix: date filter in bulk action api

This commit is contained in:
Hongbo Wu 2023-10-23 19:34:41 +08:00
parent 27b352f9ae
commit 0c60706503
2 changed files with 6 additions and 8 deletions

View file

@ -1,6 +1,7 @@
import { Readability } from '@omnivore/readability'
import { DeepPartial } from 'typeorm'
import { QueryDeepPartialEntity } from 'typeorm/query-builder/QueryPartialEntity'
import { Highlight } from '../entity/highlight'
import { LibraryItem, LibraryItemState } from '../entity/library_item'
import { User } from '../entity/user'
import { homePageURL } from '../env'
@ -166,12 +167,9 @@ export const savePage = async (
}
if (parseResult.highlightData) {
const highlight = {
updatedAt: new Date(),
createdAt: new Date(),
userId: user.id,
const highlight: DeepPartial<Highlight> = {
...parseResult.highlightData,
type: HighlightType.Highlight,
user: { id: user.id },
}
if (!(await createHighlight(highlight, clientRequestId, user.id))) {

View file

@ -249,13 +249,13 @@ const parseDateFilter = (
switch (field.toUpperCase()) {
case 'PUBLISHED':
field = 'publishedAt'
field = 'published_at'
break
case 'SAVED':
field = 'savedAt'
field = 'saved_at'
break
case 'UPDATED':
field = 'updatedAt'
field = 'updated_at'
}
return {