Git Product home page Git Product logo

arke's People

Contributors

dorianmercatante avatar erikferrari avatar ilyichv avatar manolo-battista avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

arke's Issues

[Bug] - Test coverage differs between local and actions

Describe the bug
Test coverage differs between local and actions due to an error raised by the GenServer.

 {:noproc,
  {GenServer, :call,
   [
     {:via, Registry, {:group_registry, {:group_test, :test_schema}}},
     {:add_link, :arke_list, :test_arke_group, %{project: :test_schema}},
     5000
   ]}}}

[fix] - last_login is not used

the last_login param in the arke user is never used. We should update it at every login, every refresh and maybe every verify

[fix] - List of integer/float for a multiple parameter

Cannot give multiple values to an integer/float parameter.

Step to reproduce:

  • create an integer parameter as follows
opts = [
        id: :integer_test_values,
        label: "Test integer",
        values: [1, 2, 3, 4],
        multiple: true
      ]
  • assign the parameter to an arke
  • try to create a unit with integer_test_values = [1,2]

The unit should be created because the values are within the opts. Instead it raise an error

[fix] - float filters

If a filter is built with a float and the values does not have the decimal it throws an error. Instead it should work. Below an example of the filter.

----- DOES NOT work ----
filter=and(lte(integer_support,5),lte(float_support,15))

Image

----- work -----
filter=and(lte(integer_support,5),lte(float_support,15.0))

[Bug] - Add better mocking to tests

Describe the bug
We want to have better mocking in order to have stronger tests.
What we can do is add a support file which contains a map that simulates existing units, after that we should update persistence_fn.ex following functions

def execute(query, :all), do: {:execute, :all}
  def execute(query, :one), do: nil
  def execute(query, :raw), do: {:execute, :raw}
  def execute(query, :count), do: {:execute, :count}
  def execute(query, :pseudo_query), do: {:execute, :pseudo_query}

[fix] - Parameter get value error

if ArkePostgres.Query.get_value/2 return an error we should handle it with a tuple {:error, msg}. (It applies also for arke_server which should return 400

[fix] - throw error when number id is passed to an Unit

By default when a number is passed as id of an Unit, a new uuid is generated.

body

{
   "id": 123,
   "label": "test_2"
}

response

{
    "content": {
        "arke_id": "string",
        "default_string": null,
        "format": "attribute",
        "helper_text": null,
        "id": "73d14628-f96d-11ed-8a77-acde48001122",
        "inserted_at": "2023-05-23T13:26:40Z",
        "is_primary": false,
        "label": "test_2",
        "max_length": null,
        "metadata": {},
        "min_length": null,
        "multiple": false,
        "nullable": true,
        "only_run_time": false,
        "persistence": "arke_parameter",
        "required": false,
        "unique": false,
        "updated_at": "2023-05-23T13:26:40Z",
        "values": null
    },
    "messages": []
}

We agreed with @dorianmercatante that it should return an error in this cases.

[analysis] - datetime iso8601

check if datetime has seconds and convert them or try to find a way to add them and then convert the datetime.
(check also date and datetime)

That's because elixir has from_iso8601 methods but the frontend sometimes does not send the seconds.

Alternative: In the error message specify that we need the iso8601 format and send and error if it is not right

[feat] - add on_struct_encode overridable function

** Original Issue **

Maybe create an overridable func called on_get_data | on_query_data which will return by default all the data but can be changed as you want.
Something like before_createor on_create

Image

[chore] - DateTimehandler.compare

Add a compare function in the datetime handler similar to the below one:
NaiveDateTime.compare(otp_unit.data.expiry_datetime, NaiveDateTime.utc_now())

same for date and time and also one which match a :now which provide to get the date/time/datetime now and compare it

[fix] - get arke return 500 after edit

Requirements:

  • project: prova_progetto
  • endpoint get : {{base_path}}/test_arke/unit
  • endpoint put: {{base_path}}/arke/unit/test_arke
  • body put (change active status between true and false):
{
    "parameters": [],
    "type": "arke",
    "active": true,
    "label": "Test Arke",
    "updated_at": "2023-07-03T14:26:10.000000Z",
    "inserted_at": "2023-07-03T14:26:10.000000Z",
    "metadata": {
        "project": "arke_system"
    },
    "arke_id": "arke",
    "id": "test_arke"
}

Description:

i start the backend locally then i run the get endpoint and it returns 200 with 0 unit. Then i edit the same arke using the put and it also return 200, but if i run again the get it return 500 with the error message no function clause matching in ArkePostgres.Query.get_column/1 (nil is given to the get_column function)

below the arke in the query of the get:

Before edit

%Arke.Core.Unit{
  id: :test_arke,
  data: %{
    active: true,
    label: "Test Arke",
    parameters: [
      %{
        arke: :string,
        id: :id,
        metadata: [required: true, persistence: "table_column"]
      },
      %{
        arke: :string,
        id: :arke_id,
        metadata: [required: false, persistence: "table_column"]
      },
      %{
        arke: :dict,
        id: :metadata,
        metadata: [required: false, persistence: "table_column"]
      },
      %{
        arke: :datetime,
        id: :inserted_at,
        metadata: [required: false, persistence: "table_column"]
      },
      %{
        arke: :datetime,
        id: :updated_at,
        metadata: [required: false, persistence: "table_column"]
      }
    ],
    type: "arke"
  },
  arke_id: :arke,
  link: nil,
  metadata: %{:project => :prova_progetto, "project" => "arke_system"},
  inserted_at: ~U[2023-07-03 14:26:10.000000Z],
  updated_at: ~U[2023-07-03 14:26:10.000000Z],
  __module__: Arke.System.Arke
}

After edit

%Arke.Core.Unit{
  id: :test_arke,
  data: %{
    active: false,
    arke_id: "arke",
    label: "Test Arke",
    parameters: [],
    type: "arke"
  },
  arke_id: :arke,
  link: nil,
  metadata: %{:project => :prova_progetto, "project" => "arke_system"},
  inserted_at: ~U[2023-07-03 14:26:10.000000Z],
  updated_at: ~U[2023-07-03 14:26:10.000000Z],
  __module__: nil
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.