Skip to content

Commit ab48bdc

Browse files
authored
Merge pull request #1 from JawherKl/feature/1-implement-ecommerce
implementation of project structure code
2 parents 91b79bd + 24bc88a commit ab48bdc

26 files changed

+7747
-0
lines changed

.gitignore

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
lerna-debug.log*
8+
.pnpm-debug.log*
9+
10+
# Diagnostic reports (https://nodejs.org/api/report.html)
11+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
12+
13+
# Runtime data
14+
pids
15+
*.pid
16+
*.seed
17+
*.pid.lock
18+
19+
# Directory for instrumented libs generated by jscoverage/JSCover
20+
lib-cov
21+
22+
# Coverage directory used by tools like istanbul
23+
coverage
24+
*.lcov
25+
26+
# nyc test coverage
27+
.nyc_output
28+
29+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
30+
.grunt
31+
32+
# Bower dependency directory (https://bower.io/)
33+
bower_components
34+
35+
# node-waf configuration
36+
.lock-wscript
37+
38+
# Compiled binary addons (https://nodejs.org/api/addons.html)
39+
build/Release
40+
41+
# Dependency directories
42+
node_modules/
43+
jspm_packages/
44+
45+
# Snowpack dependency directory (https://snowpack.dev/)
46+
web_modules/
47+
48+
# TypeScript cache
49+
*.tsbuildinfo
50+
51+
# Optional npm cache directory
52+
.npm
53+
54+
# Optional eslint cache
55+
.eslintcache
56+
57+
# Optional stylelint cache
58+
.stylelintcache
59+
60+
# Microbundle cache
61+
.rpt2_cache/
62+
.rts2_cache_cjs/
63+
.rts2_cache_es/
64+
.rts2_cache_umd/
65+
66+
# Optional REPL history
67+
.node_repl_history
68+
69+
# Output of 'npm pack'
70+
*.tgz
71+
72+
# Yarn Integrity file
73+
.yarn-integrity
74+
75+
# dotenv environment variable files
76+
.env
77+
.env.development.local
78+
.env.test.local
79+
.env.production.local
80+
.env.local
81+
82+
# parcel-bundler cache (https://parceljs.org/)
83+
.cache
84+
.parcel-cache
85+
86+
# Next.js build output
87+
.next
88+
out
89+
90+
# Nuxt.js build / generate output
91+
.nuxt
92+
dist
93+
94+
# Gatsby files
95+
.cache/
96+
# Comment in the public line in if your project uses Gatsby and not Next.js
97+
# https://nextjs.org/blog/next-9-1#public-directory-support
98+
# public
99+
100+
# vuepress build output
101+
.vuepress/dist
102+
103+
# vuepress v2.x temp and cache directory
104+
.temp
105+
.cache
106+
107+
# Docusaurus cache and generated files
108+
.docusaurus
109+
110+
# Serverless directories
111+
.serverless/
112+
113+
# FuseBox cache
114+
.fusebox/
115+
116+
# DynamoDB Local files
117+
.dynamodb/
118+
119+
# TernJS port file
120+
.tern-port
121+
122+
# Stores VSCode versions used for testing VSCode extensions
123+
.vscode-test
124+
125+
# yarn v2
126+
.yarn/cache
127+
.yarn/unplugged
128+
.yarn/build-state.yml
129+
.yarn/install-state.gz
130+
.pnp.*
131+
.clinic/

Dockerfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FROM node:16
2+
3+
WORKDIR /app
4+
COPY package*.json ./
5+
RUN npm install
6+
COPY . .
7+
CMD ["npm", "run", "dev"]

api-ecom.graphql

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
mutation {
2+
register(name: "ay Doe", email: "[email protected]", password: "aypass", role: "admin") {
3+
user {
4+
id
5+
name
6+
email
7+
role
8+
}
9+
token
10+
}
11+
}
12+
13+
14+
15+
mutation Register($name: String!, $registerEmail2: String!, $registerPassword2: String!, $role: String!) {
16+
register(name: $name, email: $registerEmail2, password: $registerPassword2, role: $role) {
17+
user {
18+
id
19+
name
20+
email
21+
role
22+
}
23+
token
24+
}
25+
}
26+
27+
mutation Login($email: String!, $password: String!) {
28+
login(email: $email, password: $password) {
29+
user {
30+
id
31+
name
32+
email
33+
}
34+
token
35+
}
36+
}
37+
38+
mutation {
39+
createProduct(name: "Tablet", description: "lenovo tablet 2021", price: 219.99) {
40+
id
41+
name
42+
price
43+
}
44+
}
45+
46+
query GetProducts {
47+
getProducts {
48+
id
49+
name
50+
price
51+
}
52+
}
53+
54+
query {
55+
getProductById(id: "676156119043a8975426aaed") {
56+
name
57+
}
58+
}
59+
60+
mutation {
61+
updateProduct(id: "676156119043a8975426aaed", name: "Laptop PC", description: "Lenovo laptop omen 16", price: 2119.99) {
62+
id
63+
name
64+
price
65+
}
66+
}
67+
68+
mutation DeleteProduct($deleteProductId: ID!) {
69+
deleteProduct(id: $deleteProductId) {
70+
name
71+
}
72+
}
73+
74+
75+
76+
mutation {
77+
createOrder(
78+
products: [
79+
{ productId: "676156089043a8975426aaeb", quantity: 2 },
80+
{ productId: "676156119043a8975426aaed", quantity: 1 }
81+
],
82+
totalAmount: 7339.98
83+
) {
84+
id
85+
totalAmount
86+
status
87+
products {
88+
product {
89+
id
90+
name
91+
}
92+
quantity
93+
}
94+
}
95+
}
96+
97+
mutation {
98+
updateOrderStatus(id: "6761576c9043a8975426aafc", status: "Shipped") {
99+
id
100+
status
101+
}
102+
}
103+
104+
query {
105+
getOrderById(id: "6761576c9043a8975426aafc") {
106+
id
107+
totalAmount
108+
status
109+
products {
110+
product {
111+
id
112+
name
113+
price
114+
}
115+
quantity
116+
}
117+
}
118+
}
119+
120+
mutation {
121+
deleteOrder(id: "67603c1a51c9b63ef70f4ef5")
122+
}
123+
124+
mutation {
125+
createReview(productId: "676156089043a8975426aaeb", rating: 5, comment: "Great product!") {
126+
id
127+
rating
128+
comment
129+
createdAt
130+
}
131+
}

docker-compose.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
version: '3.8'
2+
services:
3+
mongodb:
4+
image: mongo:latest
5+
container_name: mongodb
6+
ports:
7+
- "27017:27017"
8+
volumes:
9+
- mongo-data:/data/db
10+
restart: always
11+
12+
#graphql:
13+
# build: .
14+
# ports:
15+
# - "4000:4000"
16+
# depends_on:
17+
# - mongodb
18+
# command: sh -c "npm run start"
19+
20+
volumes:
21+
mongo-data:

jest.config.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module.exports = {
2+
testEnvironment: 'node',
3+
verbose: true,
4+
testTimeout: 30000, // Timeout for long-running tests
5+
};
6+

0 commit comments

Comments
 (0)