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 4cf1cc77
authored
Jan 02, 2014
by
Mick Hansen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix hooks
1 parent
eb77dfb9
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
12 deletions
lib/dao-factory.js
lib/dao.js
test/dao-factory/create.test.js
test/hooks.test.js
lib/dao-factory.js
View file @
4cf1cc7
...
@@ -223,7 +223,6 @@ module.exports = (function() {
...
@@ -223,7 +223,6 @@ module.exports = (function() {
}
}
if
(
type
===
'set'
)
{
if
(
type
===
'set'
)
{
funcs
[
attribute
]
=
function
(
value
)
{
funcs
[
attribute
]
=
function
(
value
)
{
console
.
log
(
this
)
return
this
.
set
(
attribute
,
value
)
return
this
.
set
(
attribute
,
value
)
}
}
}
}
...
...
lib/dao.js
View file @
4cf1cc7
...
@@ -246,20 +246,20 @@ module.exports = (function() {
...
@@ -246,20 +246,20 @@ module.exports = (function() {
options
.
fields
.
push
(
createdAtAttr
)
options
.
fields
.
push
(
createdAtAttr
)
}
}
}
}
var
tmpVals
=
self
.
dataValues
options
.
fields
.
forEach
(
function
(
field
)
{
if
(
tmpVals
[
field
]
!==
undefined
)
{
values
[
field
]
=
tmpVals
[
field
]
}
})
}
}
return
new
Utils
.
CustomEventEmitter
(
function
(
emitter
)
{
return
new
Utils
.
CustomEventEmitter
(
function
(
emitter
)
{
self
.
hookValidate
().
error
(
function
(
err
)
{
self
.
hookValidate
().
error
(
function
(
err
)
{
emitter
.
emit
(
'error'
,
err
)
emitter
.
emit
(
'error'
,
err
)
}).
success
(
function
()
{
}).
success
(
function
()
{
var
tmpVals
=
self
.
dataValues
options
.
fields
.
forEach
(
function
(
field
)
{
if
(
tmpVals
[
field
]
!==
undefined
)
{
values
[
field
]
=
tmpVals
[
field
]
}
})
for
(
var
attrName
in
self
.
daoFactory
.
rawAttributes
)
{
for
(
var
attrName
in
self
.
daoFactory
.
rawAttributes
)
{
if
(
self
.
daoFactory
.
rawAttributes
.
hasOwnProperty
(
attrName
))
{
if
(
self
.
daoFactory
.
rawAttributes
.
hasOwnProperty
(
attrName
))
{
var
definition
=
self
.
daoFactory
.
rawAttributes
[
attrName
]
var
definition
=
self
.
daoFactory
.
rawAttributes
[
attrName
]
...
...
test/dao-factory/create.test.js
View file @
4cf1cc7
...
@@ -713,8 +713,6 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
...
@@ -713,8 +713,6 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
expect
(
users
[
0
].
secretValue
).
to
.
be
.
null
expect
(
users
[
0
].
secretValue
).
to
.
be
.
null
done
()
done
()
})
})
}).
on
(
'sql'
,
function
(
sql
)
{
console
.
log
(
sql
)
})
})
})
})
...
...
test/hooks.test.js
View file @
4cf1cc7
...
@@ -23,6 +23,7 @@ describe(Support.getTestDialectTeaser("Hooks"), function () {
...
@@ -23,6 +23,7 @@ describe(Support.getTestDialectTeaser("Hooks"), function () {
},
{
},
{
hooks
:
{
hooks
:
{
beforeValidate
:
function
(
user
,
fn
)
{
beforeValidate
:
function
(
user
,
fn
)
{
console
.
log
(
"beforeValidate"
)
user
.
mood
=
'happy'
user
.
mood
=
'happy'
fn
(
null
,
user
)
fn
(
null
,
user
)
},
},
...
@@ -111,7 +112,7 @@ describe(Support.getTestDialectTeaser("Hooks"), function () {
...
@@ -111,7 +112,7 @@ describe(Support.getTestDialectTeaser("Hooks"), function () {
self
.
User
.
all
().
success
(
function
(
users
)
{
self
.
User
.
all
().
success
(
function
(
users
)
{
expect
(
users
[
0
].
mood
).
to
.
equal
(
'happy'
)
expect
(
users
[
0
].
mood
).
to
.
equal
(
'happy'
)
expect
(
users
[
0
].
mood
).
to
.
equal
(
'happy'
)
expect
(
users
[
1
].
mood
).
to
.
equal
(
'happy'
)
done
()
done
()
})
})
})
})
...
...
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