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
Show 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 {
IsNotEmpty
,
IsOptional
,
IsString
,
MaxLength
,
Min
,
}
from
'
class-validator
'
;
import
{
ColumnWithWidthOptions
}
from
'
typeorm/decorator/options/ColumnWithWidthOptions
'
;
...
...
@@ -41,6 +42,7 @@ export const StringColumn = (
length
,
default
:
defaultValue
,
nullable
:
!
required
&&
defaultValue
==
null
,
comment
:
description
,
...
columnExtras
,
}),
ApiProperty
({
...
...
@@ -48,11 +50,13 @@ export const StringColumn = (
description
,
default
:
defaultValue
,
required
:
required
&&
defaultValue
==
null
,
maxLength
:
length
,
...
propertyExtras
,
}),
...(
required
?
[]
:
[
IsOptional
()]),
IsString
(),
IsNotEmpty
(),
MaxLength
(
length
),
]);
export
const
IntColumn
=
(
...
...
@@ -69,6 +73,7 @@ export const IntColumn = (
default
:
defaultValue
,
nullable
:
!
required
&&
defaultValue
==
null
,
unsigned
,
comment
:
description
,
...(
type
===
'
bigint
'
?
{
transformer
:
new
BigintTransformer
()
}
:
{}),
...
columnExtras
,
}),
...
...
@@ -98,6 +103,7 @@ export const EnumColumn = <T>(
enum
:
targetEnum
,
default
:
defaultValue
,
nullable
:
!
required
&&
!
defaultValue
,
comment
:
description
,
...
columnExtras
,
}),
ApiProperty
({
...
...
things/nest-typeorm/src/entities/decorators/relation.ts
View file @
a27aa9cf
...
...
@@ -18,6 +18,7 @@ export const RelationColumn = (
nullable
:
!
notNull
,
unsigned
:
true
,
transformer
:
new
BigintTransformer
(),
comment
:
description
,
...
columnExtras
,
}),
ApiProperty
({
...
...
@@ -30,7 +31,6 @@ export const RelationColumn = (
IsInt
(),
IsPositive
(),
]);
export
const
StringRelationColumn
=
(
description
=
'
对应编号
'
,
notNull
=
false
,
...
...
@@ -38,7 +38,12 @@ export const StringRelationColumn = (
propertyExtras
:
ApiPropertyOptions
=
{},
)
=>
MergePropertyDecorators
([
Column
(
'
varchar
'
,
{
length
:
32
,
nullable
:
!
notNull
,
...
columnExtras
}),
Column
(
'
varchar
'
,
{
length
:
32
,
nullable
:
!
notNull
,
comment
:
description
,
...
columnExtras
,
}),
ApiProperty
({
type
:
String
,
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