dyne / reflow-os

Base scripts to run Reflow OS
7 stars 2 forks source link

Cannot create `Commitment` #8

Closed vcuculo closed 3 years ago

vcuculo commented 3 years ago

Trying to create a commitment in response to an offer, as follows:

mutation {
  createCommitment(
    commitment: {
      action: "transfer"
      provider: "01F3MHQ0KWJC7M19B1E8BXVY46"
      receiver: "01F7XMMHQ81HQ6DA10XFN24B2E"
     resourceConformsTo: "01FE4094Y6J99MEDWXBXQCAJF8"
    }){
    commitment{
      id
      provider {
        name
      }
      receiver {
        name
      }
    }
  }
}

results in

{
  "data": {
    "createCommitment": null
  }
}
vcuculo commented 3 years ago

Are there any updates on this issue or a related time plan? The same happens with the method createSatisfaction. Thank you!

densizengin commented 3 years ago

Hi @vcuculo,

I'm going through all current issues and this is in the queue. Thanks for your understanding. ^^

Cheers, srfsh

densizengin commented 3 years ago

Just a heads up: I've implemented Commitments (all CRUD), and currently working on implementing related stuff like Satisfactions and Fulfillments. I'd like to have a meeting with you to discuss and demonstrate my work (a colleague of mine could also join). I'd like to send you an email about the details; is the email address on your GitHub account appropriate for that?

vcuculo commented 3 years ago

Cool! Thank you for the update, I'll reach you with my work email.

densizengin commented 3 years ago

Cool! Thank you for the update, I'll reach you with my work email.

Alright. You can find my PGP information here if you want: https://www.sonu.ch/~srfsh/pgp.txt

adam-burns commented 3 years ago

Also note that in the Bonfire Valueflows GraphQL schema resourceClassifiedAs: is required, whereas resourceConformsTo: is optional.

adam-burns commented 3 years ago

Also note that in the Bonfire Valueflows GraphQL schema resourceClassifiedAs: is required, whereas resourceConformsTo: is optional.

Please note the comment above is incorrect (thanks @srfsh who msg'ed me over this) - The GraphQL syntax is little bit confusing (at least for me!), but resourceClassifiedAs: line

resourceClassifiedAs: [URI!]

means that if there's a list, it is going to be solely composed of URIs.

If the line ended in [URI!]! (<-- notice the second terminating exclamation mark), then the previous comment would have been true.

vcuculo commented 3 years ago

Cool, thank you for clarify!

densizengin commented 3 years ago

Just built and released the image! It has support for CRUD operations with Commitments, Intents, and Satisfactions, Fulfillments on their way. ^^

Can you test the changes and report me back? ^^

vcuculo commented 3 years ago

Thank you @srfsh ! Just tried a createCommitment mutation after a make update && make run, result is

14:48:07.860 request_id=FrQQqjQkStxmFCgAAA_R [error] The API encountered an exceptional error
%Postgrex.Error{connection_id: 34355, message: nil, postgres: %{code: :undefined_table, file: "parse_relation.c", line: "1191", message: "relation \"vf_commitment\" does not exist", pg_code: "42P01", position: "13", routine: "parserOpenTable", severity: "ERROR", unknown: "ERROR"}, query: "INSERT INTO \"vf_commitment\" (\"action_id\",\"context_id\",\"creator_id\",\"deletable\",\"finished\",\"provider_id\",\"published_at\",\"receiver_id\",\"resource_quantity_id\",\"id\",\"updated_at\") VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11)"}
14:48:07.860 request_id=FrQQqjQkStxmFCgAAA_R [error] ** (Postgrex.Error) ERROR 42P01 (undefined_table) relation "vf_commitment" does not exist

    query: INSERT INTO "vf_commitment" ("action_id","context_id","creator_id","deletable","finished","provider_id","published_at","receiver_id","resource_quantity_id","id","updated_at") VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11)
    (ecto_sql 3.7.1) lib/ecto/adapters/sql.ex:760: Ecto.Adapters.SQL.raise_sql_call_error/1
    (ecto 3.7.1) lib/ecto/repo/schema.ex:744: Ecto.Repo.Schema.apply/4
    (ecto 3.7.1) lib/ecto/repo/schema.ex:367: anonymous fn/15 in Ecto.Repo.Schema.do_insert/4
    (bonfire_valueflows 0.1.0) lib/planning/commitment/commitments.ex:31: anonymous fn/2 in ValueFlows.Planning.Commitment.Commitments.create/2
    (bonfire_common 0.1.0) lib/repo/repo.ex:45: anonymous fn/1 in Bonfire.Repo.transact_with/1
    (ecto_sql 3.7.1) lib/ecto/adapters/sql.ex:1021: anonymous fn/3 in Ecto.Adapters.SQL.checkout_or_transaction/4
    (db_connection 2.4.1) lib/db_connection.ex:863: DBConnection.transaction/3
    (bonfire_valueflows 0.1.0) lib/planning/commitment/graphql.ex:89: anonymous fn/2 in ValueFlows.Planning.Commitment.GraphQL.create_commitment/2
densizengin commented 3 years ago

Can you run Bonfire.Repo.ReleaseTasks.migrate() from the Elixir shell?

vcuculo commented 3 years ago

Sure, here's the output

iex(bonfire@924e6537d712)4> Bonfire.Repo.ReleaseTasks.migrate()
15:24:44.550 [info] Migrations already up
[{:ok, [], []}]

but still same error

densizengin commented 3 years ago

That's really strange. Can you fresh install it for the time being?

vcuculo commented 3 years ago

Thank you @srfsh , I can confirm that a fresh install did the work. I can also confirm, that after some tests of the new functionality, it works as expected. The issue can be closed :blush: