Giter Site home page Giter Site logo

Let's define a model field as primaryKey that will be used on the POST /records and validated with the recordId on PUT about daybed HOT 6 OPEN

Natim avatar Natim commented on July 20, 2024
Let's define a model field as primaryKey that will be used on the POST /records and validated with the recordId on PUT

from daybed.

Comments (6)

leplatrem avatar leplatrem commented on July 20, 2024

Do you mean oneof ?

from daybed.

almet avatar almet commented on July 20, 2024

Yeah, the title is not really self-explanatory.

What (I understood) we want here is a way to actually have a field of the data filled from data that's externally provided. For instance, we could have a field which matches the hawk id we're using, or have a field which is filled using the name of the model.

from daybed.

leplatrem avatar leplatrem commented on July 20, 2024

Okay, I believe I understood... Something like that :

{  name: "creator",
   type: "autofill",
   value: "CREDENTIALS_ID" }

With some constants like MODELNAME etc.

Well... I would have relied on the client to do that, but since I guess it should not be forged we have to do something server-side.

I still would like to see an explicit use-case to judge if the solution is relevant. For example, it can slightly be related to #222

from daybed.

almet avatar almet commented on July 20, 2024

Actually we have two different things: the first one, the "autofill" type, which is useful when we want to associate a creator to a record, as you shown (for instance), and we also need a way to have the server check for us that the id of a record matches a specific notion (for instance the hawkid, or the firefox accounts email).

So that we are sure that /v1/models/keys/records/[email protected] was actually submitted by a verified account.

from daybed.

leplatrem avatar leplatrem commented on July 20, 2024

Ideally, it should have several obvious use-cases (the creator isn't one, since we can have #222). And from what you describe, I don't see it very generic and reusable :(
Maybe should it be thought as a plugin ?

from daybed.

Natim avatar Natim commented on July 20, 2024

No that's not what I was talking about.

The idea is more having a field that IS the record primary key.

{  name: "slug",
   type: "string",
   primary: true
}

Then if I do a POST with:

{slug: "toto"}

It will answer:

{id: "toto"}

Also it will fail to validate if I do a PUT on /records/something if this something isn't toto.

from daybed.

Related Issues (20)

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.