remove argument directive
This commit is contained in:
@ -4,7 +4,7 @@ schema {
|
||||
subscription: SubscriptionRootType
|
||||
}
|
||||
|
||||
directive @sanitize(allowedTags: [String], maxLength: Int, minLength: Int, pattern: String) on ARGUMENT_DEFINITION | INPUT_FIELD_DEFINITION
|
||||
directive @sanitize(allowedTags: [String], maxLength: Int, minLength: Int, pattern: String) on INPUT_FIELD_DEFINITION
|
||||
|
||||
type AddDiscoverFeedError {
|
||||
errorCodes: [AddDiscoverFeedErrorCode!]!
|
||||
|
||||
@ -30,7 +30,6 @@ import {
|
||||
SubscribeError,
|
||||
SubscribeErrorCode,
|
||||
SubscribeSuccess,
|
||||
Subscription as SubscriptionReturnType,
|
||||
SubscriptionError,
|
||||
SubscriptionsError,
|
||||
SubscriptionsErrorCode,
|
||||
@ -500,6 +499,14 @@ export const subscriptionResolver = authorized<
|
||||
SubscriptionError,
|
||||
QuerySubscriptionArgs
|
||||
>(async (_, { id }, { uid, log }) => {
|
||||
if (!id) {
|
||||
log.error('Missing subscription id')
|
||||
|
||||
return {
|
||||
errorCodes: [ErrorCode.BadRequest],
|
||||
}
|
||||
}
|
||||
|
||||
const subscription = await findSubscriptionById(uid, id)
|
||||
if (!subscription) {
|
||||
log.error('Subscription not found', { id })
|
||||
|
||||
@ -14,7 +14,7 @@ export class SanitizedString extends GraphQLScalarType {
|
||||
) {
|
||||
super({
|
||||
// Names must match /^[_a-zA-Z][_a-zA-Z0-9]*$/ as per graphql-js
|
||||
name: `SanitizedString_${allowedTags}_${maxLength}_${pattern}`.replace(
|
||||
name: `SanitizedString_${allowedTags}_${maxLength}_${minLength}_${pattern}`.replace(
|
||||
/\W/g,
|
||||
''
|
||||
),
|
||||
|
||||
@ -11,7 +11,7 @@ const schema = gql`
|
||||
maxLength: Int
|
||||
minLength: Int
|
||||
pattern: String
|
||||
) on INPUT_FIELD_DEFINITION | ARGUMENT_DEFINITION
|
||||
) on INPUT_FIELD_DEFINITION
|
||||
|
||||
# default error code
|
||||
enum ErrorCode {
|
||||
@ -3385,7 +3385,7 @@ const schema = gql`
|
||||
discoverFeeds: DiscoverFeedResult!
|
||||
scanFeeds(input: ScanFeedsInput!): ScanFeedsResult!
|
||||
home(first: Int, after: String): HomeResult!
|
||||
subscription(id: ID! @sanitize(minLength: 1)): SubscriptionResult!
|
||||
subscription(id: ID!): SubscriptionResult!
|
||||
}
|
||||
|
||||
schema {
|
||||
|
||||
Reference in New Issue
Block a user