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
a27aa9cf
Commit
a27aa9cf
authored
Apr 03, 2022
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add comment as description
parent
77123080
Pipeline
#11453
passed with stages
in 1 minute and 34 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
2 deletions
+13
-2
things/nest-typeorm/src/entities/decorators/base.ts
things/nest-typeorm/src/entities/decorators/base.ts
+6
-0
things/nest-typeorm/src/entities/decorators/relation.ts
things/nest-typeorm/src/entities/decorators/relation.ts
+7
-2
No files found.
things/nest-typeorm/src/entities/decorators/base.ts
View file @
a27aa9cf
...
@@ -9,6 +9,7 @@ import {
...
@@ -9,6 +9,7 @@ import {
IsNotEmpty
,
IsNotEmpty
,
IsOptional
,
IsOptional
,
IsString
,
IsString
,
MaxLength
,
Min
,
Min
,
}
from
'
class-validator
'
;
}
from
'
class-validator
'
;
import
{
ColumnWithWidthOptions
}
from
'
typeorm/decorator/options/ColumnWithWidthOptions
'
;
import
{
ColumnWithWidthOptions
}
from
'
typeorm/decorator/options/ColumnWithWidthOptions
'
;
...
@@ -41,6 +42,7 @@ export const StringColumn = (
...
@@ -41,6 +42,7 @@ export const StringColumn = (
length
,
length
,
default
:
defaultValue
,
default
:
defaultValue
,
nullable
:
!
required
&&
defaultValue
==
null
,
nullable
:
!
required
&&
defaultValue
==
null
,
comment
:
description
,
...
columnExtras
,
...
columnExtras
,
}),
}),
ApiProperty
({
ApiProperty
({
...
@@ -48,11 +50,13 @@ export const StringColumn = (
...
@@ -48,11 +50,13 @@ export const StringColumn = (
description
,
description
,
default
:
defaultValue
,
default
:
defaultValue
,
required
:
required
&&
defaultValue
==
null
,
required
:
required
&&
defaultValue
==
null
,
maxLength
:
length
,
...
propertyExtras
,
...
propertyExtras
,
}),
}),
...(
required
?
[]
:
[
IsOptional
()]),
...(
required
?
[]
:
[
IsOptional
()]),
IsString
(),
IsString
(),
IsNotEmpty
(),
IsNotEmpty
(),
MaxLength
(
length
),
]);
]);
export
const
IntColumn
=
(
export
const
IntColumn
=
(
...
@@ -69,6 +73,7 @@ export const IntColumn = (
...
@@ -69,6 +73,7 @@ export const IntColumn = (
default
:
defaultValue
,
default
:
defaultValue
,
nullable
:
!
required
&&
defaultValue
==
null
,
nullable
:
!
required
&&
defaultValue
==
null
,
unsigned
,
unsigned
,
comment
:
description
,
...(
type
===
'
bigint
'
?
{
transformer
:
new
BigintTransformer
()
}
:
{}),
...(
type
===
'
bigint
'
?
{
transformer
:
new
BigintTransformer
()
}
:
{}),
...
columnExtras
,
...
columnExtras
,
}),
}),
...
@@ -98,6 +103,7 @@ export const EnumColumn = <T>(
...
@@ -98,6 +103,7 @@ export const EnumColumn = <T>(
enum
:
targetEnum
,
enum
:
targetEnum
,
default
:
defaultValue
,
default
:
defaultValue
,
nullable
:
!
required
&&
!
defaultValue
,
nullable
:
!
required
&&
!
defaultValue
,
comment
:
description
,
...
columnExtras
,
...
columnExtras
,
}),
}),
ApiProperty
({
ApiProperty
({
...
...
things/nest-typeorm/src/entities/decorators/relation.ts
View file @
a27aa9cf
...
@@ -18,6 +18,7 @@ export const RelationColumn = (
...
@@ -18,6 +18,7 @@ export const RelationColumn = (
nullable
:
!
notNull
,
nullable
:
!
notNull
,
unsigned
:
true
,
unsigned
:
true
,
transformer
:
new
BigintTransformer
(),
transformer
:
new
BigintTransformer
(),
comment
:
description
,
...
columnExtras
,
...
columnExtras
,
}),
}),
ApiProperty
({
ApiProperty
({
...
@@ -30,7 +31,6 @@ export const RelationColumn = (
...
@@ -30,7 +31,6 @@ export const RelationColumn = (
IsInt
(),
IsInt
(),
IsPositive
(),
IsPositive
(),
]);
]);
export
const
StringRelationColumn
=
(
export
const
StringRelationColumn
=
(
description
=
'
对应编号
'
,
description
=
'
对应编号
'
,
notNull
=
false
,
notNull
=
false
,
...
@@ -38,7 +38,12 @@ export const StringRelationColumn = (
...
@@ -38,7 +38,12 @@ export const StringRelationColumn = (
propertyExtras
:
ApiPropertyOptions
=
{},
propertyExtras
:
ApiPropertyOptions
=
{},
)
=>
)
=>
MergePropertyDecorators
([
MergePropertyDecorators
([
Column
(
'
varchar
'
,
{
length
:
32
,
nullable
:
!
notNull
,
...
columnExtras
}),
Column
(
'
varchar
'
,
{
length
:
32
,
nullable
:
!
notNull
,
comment
:
description
,
...
columnExtras
,
}),
ApiProperty
({
ApiProperty
({
type
:
String
,
type
:
String
,
required
:
notNull
,
required
:
notNull
,
...
...
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