Allow changing byline in update api

This commit is contained in:
Hongbo Wu
2022-11-24 16:25:27 +08:00
parent eb345ba393
commit 319c0c4bcd
5 changed files with 6 additions and 8 deletions

View File

@ -2387,6 +2387,7 @@ export enum UpdatePageErrorCode {
}
export type UpdatePageInput = {
byline?: InputMaybe<Scalars['String']>;
description?: InputMaybe<Scalars['String']>;
pageId: Scalars['ID'];
title?: InputMaybe<Scalars['String']>;

View File

@ -1832,6 +1832,7 @@ enum UpdatePageErrorCode {
}
input UpdatePageInput {
byline: String
description: String
pageId: ID!
title: String

View File

@ -1,11 +1,11 @@
import {
MutationUpdatePageArgs,
UpdatePageError,
UpdatePageErrorCode,
UpdatePageSuccess,
MutationUpdatePageArgs,
} from '../../generated/graphql'
import { authorized, userDataToUser } from '../../utils/helpers'
import { updatePage, getPageById } from '../../elastic/pages'
import { getPageById, updatePage } from '../../elastic/pages'
import { Page } from '../../entity/page'
import { Merge } from '../../util'
@ -39,6 +39,7 @@ export const updatePageResolver = authorized<
id: input.pageId,
title: input.title || undefined,
description: input.description || '',
author: input.byline ?? undefined,
}
const updateResult = await updatePage(input.pageId, pageData, { ...ctx, uid })

View File

@ -530,6 +530,7 @@ const schema = gql`
pageId: ID!
title: String
description: String
byline: String
}
type UpdatePageSuccess {

View File

@ -65,8 +65,6 @@ interface BackendEnv {
reminderTaskHanderUrl: string
integrationTaskHandlerUrl: string
textToSpeechTaskHandlerUrl: string
notificationEndpoint: string
verificationToken: string
}
fileUpload: {
gcsUploadBucket: string
@ -154,8 +152,6 @@ const nullableEnvVars = [
'AZURE_SPEECH_KEY',
'AZURE_SPEECH_REGION',
'GCP_LOCATION',
'NOTIFICATION_ENDPOINT',
'PUBSUB_VERIFICATION_TOKEN',
] // Allow some vars to be null/empty
/* If not in GAE and Prod/QA/Demo env (f.e. on localhost/dev env), allow following env vars to be null */
@ -241,8 +237,6 @@ export function getEnv(): BackendEnv {
reminderTaskHanderUrl: parse('REMINDER_TASK_HANDLER_URL'),
integrationTaskHandlerUrl: parse('INTEGRATION_TASK_HANDLER_URL'),
textToSpeechTaskHandlerUrl: parse('TEXT_TO_SPEECH_TASK_HANDLER_URL'),
notificationEndpoint: parse('NOTIFICATION_ENDPOINT'),
verificationToken: parse('PUBSUB_VERIFICATION_TOKEN'),
}
const imageProxy = {
url: parse('IMAGE_PROXY_URL'),