From 19a371a96661c353694afa9aa7c38e707fab72e6 Mon Sep 17 00:00:00 2001 From: Brianna Cerkiewicz Date: Thu, 7 Sep 2023 15:51:26 -0700 Subject: [PATCH] chore: cleanup --- app/lib/relay/server.ts | 7 -- app/server/index.ts | 4 - .../middleware/attachmentDeleteRouter.ts | 112 +----------------- app/server/middleware/graphql/index.ts | 3 - app/server/middleware/session.ts | 3 - 5 files changed, 1 insertion(+), 128 deletions(-) diff --git a/app/lib/relay/server.ts b/app/lib/relay/server.ts index 2e68d1647a..f2f89e31b6 100644 --- a/app/lib/relay/server.ts +++ b/app/lib/relay/server.ts @@ -8,13 +8,6 @@ const { } = getConfig(); export function createServerNetwork({ cookieHeader }) { - console.log("--------------------"); - console.log("$$$$$$$$cookieHeader", cookieHeader); - // console.log("getCookie", getCookie("qwerty")); - // console.log("getConfig()", getConfig()); - console.log("spliting", cookieHeader.split("; ")[1].replace("qwerty=", "")); - console.log("--------------------"); - // console.log("SESSION_SECRET", SESSION_SECRET); return Network.create(async (params, variables) => { const response = await fetch(`http://localhost:${PORT}/graphql`, { method: "POST", diff --git a/app/server/index.ts b/app/server/index.ts index 2dda2bb6ba..8905ba152e 100644 --- a/app/server/index.ts +++ b/app/server/index.ts @@ -75,10 +75,6 @@ app.prepare().then(async () => { server.use(attachmentDownloadRouter); server.get("*", async (req, res) => { - // console.log("$$$$$$$$$$$$$$$$$$$$$$res.locals._csrf", res.locals._csrf); - // res.cookie("CSRF-TOKEN", res.locals._csrf); - // console.log("res&&&&", res); - return handle(req, res); }); diff --git a/app/server/middleware/attachmentDeleteRouter.ts b/app/server/middleware/attachmentDeleteRouter.ts index 13601436d2..2ad3f54d85 100644 --- a/app/server/middleware/attachmentDeleteRouter.ts +++ b/app/server/middleware/attachmentDeleteRouter.ts @@ -5,7 +5,6 @@ import config from "../../config"; // export const brianna = (req, res, next) => { export const attachmentDeleteRouter = Router(); -console.log("attachmentDeleteRouter", attachmentDeleteRouter); const attachmentDetailsQuery = `query AttachmentDetailsQuery($attachmentId: ID!){ attachment(id: $attachmentId) { @@ -33,8 +32,6 @@ const deleteAttachmentMutation = `mutation deleteAttachmentMutation($input: Dele } `; const handleDelete = async (req, res, next) => { - console.log("************im in handle delete"); - console.log("req.header", req.header); try { const attachmentQueryVariables = { attachmentId: req.params.attachmentId, @@ -44,7 +41,7 @@ const handleDelete = async (req, res, next) => { attachmentQueryVariables, req ); - console.log("queryResponse", queryResponse); + const { data: { attachment: { file, id }, @@ -77,116 +74,9 @@ const handleDelete = async (req, res, next) => { const response = await storageClient.bucket(bucketName).file(file).delete(); - // res.setHeader("X-CSRF-Token", document.cookie); - console.log("!!!!!!!!!!!response[0].statusCode", response[0].statusCode); return res.sendStatus(response[0].statusCode); } catch (error) { next(error); } }; attachmentDeleteRouter.delete("/delete/:attachmentId", handleDelete); - -// attachmentDeleteRouter.delete( -// "/delete/:attachmentId", -// () => -// // { -// // console.log("*********about to handle delete"); -// // handleDelete(req, res, next); -// // } -// handleDelete -// ); -// next(); -// }; - -// export const brianna = (req, res, next) => { -// const attachmentDeleteRouter = Router(); -// console.log("attachmentDeleteRouter", attachmentDeleteRouter); - -// const attachmentDetailsQuery = `query AttachmentDetailsQuery($attachmentId: ID!){ -// attachment(id: $attachmentId) { -// file -// id -// } -// }`; - -// const discardProjectAttachmentFormChangeMutation = `mutation discardProjectAttachmentFormChangeMutation( -// $input: DiscardProjectAttachmentFormChangeInput! -// ) { -// discardProjectAttachmentFormChange(input: $input) { -// formChange { -// id -// } -// } -// }`; - -// const deleteAttachmentMutation = `mutation deleteAttachmentMutation($input: DeleteAttachmentInput!) { -// deleteAttachment(input:$input){ -// attachment { -// id -// } -// } -// } -// `; -// const handleDelete = async (req, res, next) => { -// console.log("************"); -// console.log("req.header", req.header); -// try { -// const attachmentQueryVariables = { -// attachmentId: req.params.attachmentId, -// }; -// const queryResponse = await performQuery( -// attachmentDetailsQuery, -// attachmentQueryVariables, -// req -// ); - -// const { -// data: { -// attachment: { file, id }, -// }, -// } = queryResponse; -// // delete the form_change related to the attachment -// const attachmentFormChangeResponse = await performQuery( -// discardProjectAttachmentFormChangeMutation, -// req.body.variables, -// req -// ); - -// // delete the attachment from the attachment table -// const deleteAttachmentResponse = await performQuery( -// deleteAttachmentMutation, -// { input: { id } }, -// req -// ); - -// if ( -// queryResponse.errors || -// attachmentFormChangeResponse.errors || -// deleteAttachmentResponse.errors -// ) { -// throw new Error(`Failed to delete attachment`); -// } - -// const storageClient = new Storage(); -// const bucketName = config.get("attachmentsBucket"); - -// const response = await storageClient -// .bucket(bucketName) -// .file(file) -// .delete(); - -// // res.setHeader("X-CSRF-Token", document.cookie); -// return res.sendStatus(response[0].statusCode); -// } catch (error) { -// next(error); -// } -// }; -// console.log("res.get", res.get("_csrf")); -// console.log("res.getX-CSRF-Token", res.get("X-CSRF-Token")); -// console.log("req.cookie", req.cookies); -// console.log("req.headers", req.headers); -// attachmentDeleteRouter.delete("/delete/:attachmentId", () => { -// console.log("*******************in "); -// return handleDelete(req, res, next); -// }); -// }; diff --git a/app/server/middleware/graphql/index.ts b/app/server/middleware/graphql/index.ts index f06d0de14d..8205ec5455 100644 --- a/app/server/middleware/graphql/index.ts +++ b/app/server/middleware/graphql/index.ts @@ -124,9 +124,6 @@ export async function performQuery(query, variables, request: Request) { pgSettings: settings, }, async (context) => { - console.log("**************"); - console.log("context", context); - console.log("**************"); // Execute your GraphQL query in this function with the provided // `context` object, which should NOT be used outside of this // function. diff --git a/app/server/middleware/session.ts b/app/server/middleware/session.ts index cc13d3413d..16a6b9185d 100644 --- a/app/server/middleware/session.ts +++ b/app/server/middleware/session.ts @@ -7,9 +7,6 @@ const PgSession = connectPgSimple(expressSession); // True if the host has been configured to use https const secure = /^https/.test(config.get("host")); const secret = config.get("sessionSecret"); -console.log("************"); -console.log("secret", secret); -console.log("************"); const session = () => { const store = new PgSession({