Skip to content

Implement references in DataApproval properly #73

@simon-wacker

Description

@simon-wacker

I would like DataApproval to implement references (that is publications and standards) differently which will also change how they are added here. I implemented references more properly in the metabase. There is the class https://github.com/building-envelope-data/metabase/blob/develop/backend/src/Data/Reference.cs and the type declaration https://github.com/building-envelope-data/metabase/blob/develop/backend/src/GraphQl/References/ReferenceType.cs There is a ReferenceInput class https://github.com/building-envelope-data/metabase/blob/develop/backend/src/GraphQl/References/ReferenceInput.cs And there are From methods in https://github.com/building-envelope-data/metabase/blob/develop/backend/src/GraphQl/Publications/PublicationType.cs and https://github.com/building-envelope-data/metabase/blob/develop/backend/src/GraphQl/Standards/StandardType.cs to reduce some duplication. In DataApproval.cs you can then just use public Reference? Reference { get; private set; }. And you can add a From method to ReferenceType along the lines of https://github.com/building-envelope-data/metabase/blob/develop/backend/src/GraphQl/DescriptionOrReferences/DescriptionOrReferenceType.cs#L13-L29 (it is gonna be simpler of course because there is no description property to check in your case). Before you invoke the ReferenceType.From method in this mutation (which can be done similar to https://github.com/building-envelope-data/metabase/blob/develop/backend/src/GraphQl/Components/ComponentMutations.cs#L114 with the name Reference instead of PrimeSurface), you need to check that not both Publication and Standard are given as input as is done for example in https://github.com/building-envelope-data/metabase/blob/develop/backend/src/GraphQl/Components/ComponentMutations.cs#L91-L101 And in *DataApprovalInput you can just use ReferenceInput? Reference. I would also drop the prefixes Create from CreatePublicationInput and CreateStandardInput.

Originally posted by @simon-wacker in #69 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    ISEFraunhofer Institute for Solar Energy Systems ISEbackendenhancementNew feature or requestlowLow priority

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions