Skip to content

Let us specify different datatypes for each entity's action. #20

@grunklejp

Description

@grunklejp
  export const permix = createPermix<{
    post: {
      action: "read" | "create";
      dataTypes: {
        read: Post,
        create: Omit<Post, "id">, //  the database auto creates the id 
      };
    };
  }>();

We create a new property called dataTypes (minor version upgrade).

Then in the check() these types will be strongly typed for these actions.

Currently I have to rely on a partial object for all of the actions and this is annoying because I need to constantly reference my permissions to make sure i have the required properties on the object.


What is neat about this is if you need a compound datatype you can just pass a higher level object. {post, user}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions