Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
I
init-things
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nanahira
init-things
Commits
d70bebb5
Commit
d70bebb5
authored
Dec 10, 2021
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
a29c689c
Pipeline
#7688
passed with stages
in 1 minute and 36 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
17 deletions
+25
-17
things/nest-typeorm/src/entities/decorators/base.ts
things/nest-typeorm/src/entities/decorators/base.ts
+8
-8
things/nest-typeorm/src/entities/decorators/extended.ts
things/nest-typeorm/src/entities/decorators/extended.ts
+1
-4
things/nest-typeorm/src/entities/decorators/relation.ts
things/nest-typeorm/src/entities/decorators/relation.ts
+16
-5
No files found.
things/nest-typeorm/src/entities/decorators/base.ts
View file @
d70bebb5
...
@@ -111,11 +111,11 @@ export const EnumColumn = <T>(
...
@@ -111,11 +111,11 @@ export const EnumColumn = <T>(
IsEnum
(
targetEnum
),
IsEnum
(
targetEnum
),
]);
]);
export
const
NotColumn
=
(
export
const
NotColumn
=
(
description
?:
string
,
description
?:
string
,
swaggerExtras
:
ApiPropertyOptions
=
{},
swaggerExtras
:
ApiPropertyOptions
=
{},
):
PropertyDecorator
=>
):
PropertyDecorator
=>
MergePropertyDecorators
([
MergePropertyDecorators
([
Exclude
(),
Exclude
(),
ApiProperty
({
description
,
required
:
false
,
...
swaggerExtras
}),
ApiProperty
({
description
,
required
:
false
,
...
swaggerExtras
}),
]);
]);
things/nest-typeorm/src/entities/decorators/extended.ts
View file @
d70bebb5
import
{
import
{
MergePropertyDecorators
,
StringColumn
}
from
'
./base
'
;
MergePropertyDecorators
,
StringColumn
,
}
from
'
./base
'
;
import
{
Index
}
from
'
typeorm
'
;
import
{
Index
}
from
'
typeorm
'
;
export
const
EntityName
=
(
length
=
32
,
description
=
'
名称
'
)
=>
export
const
EntityName
=
(
length
=
32
,
description
=
'
名称
'
)
=>
...
...
things/nest-typeorm/src/entities/decorators/relation.ts
View file @
d70bebb5
import
{
Column
}
from
'
typeorm
'
;
import
{
Column
}
from
'
typeorm
'
;
import
{
MergePropertyDecorators
}
from
'
./base
'
;
import
{
MergePropertyDecorators
}
from
'
./base
'
;
import
{
ApiProperty
}
from
'
@nestjs/swagger
'
;
import
{
ApiProperty
,
ApiPropertyOptions
}
from
'
@nestjs/swagger
'
;
import
{
IsInt
,
IsNotEmpty
,
IsOptional
,
IsPositive
}
from
'
class-validator
'
;
import
{
IsInt
,
IsNotEmpty
,
IsOptional
,
IsPositive
}
from
'
class-validator
'
;
import
{
BigintTransformer
}
from
'
../utility/bigint-transform
'
;
import
{
BigintTransformer
}
from
'
../utility/bigint-transform
'
;
import
{
ColumnCommonOptions
}
from
'
typeorm/decorator/options/ColumnCommonOptions
'
;
import
{
ColumnWithLengthOptions
}
from
'
typeorm/decorator/options/ColumnWithLengthOptions
'
;
import
{
ColumnWithWidthOptions
}
from
'
typeorm/decorator/options/ColumnWithWidthOptions
'
;
export
const
RelationColumn
=
(
description
=
'
对应编号
'
,
notNull
=
false
)
=>
export
const
RelationColumn
=
(
description
=
'
对应编号
'
,
notNull
=
false
,
columnExtras
:
ColumnCommonOptions
&
ColumnWithWidthOptions
=
{},
propertyExtras
:
ApiPropertyOptions
=
{},
)
=>
MergePropertyDecorators
([
MergePropertyDecorators
([
Column
(
'
bigint
'
,
{
Column
(
'
bigint
'
,
{
nullable
:
!
notNull
,
nullable
:
!
notNull
,
unsigned
:
true
,
unsigned
:
true
,
transformer
:
new
BigintTransformer
(),
transformer
:
new
BigintTransformer
(),
...
columnExtras
,
}),
}),
ApiProperty
({
type
:
Number
,
description
}),
ApiProperty
({
type
:
Number
,
description
,
...
propertyExtras
}),
...(
notNull
?
[]
:
[
IsOptional
()]),
...(
notNull
?
[]
:
[
IsOptional
()]),
IsInt
(),
IsInt
(),
IsPositive
(),
IsPositive
(),
...
@@ -19,10 +28,12 @@ export const RelationColumn = (description = '对应编号', notNull = false) =>
...
@@ -19,10 +28,12 @@ export const RelationColumn = (description = '对应编号', notNull = false) =>
export
const
StringRelationColumn
=
(
export
const
StringRelationColumn
=
(
description
=
'
对应编号
'
,
description
=
'
对应编号
'
,
notNull
=
false
,
notNull
=
false
,
columnExtras
:
ColumnCommonOptions
&
ColumnWithLengthOptions
=
{},
propertyExtras
:
ApiPropertyOptions
=
{},
)
=>
)
=>
MergePropertyDecorators
([
MergePropertyDecorators
([
Column
(
'
varchar
'
,
{
length
:
32
,
nullable
:
!
notNull
}),
Column
(
'
varchar
'
,
{
length
:
32
,
nullable
:
!
notNull
,
...
columnExtras
}),
ApiProperty
({
type
:
String
,
description
}),
ApiProperty
({
type
:
String
,
description
,
...
propertyExtras
}),
...(
notNull
?
[]
:
[
IsOptional
()]),
...(
notNull
?
[]
:
[
IsOptional
()]),
IsNotEmpty
(),
IsNotEmpty
(),
]);
]);
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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