zf

zenflows testing
git clone https://s.sonu.ch/~srfsh/zf.git
Log | Files | Refs | Submodules | README | LICENSE

commit 671aa2f64f76dfc89e2a7d147999fecb968eb973
parent ad414e97504bed4297c27835738e3076f5faf526
Author: srfsh <dev@srf.sh>
Date:   Tue, 13 Sep 2022 17:47:03 +0300

Zenflows.VF.EconomicResource{,Type}: add required fields for data ingestion

Diffstat:
Msrc/zenflows/vf/economic_resource.ex | 18++++++++++++++++++
Msrc/zenflows/vf/economic_resource/type.ex | 42++++++++++++++++++++++++++++++++++++++++++
2 files changed, 60 insertions(+), 0 deletions(-)

diff --git a/src/zenflows/vf/economic_resource.ex b/src/zenflows/vf/economic_resource.ex @@ -56,6 +56,12 @@ alias Zenflows.VF.{ current_location: SpatialThing.t() | nil, unit_of_effort: Unit.t() | nil, contained_in: EconomicResource.t() | nil, + okhv: String.t() | nil, + repo: String.t() | nil, + version: String.t() | nil, + licensor: String.t() | nil, + license: String.t() | nil, + metadata: map() | nil, } schema "vf_economic_resource" do @@ -80,6 +86,12 @@ schema "vf_economic_resource" do belongs_to :lot, ProductBatch belongs_to :contained_in, EconomicResource belongs_to :unit_of_effort, Unit + field :okhv, :string + field :repo, :string + field :version, :string + field :licensor, :string + field :license, :string + field :metadata, :map timestamps() end @@ -95,6 +107,7 @@ end classified_as stage_id state_id current_location_id lot_id contained_in_id unit_of_effort_id + okhv repo version licensor license metadata ]a @doc false @@ -106,6 +119,11 @@ def chgset(schema \\ %__MODULE__{}, params) do |> Validate.name(:name) |> Validate.note(:note) |> Validate.class(:classified_as) + |> Validate.name(:okhv) + |> Validate.uri(:repo) + |> Validate.name(:version) + |> Validate.name(:licensor) + |> Validate.name(:license) |> require_quantity_units_same() |> Changeset.cast_assoc(:images, with: &File.chgset/2) |> Changeset.assoc_constraint(:conforms_to) diff --git a/src/zenflows/vf/economic_resource/type.ex b/src/zenflows/vf/economic_resource/type.ex @@ -94,6 +94,12 @@ economic resources. @unit_of_effort """ The unit used for use or work or cite actions for this resource. """ +@okhv "The okh version of the standard of the manifest." +@licensor "States who is licensing the project." +@license "States the licenses under which the project is made available." +@repo "A URL to the repository of the project." +@version "The version of the project." +@metadata "Metadata of the project." @desc "A resource which is useful to people or the ecosystem." object :economic_resource do @@ -153,6 +159,24 @@ object :economic_resource do @desc @unit_of_effort field :unit_of_effort, :unit, resolve: &Resolv.unit_of_effort/3 + + @desc @okhv + field :okhv, :string + + @desc @repo + field :repo, :string + + @desc @version + field :version, :string + + @desc @licensor + field :licensor, :string + + @desc @license + field :license, :string + + @desc @metadata + field :metadata, :json end input_object :economic_resource_create_params do @@ -170,6 +194,24 @@ input_object :economic_resource_create_params do @desc @lot_id field :lot_id, :id, name: "lot" + + @desc @okhv + field :okhv, :string + + @desc @repo + field :repo, :string + + @desc @version + field :version, :string + + @desc @licensor + field :licensor, :string + + @desc @license + field :license, :string + + @desc @metadata + field :metadata, :json end input_object :economic_resource_update_params do