Skip to content

Commit

Permalink
Update Node version and refactor data seeding
Browse files Browse the repository at this point in the history
  • Loading branch information
nicobytes committed Jan 10, 2024
1 parent 3f28e85 commit ef66a9a
Show file tree
Hide file tree
Showing 6 changed files with 470 additions and 30 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 3 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,19 +90,15 @@
"coverageDirectory": "./coverage",
"testEnvironment": "node",
"roots": [
"<rootDir>/src/",
"<rootDir>/libs/"
],
"moduleNameMapper": {
"^@app/data-set(|/.*)$": "<rootDir>/libs/data-set/src/$1"
}
"<rootDir>/src/"
]
},
"config": {
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"
}
},
"engines": {
"node": "18.x"
"node": "20.x"
}
}
2 changes: 1 addition & 1 deletion src/database/entities/product.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export class Product {
category: Category;

@Field(() => [String])
@Transform(({ value }) => (value === '' ? [] : JSON.parse(value)))
@Transform(({ value }) => (value === '' ? [] : value.split(',')))
@Column()
images: string;

Expand Down
27 changes: 27 additions & 0 deletions src/dataset/categories.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
[
{
"id": 1,
"name": "Clothes",
"image": "https://i.imgur.com/QkIa5tT.jpeg"
},
{
"id": 2,
"name": "Electronics",
"image": "https://i.imgur.com/ZANVnHE.jpeg"
},
{
"id": 3,
"name": "Furniture",
"image": "https://i.imgur.com/Qphac99.jpeg"
},
{
"id": 4,
"name": "Shoes",
"image": "https://i.imgur.com/qNOjJje.jpeg"
},
{
"id": 5,
"name": "Miscellaneous",
"image": "https://i.imgur.com/BG8J0Fj.jpg"
}
]
Loading

0 comments on commit ef66a9a

Please sign in to comment.