mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-07-02 11:12:20 +08:00
fix: save uuid & nano id field value with sequelize validation (#3952)
This commit is contained in:
parent
0bb421ac40
commit
ac1e07ff52
@ -20,6 +20,7 @@ describe('uuid field', () => {
|
||||
{
|
||||
name: 'uuid',
|
||||
type: 'uuid',
|
||||
allowNull: false,
|
||||
},
|
||||
],
|
||||
});
|
||||
|
@ -23,14 +23,12 @@ export class NanoidField extends Field {
|
||||
|
||||
bind() {
|
||||
super.bind();
|
||||
this.on('beforeCreate', this.listener);
|
||||
this.on('beforeUpdate', this.listener);
|
||||
this.on('beforeValidate', this.listener);
|
||||
}
|
||||
|
||||
unbind() {
|
||||
super.unbind();
|
||||
this.off('beforeCreate', this.listener);
|
||||
this.off('beforeUpdate', this.listener);
|
||||
this.off('beforeValidate', this.listener);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -21,14 +21,13 @@ export class UuidField extends Field {
|
||||
|
||||
bind() {
|
||||
super.bind();
|
||||
this.on('beforeCreate', this.listener);
|
||||
this.on('beforeUpdate', this.listener);
|
||||
// https://sequelize.org/docs/v6/other-topics/hooks/
|
||||
this.on('beforeValidate', this.listener);
|
||||
}
|
||||
|
||||
unbind() {
|
||||
super.unbind();
|
||||
this.off('beforeCreate', this.listener);
|
||||
this.off('beforeUpdate', this.listener);
|
||||
this.off('beforeValidate', this.listener);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user