// ReadOne returns a role based on role and level sent in request
// TODO: implement better query based on full request and not only the role and the level
ReadOne returns a role based on role and level sent in request
TODO: implement better query based on full request and not only the role and the level
// ReadOne returns a role based on role and level sent in request // TODO : implement better query based on full request and not only the role and the level
func (this *RoleRepository) ReadOne(p *mrequest.RoleRead) (*models.Role, error) {
	result := this.col.FindOne(
		context.Background(),
		bson.NewDocument(bson.EC.String("role", p.Role), bson.EC.Int32("level", int32(p.Level))),
	)
	r := models.Role{}
	err := result.Decode(r)
	if err != nil {
		return nil, err
	}
	return &r, nil
}
func ( this * RoleRepository ) ReadOne ( p * mrequest . RoleRead ) ( * models . Role , error ) { result := this . col . FindOne ( context . Background ( ) , bson . NewDocument ( bson . EC . String ( " " , p . Role ) , bson . EC . Int32 ( " " , int32 ( p . Level ) ) ) , ) r := models . Role { } err := result . Decode ( r ) if err != nil { return nil , err } return & r , nil }
ReadOne returns a role based on role and level sent in request
TODO: implement better query based on full request and not only the role and the level
ReadOne returns a role based on role and level sent in request TODO : implement better query based on full request and not only the role and the level