You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
here's some good documentation on this one https://docs.nestjs.com/openapi/mapped-types#partial
i don't know if we fully understand DTOs, they look like they're just being used as typescript types but according to the quote below, found in docs here, it sounds like they are used at run time too
"In this fashion, any route that uses the CreateUserDto will automatically enforce these validation rules."
would also be nice to add some stronger validation on user email like in the example also found at the link above
so basically we need to update all of our DTOs to do one of the following:
use PartialType only when ALL properties on this entity can be updated
would look like this export class UpdateAssetDto extends PartialType(Asset) {}
(but don't actually use it for that one as I think with assets we would never change the poster_id)
use pick or omit mapped types to extend the entity except only enforce a specific set of properties
i.e. export class UpdateAssetDto extends OmitType(Asset, ['poster_id'] as const) {}
(this actually might be what we want for this one)
use none of the mapped types (i think this will be the case for most create DTOs)
these will look like:
export class CreateAssetDto {
// all of the properties from the entity
}
actually, i think we don't want to extend the entities, but rather the createDto (which should require all properties)
The text was updated successfully, but these errors were encountered:
here's some good documentation on this one https://docs.nestjs.com/openapi/mapped-types#partial
i don't know if we fully understand DTOs, they look like they're just being used as typescript types but according to the quote below, found in docs here, it sounds like they are used at run time too
"In this fashion, any route that uses the CreateUserDto will automatically enforce these validation rules."
would also be nice to add some stronger validation on user email like in the example also found at the link above
so basically we need to update all of our DTOs to do one of the following:
would look like this
export class UpdateAssetDto extends PartialType(Asset) {}
(but don't actually use it for that one as I think with assets we would never change the poster_id)
i.e.
export class UpdateAssetDto extends OmitType(Asset, ['poster_id'] as const) {}
(this actually might be what we want for this one)
these will look like:
actually, i think we don't want to extend the entities, but rather the createDto (which should require all properties)
The text was updated successfully, but these errors were encountered: