Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add pdfs mutation + query #69

Merged
merged 4 commits into from
Apr 28, 2021
Merged

add pdfs mutation + query #69

merged 4 commits into from
Apr 28, 2021

Conversation

bnchdrff
Copy link
Member

also, use db users instead of env vars
and simplify auth

also, use db users instead of env vars
and simplify auth
Copy link
Member

@hampelm hampelm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two comments inline, will be back later 2 approve.
Going to mark it as approved in the meantime if you just wanna merge it and continue on with sweet contributions

});

const twoOrgs = await client.request(`
query twoOrgs {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dumb question, is the left align necessary here? makes it a little tough to skim but NBD

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'm very open to changing the indentation for these blocks!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah! I wondered if it was necessary for parsing or a convention for graphql but I'm not familiar. If it's not having it indented I think would help.


expect(res.pdfs.length).toBe(2);
expect(res.pdfs[0].uuid).toEqual(thisUserPdf.uuid);
expect(res.pdfs[1].uuid).toEqual(anotherUserPdf.uuid);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait, does it not randomize the test order?
In general I would expect each test to be self-contained in terms of setup and teardown.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

jest executes the tests within a suite sequentially - jestjs/jest#4386 - the files themselves will be run in a random order though

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I'm so used to rails tests, which randomize order to enforce test isolation and catch random order-of-operations bugs.

Copy link
Member

@hampelm hampelm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lookin good! Thanks for doing this. A couple questions/comments but all good to go from me, nothing blocking.

});

const twoOrgs = await client.request(`
query twoOrgs {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah! I wondered if it was necessary for parsing or a convention for graphql but I'm not familiar. If it's not having it indented I think would help.


expect(res.pdfs.length).toBe(2);
expect(res.pdfs[0].uuid).toEqual(thisUserPdf.uuid);
expect(res.pdfs[1].uuid).toEqual(anotherUserPdf.uuid);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I'm so used to rails tests, which randomize order to enforce test isolation and catch random order-of-operations bugs.

src/auth.ts Outdated
@@ -49,13 +47,16 @@ export const authenticatedOnly = (handler, client: OAuth2Client) => (

export const getTokenFromReq = req => req.headers['x-auth-token'];

export const getUserFromToken = async (tok: string, client: OAuth2Client) => {
export const getUserFromToken = async (
tok: string,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we call it token?


import { getUserFromToken } from '../../auth';

import { ledgerListArgs, MAX_LIMIT } from '../../helpers';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe not for this PR, but is there a way we can escape relative imports? I've done it in the past with CRA, but haven't with regular node -- looks like we may be able to by making the app a "type": "module" in the package.json? [This could be an issue instead of a comment]


const ADMINS = [
{ name: 'Ben', email: 'anonyben@gmail.com' },
{ name: 'Matt', email: 'matthew.hampel@gmail.com' },
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could I be matt@matth.org?
Oh wait if it needs to be gmail, then mahatm@gmail.com

src/server.ts Outdated

if (!organization) throw new Error('missing organization');

const user = input.user
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

QQ, so we can specify a user in the form/input, and then we fall back to the authenticated user?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ooh yeah i think this should change -- we should be able to add a pdf without assigning a user right away.

@bnchdrff bnchdrff temporarily deployed to gnl-graphql-bc-pdfs-wwfo8fhlco April 28, 2021 14:09 Inactive
@bnchdrff bnchdrff temporarily deployed to gnl-graphql-bc-pdfs-wwfo8fhlco April 28, 2021 14:11 Inactive
@bnchdrff bnchdrff merged commit 396aed6 into master Apr 28, 2021
@bnchdrff bnchdrff deleted the bc-pdfs branch April 28, 2021 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants