[#39144] fixed PR issues

- removed some linter issues
- fixed expected data from request tests
pull/9783/head
Eric Schubert 3 years ago
parent 478612b845
commit 9122884110
No known key found for this signature in database
GPG Key ID: 1D346C019BD4BAA2
  1. 10
      frontend/src/app/features/bim/bcf/helper/viewpoints.service.ts
  2. 1
      modules/bim/app/representers/bim/bcf/api/v2_1/viewpoints/full_representer.rb
  3. 4
      modules/bim/spec/requests/api/bcf/v2_1/viewpoints_api_spec.rb

@ -38,6 +38,7 @@ import { BcfTopicResource } from 'core-app/features/bim/bcf/api/topics/bcf-topic
import { APIV3Service } from 'core-app/core/apiv3/api-v3.service';
import idFromLink from 'core-app/features/hal/helpers/id-from-link';
import { BcfViewpointData, CreateBcfViewpointData } from 'core-app/features/bim/bcf/api/bcf-api.model';
import { HalResource } from 'core-app/features/hal/resources/hal-resource';
@Injectable()
export class ViewpointsService {
@ -53,7 +54,7 @@ export class ViewpointsService {
}
public getViewPointResource(workPackage:WorkPackageResource, index:number):BcfViewpointPaths {
const viewpointHref = workPackage.bcfViewpoints[index].href as string;
const viewpointHref = (workPackage.bcfViewpoints as HalResource[])[index].href as string;
return this.bcfApi.parse<BcfViewpointPaths>(viewpointHref);
}
@ -90,7 +91,8 @@ export class ViewpointsService {
}
public saveViewpoint$(workPackage:WorkPackageResource, viewpoint?:CreateBcfViewpointData):Observable<CreateBcfViewpointData> {
const wpProjectId = idFromLink(workPackage.project.href);
const projectLink = (workPackage.project as HalResource).href;
const wpProjectId = idFromLink(projectLink);
const topicUUID$ = this.setBcfTopic$(workPackage);
// Default to the current viewer's viewpoint
const viewpoint$ = viewpoint
@ -116,9 +118,9 @@ export class ViewpointsService {
if (this.topicUUID) {
return of(this.topicUUID);
}
const topicHref = workPackage.bcfTopic?.href;
const topicHref = (workPackage.bcfTopic as HalResource)?.href;
const topicUUID$ = topicHref
? of(this.bcfApi.parse<BcfViewpointPaths>(topicHref)!.id)
? of(this.bcfApi.parse<BcfViewpointPaths>(topicHref).id)
: this.createBcfTopic$(workPackage);
return topicUUID$.pipe(

@ -29,7 +29,6 @@ require_relative 'base_representer'
module Bim::Bcf::API::V2_1::Viewpoints
class FullRepresenter < BaseRepresenter
def self.selector
"json_viewpoint - 'components' as json_viewpoint"
end

@ -78,7 +78,7 @@ describe 'BCF 2.1 viewpoints resource', type: :request, content_type: :json, wit
end
it_behaves_like 'bcf api successful response' do
let(:expected_body) { [viewpoint_json] }
let(:expected_body) { [viewpoint_json.except('components')] }
end
context 'lacking permission to see project' do
@ -99,7 +99,7 @@ describe 'BCF 2.1 viewpoints resource', type: :request, content_type: :json, wit
end
it_behaves_like 'bcf api successful response' do
let(:expected_body) { viewpoint_json }
let(:expected_body) { viewpoint_json.except('components') }
end
context 'lacking permission to see project' do

Loading…
Cancel
Save