move NotificationOption and ListActivityOption fields into User.ts
This commit is contained in:
parent
4a73d9460d
commit
06277ce868
|
@ -158,28 +158,6 @@ export const FuzzyDate = ({ query, level }: Fields<typeof updateOperation>) => (
|
|||
},
|
||||
})
|
||||
|
||||
export const NotificationOption = (query: ReturnType<typeof updateOperation>[], level: number) => ({
|
||||
withEnabled() {
|
||||
query[0] = query[0].set({ subField: "enabled", level })
|
||||
return this
|
||||
},
|
||||
withType() {
|
||||
query[0] = query[0].set({ subField: "type", level })
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
||||
export const ListActivityOption = (query: ReturnType<typeof updateOperation>[], level: number) => ({
|
||||
withDisabled() {
|
||||
query[0] = query[0].set({ subField: "disabled", level })
|
||||
return this
|
||||
},
|
||||
withType() {
|
||||
query[0] = query[0].set({ subField: "type", level })
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
||||
export const PageInfo = ({ query, level }: Fields<typeof updateOperation>) => ({
|
||||
/** The total number of items. Note: This value is not guaranteed to be accurate, do not rely on this for logic */
|
||||
withTotal() {
|
||||
|
|
|
@ -1,6 +1,27 @@
|
|||
import { ListActivityOption, NotificationOption } from "../anilist.ts"
|
||||
import { Fields, Fn, UpdateOperation } from "../types/Anilist.ts"
|
||||
|
||||
const NotificationOption = ({ query, level }: Fields<UpdateOperation>) => ({
|
||||
withEnabled() {
|
||||
query[0] = query[0].set({ subField: "enabled", level })
|
||||
return this
|
||||
},
|
||||
withType() {
|
||||
query[0] = query[0].set({ subField: "type", level })
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
||||
const ListActivityOption = ({ query, level }: Fields<UpdateOperation>) => ({
|
||||
withDisabled() {
|
||||
query[0] = query[0].set({ subField: "disabled", level })
|
||||
return this
|
||||
},
|
||||
withType() {
|
||||
query[0] = query[0].set({ subField: "type", level })
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
||||
export const UserPreviousName = ({ query, level }: Fields<UpdateOperation>) => ({
|
||||
/** A previous name of the user. */
|
||||
withName() {
|
||||
|
@ -52,7 +73,7 @@ export const UserOptions = ({ query, level }: Fields<UpdateOperation>) => ({
|
|||
if (!fn) query[0] = query[0].set({ subField: "type", level: level + 1 })
|
||||
else {
|
||||
let tmpQuery
|
||||
fn(NotificationOption(tmpQuery = [query[0]], level + 1))
|
||||
fn(NotificationOption({ query: tmpQuery = [query[0]], level: level + 1 }))
|
||||
query[0] = tmpQuery[0]
|
||||
}
|
||||
return this
|
||||
|
@ -94,7 +115,7 @@ export const UserOptions = ({ query, level }: Fields<UpdateOperation>) => ({
|
|||
if (!fn) query[0] = query[0].set({ subField: "type", level: level + 1 })
|
||||
else {
|
||||
let tmpQuery
|
||||
fn(ListActivityOption(tmpQuery = [query[0]], level + 1))
|
||||
fn(ListActivityOption({ query: tmpQuery = [query[0]], level: level + 1 }))
|
||||
query[0] = tmpQuery[0]
|
||||
}
|
||||
return this
|
||||
|
|
Loading…
Reference in New Issue