Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
public
/
sequelize
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
不要怂,就是干,撸起袖子干!
Commit c44c72ae
authored
Apr 18, 2019
by
Mirko Jotic
Committed by
Sushant
Apr 18, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(instance): isSoftDelete true after creating (#10799)
1 parent
4cc7dc8a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
1 deletions
lib/model.js
test/integration/instance.test.js
lib/model.js
View file @
c44c72a
...
@@ -4057,7 +4057,7 @@ class Model {
...
@@ -4057,7 +4057,7 @@ class Model {
const
deletedAtAttribute
=
this
.
constructor
.
rawAttributes
[
this
.
constructor
.
_timestampAttributes
.
deletedAt
];
const
deletedAtAttribute
=
this
.
constructor
.
rawAttributes
[
this
.
constructor
.
_timestampAttributes
.
deletedAt
];
const
defaultValue
=
deletedAtAttribute
.
hasOwnProperty
(
'defaultValue'
)
?
deletedAtAttribute
.
defaultValue
:
null
;
const
defaultValue
=
deletedAtAttribute
.
hasOwnProperty
(
'defaultValue'
)
?
deletedAtAttribute
.
defaultValue
:
null
;
const
deletedAt
=
this
.
get
(
this
.
constructor
.
_timestampAttributes
.
deletedAt
);
const
deletedAt
=
this
.
get
(
this
.
constructor
.
_timestampAttributes
.
deletedAt
)
||
null
;
const
isSet
=
deletedAt
!==
defaultValue
;
const
isSet
=
deletedAt
!==
defaultValue
;
return
isSet
;
return
isSet
;
...
...
test/integration/instance.test.js
View file @
c44c72a
...
@@ -594,6 +594,12 @@ describe(Support.getTestDialectTeaser('Instance'), () => {
...
@@ -594,6 +594,12 @@ describe(Support.getTestDialectTeaser('Instance'), () => {
return
this
.
ParanoidUser
.
sync
({
force
:
true
});
return
this
.
ParanoidUser
.
sync
({
force
:
true
});
});
});
it
(
'should return false when model is just created'
,
function
()
{
return
this
.
ParanoidUser
.
create
({
username
:
'foo'
}).
then
(
user
=>
{
expect
(
user
.
isSoftDeleted
()).
to
.
be
.
false
;
});
});
it
(
'returns false if user is not soft deleted'
,
function
()
{
it
(
'returns false if user is not soft deleted'
,
function
()
{
return
this
.
ParanoidUser
.
create
({
username
:
'fnord'
}).
then
(()
=>
{
return
this
.
ParanoidUser
.
create
({
username
:
'fnord'
}).
then
(()
=>
{
return
this
.
ParanoidUser
.
findAll
().
then
(
users
=>
{
return
this
.
ParanoidUser
.
findAll
().
then
(
users
=>
{
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment