Skip to content
This repository was archived by the owner on Jun 9, 2023. It is now read-only.

Initialize sequelize #120

Merged
merged 13 commits into from
Nov 6, 2019
Merged

Conversation

Zeko369
Copy link
Member

@Zeko369 Zeko369 commented Oct 21, 2019

  • Add psql to docker compose
  • Initialize sequelize and sequlize-ts
  • Create one model, migration and example route for that model

@allella
Copy link
Contributor

allella commented Oct 21, 2019

Pinging @oyewoas on this Sequelize topic since that skill was offered in #11

@oyewoas
Copy link

oyewoas commented Oct 21, 2019

Pinging @oyewoas on this Sequelize topic since that skill was offered in #11

Alright @allella

@allella , I will like to clarify what i am to do, am i meant to work on initializing sequelize with sequelize-ts?? and also please is there a link to the board where tasks have been divided into bits??

Copy link
Contributor

@timmyichen timmyichen left a comment

Choose a reason for hiding this comment

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

Nice start! Had a few comments about the docker setup.

@vaibhavsingh97
Copy link
Member

@Zeko369 Let me know if you stuck somewhere. We can help you, just ping me on discord or any mods. Also, please resolve merge conflict

@kognise kognise mentioned this pull request Oct 25, 2019
7 tasks
@QuincyLarson
Copy link
Contributor

@Zeko369 Thanks again for pushing forward with the sequelize / sequelize-ts integration.

Have you had a chance to make the suggested changes and finish your checklist?

This is now critical path. Please let us know if we can do anything to help.

@vaibhavsingh97
Copy link
Member

@Zeko369 can you please give me push access so that I can help you out, and help you complete the checklist

@timmyichen
Copy link
Contributor

Alternatively since this PR is good on its own it could be merged and follow up PRs could be made

"test": {
"username": "postgres",
"password": "password",
"database": "chapter",
Copy link
Contributor

Choose a reason for hiding this comment

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

We should use a different db for testing, one that we bring up and tear down when testing. Not essential for this pr, just leaving a note

Copy link
Contributor

@timmyichen timmyichen left a comment

Choose a reason for hiding this comment

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

Hooray, thanks! :) One change I would recommend would be to change all table and column names to snake_case (including the fields on the model class) as that's a postgresql best practice. We can use the camelize package to camelize fields before returning them from the API.

@jacobbogers
Copy link

jacobbogers commented Oct 28, 2019

Hi, how can I help out? My skills are mainly on DB and backend of systems.

@timmyichen
Copy link
Contributor

On second thought @Zeko369 any particular reason for the pattern of having initSequelize() generate the sequelize instance vs having it be created and exported as part of the db.ts file since it's synchronous? We'd need to access the sequelize instance in other places e.g. when we want to do transactions

"@types/express": "^4.17.1",
"@types/jest": "^24.0.19",
"@types/morgan": "^1.7.37",
"@types/next": "^8.0.6",
"@types/node": "^12.11.1",
"@types/node": "^12.11.2",
Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't Node 10 being used currently?

image: node:10-alpine

@allella
Copy link
Contributor

allella commented Nov 6, 2019

@timmyichen it looks like @vaibhavsingh97 is still showing as requesting changes. @vaibhavsingh97 can you review and approve if this is ready.

Also, the package-lock.json is showing in conflict.

@Zeko369
Copy link
Member Author

Zeko369 commented Nov 6, 2019

@allella @timmyichen I completely forgot about this PR, I fixes most of the requests, I only have one question. What are we going to do about the seeds?, default sequzelie-cli doesnt work with ts files. I'll try sequelize-cli-typescript. Also the build from master is failing I'll look into it?

@Zeko369
Copy link
Member Author

Zeko369 commented Nov 6, 2019

@nik-john I dont know how you managed to get the CI pass for #158 , because I just merger master and you had a TS bug that stops it from compiling it on the CI.

<StyledComponentsThemeProvider theme={themeObject}>
  <Fragment>
    <CssBaseline />
    <Component {...pageProps} />
  </Fragment>
</StyledComponentsThemeProvider>

you missed the fragment :)

@vaibhavsingh97
Copy link
Member

On second thought @Zeko369 any particular reason for the pattern of having initSequelize() generate the sequelize instance vs having it be created and exported as part of the db.ts file since it's synchronous? We'd need to access the sequelize instance in other places e.g. when we want to do transactions

@Zeko369 what are your thoughts? IMO, we should intitalize the database connection and export the connection to app, so that we can reuse it to query the database.

@vaibhavsingh97 vaibhavsingh97 merged commit 038d860 into freeCodeCamp:master Nov 6, 2019
@allella allella mentioned this pull request Nov 14, 2019
3 tasks
@nik-john
Copy link
Contributor

@all-contributors please add @Zeko369 for code tool

@allcontributors
Copy link
Contributor

@nik-john

I've put up a pull request to add @Zeko369! 🎉

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants