Expose using groups
See original GitHub issueHi,
I’ve got an entity User like this :
@Entity()
export class User {
@PrimaryGeneratedColumn()
id: number;
@Column()
username: string;
@IsOptional({ groups: [UPDATE] })
@IsNotEmpty({ groups: [CREATE] })
@IsEmail({}, { always: true })
@Validate(PropertyNotExists, { always: true })
@Expose({ groups: [Roles.ADMIN, Roles.OWNER], toPlainOnly: true })
@Transform(val => val.toLocaleLowerCase(), { toClassOnly: true })
@Column({ unique: true })
email: string;
}
I want to expose email address only if the authenticated user is the owner or has the role “ADMIN”. It works for GET requests, but when i make a POST/PUT/PATCH request, the email property is excluded before saving the entity and i’ve got a bad request 400 with the error “email should not be empty”
Any idea how to resolve this issue ? Thanks
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Multiple Exposure Groups: Using a Reference Group - SPH
In this study there are no unexposed subjects, but we can classify them as having low, medium, and high exposure. To compute the...
Read more >Expose app groups in the LDAP interface directory information ...
In the Admin Console, go to Directory > Directory Integrations. · Select an LDAP interface instance and click Edit. · In the Groups...
Read more >Exposure Group - SAP Documentation
The exposure group object type (just like the position , job and task object types) can be used to indirectly assign agents with...
Read more >What Happened To Exposé? | The Entire Group Was Fired ...
Miami nightclubs in the '80s were one of the hottest spots around to hear the familiar keyboard riffs and electro funk drum-machine patterns ......
Read more >How Exposé Endured to Become One of the Most Successful ...
To this day, Exposé are huge in freestyle nostalgia circles, ... all of their hits, set out to create a group with three...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@daviddlv you can set
serialize
options for each method to false (https://github.com/nestjsx/crud/wiki/Controllers#serialize) or even do it globally (https://github.com/nestjsx/crud/wiki/Controllers#global-options) and apply your own serialize interceptor@zMotivat0r This doesn’t help.