Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mortezavifar
ShopServer
Commits
0249899c
Commit
0249899c
authored
Aug 16, 2021
by
abbasmortezavifar
Browse files
JwtStrategy requires a secret or key
parents
Pipeline
#368
failed with stages
Changes
74
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/products/product-category/porduct-category.controller.ts
0 → 100644
View file @
0249899c
import
{
Controller
}
from
'
@nestjs/common
'
;
@
Controller
(
'
porduct-category
'
)
export
class
PorductCategoryController
{}
src/products/product-category/porduct-category.module.ts
0 → 100644
View file @
0249899c
import
{
ProductCategoryRepository
}
from
'
./product-category.repository
'
;
import
{
Module
}
from
'
@nestjs/common
'
;
import
{
PorductCategoryService
}
from
'
./porduct-category.service
'
;
import
{
PorductCategoryController
}
from
'
./porduct-category.controller
'
;
import
{
TypeOrmModule
}
from
'
@nestjs/typeorm
'
;
@
Module
({
providers
:
[
PorductCategoryService
],
controllers
:
[
PorductCategoryController
],
imports
:[
TypeOrmModule
.
forFeature
([
ProductCategoryRepository
])]
})
export
class
PorductCategoryModule
{}
src/products/product-category/porduct-category.service.ts
0 → 100644
View file @
0249899c
import
{
Injectable
}
from
'
@nestjs/common
'
;
@
Injectable
()
export
class
PorductCategoryService
{}
src/products/product-category/product-category.entity.ts
0 → 100644
View file @
0249899c
import
{
BaceEntity
}
from
'
./../../bace.entity
'
;
import
{
Column
,
Entity
}
from
"
typeorm
"
;
@
Entity
()
export
class
ProductCateGory
extends
BaceEntity
{
@
Column
()
title
:
string
;
@
Column
()
parentid
:
string
}
\ No newline at end of file
src/products/product-category/product-category.repository.ts
0 → 100644
View file @
0249899c
import
{
ProductCateGory
}
from
'
./product-category.entity
'
;
import
{
EntityRepository
,
Repository
}
from
"
typeorm
"
;
@
EntityRepository
(
ProductCateGory
)
export
class
ProductCategoryRepository
extends
Repository
<
ProductCateGory
>
{
}
\ No newline at end of file
src/products/product-gallery/product-gallery.controller.ts
0 → 100644
View file @
0249899c
import
{
Controller
}
from
'
@nestjs/common
'
;
@
Controller
(
'
porduct-gallery
'
)
export
class
ProductGalleryController
{}
src/products/product-gallery/product-gallery.entity.ts
0 → 100644
View file @
0249899c
import
{
Product
}
from
'
./../product/product.entity
'
;
import
{
BaceEntity
}
from
'
./../../bace.entity
'
;
import
{
Column
,
Entity
,
ManyToOne
}
from
"
typeorm
"
;
@
Entity
()
export
class
ProductGallery
extends
BaceEntity
{
@
Column
()
imagename
:
string
@
ManyToOne
(()
=>
Product
,
product
=>
product
.
images
)
product
:
Product
;
}
\ No newline at end of file
src/products/product-gallery/product-gallery.module.ts
0 → 100644
View file @
0249899c
import
{
ProductGalleryRepository
}
from
'
./product-gallery.repository
'
;
import
{
Module
}
from
'
@nestjs/common
'
;
import
{
ProductGalleryService
}
from
'
./product-gallery.service
'
;
import
{
ProductGalleryController
}
from
'
./product-gallery.controller
'
;
import
{
TypeOrmModule
}
from
'
@nestjs/typeorm
'
;
@
Module
({
providers
:
[
ProductGalleryService
],
controllers
:
[
ProductGalleryController
],
imports
:[
TypeOrmModule
.
forFeature
([
ProductGalleryRepository
])]
})
export
class
PorductGalleryModule
{}
src/products/product-gallery/product-gallery.repository.ts
0 → 100644
View file @
0249899c
import
{
ProductGallery
}
from
'
./product-gallery.entity
'
;
import
{
Repository
}
from
'
typeorm
'
;
import
{
EntityRepository
}
from
'
typeorm
'
;
@
EntityRepository
(
ProductGallery
)
export
class
ProductGalleryRepository
extends
Repository
<
ProductGallery
>
{
}
\ No newline at end of file
src/products/product-gallery/product-gallery.service.ts
0 → 100644
View file @
0249899c
import
{
Injectable
}
from
'
@nestjs/common
'
;
@
Injectable
()
export
class
ProductGalleryService
{}
src/products/product-visit/porduct-visit.controller.ts
0 → 100644
View file @
0249899c
import
{
Controller
}
from
'
@nestjs/common
'
;
@
Controller
(
'
porduct-visit
'
)
export
class
PorductVisitController
{}
src/products/product-visit/porduct-visit.module.ts
0 → 100644
View file @
0249899c
import
{
ProductVisitRepository
}
from
'
./product-visit.repository
'
;
import
{
Module
}
from
'
@nestjs/common
'
;
import
{
TypeOrmModule
}
from
'
@nestjs/typeorm
'
;
import
{
PorductVisitController
}
from
'
./porduct-visit.controller
'
;
import
{
PorductVisitService
}
from
'
./porduct-visit.service
'
;
@
Module
({
controllers
:
[
PorductVisitController
],
providers
:
[
PorductVisitService
],
imports
:[
TypeOrmModule
.
forFeature
([
ProductVisitRepository
])]
})
export
class
PorductVisitModule
{}
src/products/product-visit/porduct-visit.service.ts
0 → 100644
View file @
0249899c
import
{
Injectable
}
from
'
@nestjs/common
'
;
@
Injectable
()
export
class
PorductVisitService
{}
src/products/product-visit/product-visit.entity.ts
0 → 100644
View file @
0249899c
import
{
BaceEntity
}
from
'
./../../bace.entity
'
;
import
{
Column
,
Entity
,
ManyToOne
}
from
"
typeorm
"
;
import
{
Product
}
from
'
../product/product.entity
'
;
@
Entity
()
export
class
ProductVisit
extends
BaceEntity
{
@
Column
()
userip
:
string
@
ManyToOne
(()
=>
Product
,
product
=>
product
.
visits
)
product
:
Product
;
}
\ No newline at end of file
src/products/product-visit/product-visit.repository.ts
0 → 100644
View file @
0249899c
import
{
ProductVisit
}
from
'
./product-visit.entity
'
;
import
{
EntityRepository
,
Repository
}
from
"
typeorm
"
;
@
EntityRepository
(
ProductVisit
)
export
class
ProductVisitRepository
extends
Repository
<
ProductVisit
>
{}
\ No newline at end of file
src/products/product/product.controller.ts
0 → 100644
View file @
0249899c
import
{
Controller
}
from
'
@nestjs/common
'
;
@
Controller
(
'
porduct
'
)
export
class
ProductController
{}
src/products/product/product.entity.ts
0 → 100644
View file @
0249899c
import
{
ProductCateGory
}
from
'
./../product-category/product-category.entity
'
;
import
{
ProductVisit
}
from
'
./../product-visit/product-visit.entity
'
;
import
{
ProductGallery
}
from
'
./../product-gallery/product-gallery.entity
'
;
import
{
BaceEntity
}
from
'
./../../bace.entity
'
;
import
{
Column
,
Entity
,
JoinTable
,
ManyToMany
,
OneToMany
}
from
"
typeorm
"
;
@
Entity
()
export
class
Product
extends
BaceEntity
{
@
Column
()
productname
:
string
;
@
Column
()
price
:
number
;
@
Column
()
short_description
:
string
@
Column
()
description
:
string
;
@
Column
()
imagename
:
string
;
@
Column
()
is_exists
:
boolean
=
false
;
@
Column
()
is_special
:
boolean
=
false
;
@
OneToMany
(()
=>
ProductGallery
,
image
=>
image
.
product
)
images
:
ProductGallery
[];
@
OneToMany
(()
=>
ProductVisit
,
visit
=>
visit
.
product
)
visits
:
ProductVisit
[];
@
ManyToMany
(()
=>
ProductCateGory
)
@
JoinTable
()
categories
:
ProductCateGory
[];
}
\ No newline at end of file
src/products/product/product.module.ts
0 → 100644
View file @
0249899c
import
{
ProductRepository
}
from
'
./product.repository
'
;
import
{
Module
}
from
'
@nestjs/common
'
;
import
{
ProductService
}
from
'
./product.service
'
;
import
{
ProductController
}
from
'
./product.controller
'
;
import
{
TypeOrmModule
}
from
'
@nestjs/typeorm
'
;
@
Module
({
providers
:
[
ProductService
],
controllers
:
[
ProductController
],
imports
:[
TypeOrmModule
.
forFeature
([
ProductRepository
])]
})
export
class
ProductModule
{}
src/products/product/product.repository.ts
0 → 100644
View file @
0249899c
import
{
EntityRepository
,
Repository
}
from
'
typeorm
'
;
import
{
Product
}
from
'
./product.entity
'
;
@
EntityRepository
(
Product
)
export
class
ProductRepository
extends
Repository
<
Product
>
{
}
\ No newline at end of file
src/products/product/product.service.ts
0 → 100644
View file @
0249899c
import
{
CreateProductDto
}
from
'
./../Dto/product-create.dto
'
;
import
{
ProductRepository
}
from
'
./product.repository
'
;
import
{
Injectable
}
from
'
@nestjs/common
'
;
import
{
InjectRepository
}
from
'
@nestjs/typeorm
'
;
import
{
Product
}
from
'
./product.entity
'
;
@
Injectable
()
export
class
ProductService
{
constructor
(@
InjectRepository
(
ProductRepository
)
private
productRepository
:
ProductRepository
)
{
}
private
date
:
Date
=
new
Date
();
async
GetAllProduct
():
Promise
<
Product
[]
>
{
const
products
=
await
this
.
productRepository
.
createQueryBuilder
(
'
product
'
).
getMany
();
return
products
;
}
async
GetByIdProduct
(
id
:
string
):
Promise
<
Product
>
{
const
qurey
=
await
this
.
productRepository
.
findOne
(
id
);
return
qurey
;
}
async
CreateProduct
(
createProductDto
:
CreateProductDto
):
Promise
<
Product
>
{
const
{
productname
,
price
,
short_description
,
description
,
imagename
}
=
createProductDto
;
const
product
=
this
.
productRepository
.
create
({
productname
,
price
,
short_description
,
description
,
imagename
,
});
await
this
.
productRepository
.
save
(
product
);
return
product
;
}
async
UpdateProduct
(
id
:
string
,
updateProductDto
:
CreateProductDto
):
Promise
<
Product
>
{
const
{
productname
,
price
,
short_description
,
description
,
imagename
}
=
updateProductDto
;
const
product
=
await
this
.
GetByIdProduct
(
id
);
product
.
productname
=
productname
;
product
.
price
=
price
;
product
.
short_description
=
short_description
;
product
.
imagename
=
imagename
;
product
.
description
=
description
;
product
.
lastupdatedate
=
this
.
date
;
this
.
productRepository
.
save
(
product
);
return
product
;
}
async
RemoveProduct
(
id
:
string
):
Promise
<
void
>
{
const
product
=
await
this
.
GetByIdProduct
(
id
);
product
.
isdelete
=
!
product
.
isdelete
;
this
.
productRepository
.
save
(
product
);
}
async
ActiveExistsProduct
(
id
:
string
):
Promise
<
void
>
{
const
product
=
await
this
.
GetByIdProduct
(
id
);
product
.
is_exists
=
!
product
.
isdelete
;
this
.
productRepository
.
save
(
product
);
}
async
ActiveSpecialProduct
(
id
:
string
):
Promise
<
void
>
{
const
product
=
await
this
.
GetByIdProduct
(
id
);
product
.
is_special
=
!
product
.
is_special
;
this
.
productRepository
.
save
(
product
);
}
}
Prev
1
2
3
4
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment