Merge commit from fork
This commit is contained in:
parent
438dc8c121
commit
500657cb93
@ -1,5 +1,5 @@
|
||||
import { ensureProtocol, removeTracking, stripTrailingSlash } from '@/lib/url'
|
||||
import { decodeCursor, LIMIT, nextCursorEncoded } from '@/lib/cursor'
|
||||
import { decodeCursor, nextCursorEncoded } from '@/lib/cursor'
|
||||
import { getMetadata, metadataRuleSets } from 'page-metadata-parser'
|
||||
import { ruleSet as publicationDateRuleSet } from '@/lib/timedate-scraper'
|
||||
import domino from 'domino'
|
||||
@ -362,7 +362,7 @@ export default {
|
||||
|
||||
return count
|
||||
},
|
||||
items: async (parent, { sub, sort, type, cursor, name, when, from, to, by, limit = LIMIT }, { me, models }) => {
|
||||
items: async (parent, { sub, sort, type, cursor, name, when, from, to, by, limit }, { me, models }) => {
|
||||
const decodedCursor = decodeCursor(cursor)
|
||||
let items, user, pins, subFull, table, ad
|
||||
|
||||
|
@ -24,7 +24,7 @@ function queryParts (q) {
|
||||
|
||||
export default {
|
||||
Query: {
|
||||
related: async (parent, { title, id, cursor, limit = LIMIT, minMatch }, { me, models, search }) => {
|
||||
related: async (parent, { title, id, cursor, limit, minMatch }, { me, models, search }) => {
|
||||
const decodedCursor = decodeCursor(cursor)
|
||||
|
||||
if (!id && (!title || title.trim().split(/\s+/).length < 1)) {
|
||||
|
@ -37,7 +37,7 @@ export async function getSub (parent, { name }, { models, me }) {
|
||||
export default {
|
||||
Query: {
|
||||
sub: getSub,
|
||||
subSuggestions: async (parent, { q, limit = 5 }, { models }) => {
|
||||
subSuggestions: async (parent, { q, limit }, { models }) => {
|
||||
let subs = []
|
||||
subs = await models.$queryRaw`
|
||||
SELECT name
|
||||
@ -88,7 +88,7 @@ export default {
|
||||
|
||||
return latest?.createdAt
|
||||
},
|
||||
topSubs: async (parent, { cursor, when, by, from, to, limit = LIMIT }, { models, me }) => {
|
||||
topSubs: async (parent, { cursor, when, by, from, to, limit }, { models, me }) => {
|
||||
const decodedCursor = decodeCursor(cursor)
|
||||
const range = whenRange(when, from, to || decodeCursor.time)
|
||||
|
||||
@ -120,7 +120,7 @@ export default {
|
||||
subs
|
||||
}
|
||||
},
|
||||
userSubs: async (_parent, { name, cursor, when, by, from, to, limit = LIMIT }, { models, me }) => {
|
||||
userSubs: async (_parent, { name, cursor, when, by, from, to, limit }, { models, me }) => {
|
||||
if (!name) {
|
||||
throw new GqlInputError('must supply user name')
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ async function authMethods (user, args, { models, me }) {
|
||||
}
|
||||
}
|
||||
|
||||
export async function topUsers (parent, { cursor, when, by, from, to, limit = LIMIT }, { models, me }) {
|
||||
export async function topUsers (parent, { cursor, when, by, from, to, limit }, { models, me }) {
|
||||
const decodedCursor = decodeCursor(cursor)
|
||||
const range = whenRange(when, from, to || decodeCursor.time)
|
||||
|
||||
@ -213,7 +213,7 @@ export default {
|
||||
users
|
||||
}
|
||||
},
|
||||
userSuggestions: async (parent, { q, limit = 5 }, { models }) => {
|
||||
userSuggestions: async (parent, { q, limit }, { models }) => {
|
||||
let users = []
|
||||
if (q) {
|
||||
users = await models.$queryRaw`
|
||||
@ -605,7 +605,7 @@ export default {
|
||||
SELECT *
|
||||
FROM users
|
||||
WHERE (id > ${RESERVED_MAX_USER_ID} OR id IN (${USER_ID.anon}, ${USER_ID.delete}))
|
||||
AND SIMILARITY(name, ${q}) > ${Number(similarity) || 0.1} ORDER BY SIMILARITY(name, ${q}) DESC LIMIT ${Number(limit) || 5}`
|
||||
AND SIMILARITY(name, ${q}) > ${Number(similarity) || 0.1} ORDER BY SIMILARITY(name, ${q}) DESC LIMIT ${Number(limit)}`
|
||||
},
|
||||
userStatsActions: async (parent, { when, from, to }, { me, models }) => {
|
||||
const range = whenRange(when, from, to)
|
||||
|
@ -1,12 +1,13 @@
|
||||
import { gql } from 'graphql-tag'
|
||||
import { LIMIT } from '@/lib/cursor'
|
||||
|
||||
export default gql`
|
||||
extend type Query {
|
||||
items(sub: String, sort: String, type: String, cursor: String, name: String, when: String, from: String, to: String, by: String, limit: Limit): Items
|
||||
items(sub: String, sort: String, type: String, cursor: String, name: String, when: String, from: String, to: String, by: String, limit: Limit! = ${LIMIT}): Items
|
||||
item(id: ID!): Item
|
||||
pageTitleAndUnshorted(url: String!): TitleUnshorted
|
||||
dupes(url: String!): [Item!]
|
||||
related(cursor: String, title: String, id: ID, minMatch: String, limit: Limit): Items
|
||||
related(cursor: String, title: String, id: ID, minMatch: String, limit: Limit! = ${LIMIT}): Items
|
||||
search(q: String, sub: String, cursor: String, what: String, sort: String, when: String, from: String, to: String): Items
|
||||
auctionPosition(sub: String, id: ID, boost: Int): Int!
|
||||
boostPosition(sub: String, id: ID, boost: Int): BoostPositions!
|
||||
|
@ -1,14 +1,15 @@
|
||||
import { gql } from 'graphql-tag'
|
||||
import { LIMIT } from '@/lib/cursor'
|
||||
|
||||
export default gql`
|
||||
extend type Query {
|
||||
sub(name: String): Sub
|
||||
subLatestPost(name: String!): String
|
||||
subs: [Sub!]!
|
||||
topSubs(cursor: String, when: String, from: String, to: String, by: String, limit: Limit): Subs
|
||||
userSubs(name: String!, cursor: String, when: String, from: String, to: String, by: String, limit: Limit): Subs
|
||||
topSubs(cursor: String, when: String, from: String, to: String, by: String, limit: Limit! = ${LIMIT}): Subs
|
||||
userSubs(name: String!, cursor: String, when: String, from: String, to: String, by: String, limit: Limit! = ${LIMIT}): Subs
|
||||
mySubscribedSubs(cursor: String): Subs
|
||||
subSuggestions(q: String!, limit: Limit): [Sub!]!
|
||||
subSuggestions(q: String!, limit: Limit! = 5): [Sub!]!
|
||||
}
|
||||
|
||||
type Subs {
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { gql } from 'graphql-tag'
|
||||
import { LIMIT } from '@/lib/cursor'
|
||||
|
||||
export default gql`
|
||||
extend type Query {
|
||||
@ -7,10 +8,10 @@ export default gql`
|
||||
user(id: ID, name: String): User
|
||||
users: [User!]
|
||||
nameAvailable(name: String!): Boolean!
|
||||
topUsers(cursor: String, when: String, from: String, to: String, by: String, limit: Limit): UsersNullable!
|
||||
topUsers(cursor: String, when: String, from: String, to: String, by: String, limit: Limit! = ${LIMIT}): UsersNullable!
|
||||
topCowboys(cursor: String): UsersNullable!
|
||||
searchUsers(q: String!, limit: Limit, similarity: Float): [User!]!
|
||||
userSuggestions(q: String, limit: Limit): [User!]!
|
||||
searchUsers(q: String!, limit: Limit! = 5, similarity: Float): [User!]!
|
||||
userSuggestions(q: String, limit: Limit! = 5): [User!]!
|
||||
hasNewNotes: Boolean!
|
||||
mySubscribedUsers(cursor: String): Users!
|
||||
myMutedUsers(cursor: String): Users!
|
||||
|
Loading…
x
Reference in New Issue
Block a user