downloads by user id (#2500)

This commit is contained in:
Tessa Thornton
2019-08-23 16:05:53 -04:00
committed by Kim Gardner
parent ffecd5e981
commit 0e37a474fa
7 changed files with 158 additions and 3 deletions
@@ -11,6 +11,7 @@ import {
removeIgnore,
removeSuspension,
requestCommentsDownload,
requestUserCommentsDownload,
setEmail,
setPassword,
setUsername,
@@ -35,6 +36,7 @@ import {
GQLRemoveUserIgnoreInput,
GQLRemoveUserSuspensionInput,
GQLRequestCommentsDownloadInput,
GQLRequestUserCommentsDownloadInput,
GQLSetEmailInput,
GQLSetPasswordInput,
GQLSetUsernameInput,
@@ -187,6 +189,17 @@ export const Users = (ctx: TenantContext) => ({
ignore(ctx.mongo, ctx.tenant, ctx.user!, input.userID, ctx.now),
removeIgnore: async (input: GQLRemoveUserIgnoreInput) =>
removeIgnore(ctx.mongo, ctx.tenant, ctx.user!, input.userID),
requestUserCommentsDownload: async (
input: GQLRequestUserCommentsDownloadInput
) =>
requestUserCommentsDownload(
ctx.mongo,
ctx.tenant,
ctx.config,
ctx.signingConfig!,
input.userID,
ctx.now
),
requestCommentsDownload: async (input: GQLRequestCommentsDownloadInput) =>
requestCommentsDownload(
ctx.mongo,
@@ -189,4 +189,8 @@ export const Mutation: Required<GQLMutationTypeResolver<void>> = {
user: await ctx.mutators.Users.requestCommentsDownload(input),
clientMutationId: input.clientMutationId,
}),
requestUserCommentsDownload: async (sourc, { input }, ctx) => ({
archiveURL: await ctx.mutators.Users.requestUserCommentsDownload(input),
clientMutationId: input.clientMutationId,
}),
};
@@ -4579,6 +4579,33 @@ type RequestCommentsDownloadPayload {
clientMutationId: String!
}
#########################
# requestUserCommentsDownload
#########################
input RequestUserCommentsDownloadInput {
"""
userID specifies user to download comments for
"""
userID: String!
"""
clientMutationId is required for Relay support.
"""
clientMutationId: String!
}
type RequestUserCommentsDownloadPayload {
"""
clientMutationId is required for Relay support.
"""
clientMutationId: String!
"""
archiveURL is the archive url
"""
archiveURL: String!
}
##################
## Mutation
##################
@@ -4862,6 +4889,13 @@ type Mutation {
requestCommentsDownload(
input: RequestCommentsDownloadInput!
): RequestCommentsDownloadPayload! @auth(permit: [SUSPENDED, BANNED])
"""
requestUserCommentsDownload allows a user to request to download their comments.
"""
requestUserCommentsDownload(
input: RequestUserCommentsDownloadInput!
): RequestUserCommentsDownloadPayload! @auth(roles: [ADMIN])
}
##################