Exposed comment and meta fields in GraphQL API.
This commit is contained in:
@@ -35,6 +35,8 @@ export const alertsSchema = `
|
||||
notify: Boolean = true
|
||||
email: Boolean = false
|
||||
stashes: [Int!]
|
||||
comment: String
|
||||
meta: JSON
|
||||
): Alert
|
||||
|
||||
removeAlert(id: Int!): Alert
|
||||
@@ -114,6 +116,8 @@ export const alertsSchema = `
|
||||
entities: [AlertEntity]
|
||||
matches: [AlertMatch]
|
||||
stashes: [AlertStash]
|
||||
comment: String
|
||||
meta: JSON
|
||||
}
|
||||
|
||||
type Notifications {
|
||||
|
||||
@@ -7,6 +7,11 @@ import {
|
||||
GraphQLScalarType,
|
||||
} from 'graphql';
|
||||
|
||||
import {
|
||||
JSONDefinition,
|
||||
JSONResolver,
|
||||
} from 'graphql-scalars';
|
||||
|
||||
import {
|
||||
scenesSchema,
|
||||
fetchScenesGraphql,
|
||||
@@ -69,6 +74,8 @@ const schema = buildSchema(`
|
||||
|
||||
scalar Date
|
||||
|
||||
${JSONDefinition}
|
||||
|
||||
${scenesSchema}
|
||||
${moviesSchema}
|
||||
${actorsSchema}
|
||||
@@ -118,6 +125,7 @@ export async function graphqlApi(req, res) {
|
||||
resolvers: {
|
||||
DateTimeScalar,
|
||||
DateScalar,
|
||||
JSON: JSONResolver,
|
||||
},
|
||||
rootValue: {
|
||||
// queries
|
||||
|
||||
@@ -28,12 +28,16 @@ export const stashesSchema = `
|
||||
createStash(
|
||||
name: String!
|
||||
isPublic: Boolean
|
||||
comment: String
|
||||
meta: JSON
|
||||
): Stash
|
||||
|
||||
updateStash(
|
||||
stash: String!
|
||||
name: String
|
||||
isPublic: Boolean
|
||||
comment: String
|
||||
meta: JSON
|
||||
): Stash
|
||||
|
||||
removeStash(
|
||||
@@ -78,6 +82,8 @@ export const stashesSchema = `
|
||||
isPublic: Boolean
|
||||
isPrimary: Boolean
|
||||
createdAt: Date
|
||||
comment: String
|
||||
meta: JSON
|
||||
}
|
||||
|
||||
type Stashed {
|
||||
@@ -98,13 +104,13 @@ export async function fetchUserStashesApi(req, res) {
|
||||
}
|
||||
|
||||
export async function fetchUserStashesGraphql(query, req) {
|
||||
const stashes = await fetchUserStashes(query.username || req.userId, req.user);
|
||||
const stashes = await fetchUserStashes(query.username || req.user.id, req.user);
|
||||
|
||||
return stashes;
|
||||
}
|
||||
|
||||
export async function fetchStashGraphql(query, req) {
|
||||
const stashes = await fetchStashByUsernameAndSlug(query.username || req.userId, query.stash, req.user);
|
||||
const stashes = await fetchStashByUsernameAndSlug(query.username || req.user.id, query.stash, req.user);
|
||||
|
||||
return stashes;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user