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

ORM Models for Inventory #16

Merged
merged 47 commits into from
Aug 13, 2023
Merged
Show file tree
Hide file tree
Changes from 40 commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
2b9a0f7
feat(api): merge all SQL files into one and fix errors
lemilonkh Jul 28, 2023
2913843
feat(api): generate TypeScript model files for all tables
lemilonkh Jul 28, 2023
fea0c7c
fix(api): use initModels in models/index.ts
lemilonkh Jul 28, 2023
a668ee2
fix(api): remove models folder and index.js generated by sequelize
lemilonkh Jul 28, 2023
d2432f5
feat(api): create .sequelizerc that configures folder paths
lemilonkh Jul 28, 2023
dfe4d49
chore(api): install sequelize-auto as a dev dependency
lemilonkh Jul 28, 2023
c3ac993
feat(api): remove previous SQL files from repository (merged into db.…
lemilonkh Jul 28, 2023
0675849
feat(api): create initial migration
lemilonkh Jul 28, 2023
dd274ca
fix(api): adjust default sequelize config to connect to postgres
lemilonkh Jul 31, 2023
570e833
Assume citycatalyst database already exists in first migration
lemilonkh Jul 31, 2023
ffcef87
feat(api): enable query logging in dev environment
lemilonkh Jul 31, 2023
3f70656
fix(migration): fix initial migration and reverting it
lemilonkh Jul 31, 2023
51471ac
Add helper SQL file to remove and recreate schema
lemilonkh Jul 31, 2023
e02484d
refactor(api): change v1 to v0 for API versioning
lemilonkh Jul 31, 2023
f33759b
fix(api): errors with next/config and when trying to use sequelize wi…
lemilonkh Jul 31, 2023
ff0edc5
fix(api): remove unused serverRuntimeConfig from next.config.js
lemilonkh Jul 31, 2023
c8dc609
feat(api): create npm script db:migrate:undo
lemilonkh Jul 31, 2023
545e058
chore(api): install @types/pg
lemilonkh Jul 31, 2023
539dd59
Merge branch 'main' of github.com:Open-Earth-Foundation/CityCatalyst …
lemilonkh Jul 31, 2023
cad1bea
fix(api): types in first migration
lemilonkh Jul 31, 2023
25a5181
feat(api): reimport SQL table definitions
lemilonkh Aug 1, 2023
2947dab
feat(api): add updated models for all new tables
lemilonkh Aug 1, 2023
3c9af2e
fix(api): add locode field to City table and regenerate model
lemilonkh Aug 1, 2023
20587b5
feat(api): add sequelize auto generation command as script
lemilonkh Aug 1, 2023
1b35956
fix(api): TypeScript related errors in migration
lemilonkh Aug 1, 2023
534dc1c
fix(api): use a js file for migrations again
lemilonkh Aug 1, 2023
51a003b
fix(api): generate models using camelCase properties
lemilonkh Aug 1, 2023
67630b1
fix(api): remove SequelizeMeta model (only required for migrations)
lemilonkh Aug 1, 2023
7c6d996
fix(api): update sequelize-auto.sh script to use camelCase props
lemilonkh Aug 1, 2023
f8183db
Merge branch 'develop' of github.com:Open-Earth-Foundation/CityCataly…
lemilonkh Aug 1, 2023
a86a5fe
fix(api): change sequelize-auto command to use timestamp fields properly
lemilonkh Aug 1, 2023
2c27eb2
fix(schema): add created and last_updated fields to Version
lemilonkh Aug 1, 2023
72018d1
fix(api): ignore SequelizeMeta table for model generation
lemilonkh Aug 1, 2023
decfa51
feat(api): regenerate models with new settings
lemilonkh Aug 1, 2023
c577aa0
feat(api): setup Node test runner using tsx and glob
lemilonkh Aug 2, 2023
44123d2
feat(api): add red tests for model property uniqueness
lemilonkh Aug 2, 2023
d7aacbd
refactor(api): remove unused config object from model index.js
lemilonkh Aug 2, 2023
b6f02e0
fix(api): make tests work correctly using assert.rejects
lemilonkh Aug 2, 2023
62c3243
refactor(api): remove nested awaits in test
lemilonkh Aug 2, 2023
bc6017a
fix(api): make sure user emails are unique
lemilonkh Aug 2, 2023
6f27053
feat(api): create CRUD routes for city
lemilonkh Aug 10, 2023
b0766e7
fix(api): remove log statement
lemilonkh Aug 10, 2023
01d92cc
fix(api): disable type: module and fix wrong package version
lemilonkh Aug 10, 2023
b7a5ff8
feat(api): handle unique constraint errors in global API error handler
lemilonkh Aug 11, 2023
b9db345
feat(api): implement inventory CRUD routes
lemilonkh Aug 11, 2023
c039abb
fix(api): don't overwrite cityId when updating and parse body first
lemilonkh Aug 11, 2023
a98257a
fix(test): only delete entries created in tests, don't use real locode
lemilonkh Aug 11, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions app/.sequelizerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const path = require('path');

module.exports = {
'config': path.resolve('config', 'config.json'),
'models-path': path.resolve('src', 'models'),
'seeders-path': path.resolve('seeders'),
'migrations-path': path.resolve('migrations'),
};

15 changes: 8 additions & 7 deletions app/config/config.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
{
"development": {
"username": "root",
"username": "citycatalyst",
"password": null,
"database": "database_development",
"database": "citycatalyst",
"host": "127.0.0.1",
"dialect": "mysql"
"dialect": "postgres",
"logging": true
},
"test": {
"username": "root",
"password": null,
"database": "database_test",
"database": "citycatalyst_test",
"host": "127.0.0.1",
"dialect": "mysql"
"dialect": "postgres"
},
"production": {
"username": "root",
"password": null,
"database": "database_production",
"database": "citycatalyst_prod",
"host": "127.0.0.1",
"dialect": "mysql"
"dialect": "postgres"
}
}
Loading