feat: property value as Union type
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
c91f65d04c
commit
d085d80f74
6 changed files with 40 additions and 7 deletions
|
|
@ -16,8 +16,16 @@ defmodule Mv.Membership.Property do
|
|||
attributes do
|
||||
uuid_primary_key :id
|
||||
|
||||
attribute :value, :string,
|
||||
description: "Speichert den Wert, Typ-Interpretation per property_type.typ"
|
||||
attribute :value, :union,
|
||||
constraints: [
|
||||
storage: :type_and_value,
|
||||
types: [
|
||||
bool: [type: :boolean],
|
||||
date: [type: :date],
|
||||
int: [type: :integer],
|
||||
string: [type: :string]
|
||||
]
|
||||
]
|
||||
end
|
||||
|
||||
relationships do
|
||||
|
|
@ -25,4 +33,8 @@ defmodule Mv.Membership.Property do
|
|||
|
||||
belongs_to :property_type, Mv.Membership.PropertyType
|
||||
end
|
||||
|
||||
calculations do
|
||||
calculate :value_to_string, :string, expr(value[:value] <> "")
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue