Giter VIP home page Giter VIP logo

pg-omit-archived's People

Contributors

benjie avatar dependabot[bot] avatar venepe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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

pg-omit-archived's Issues

Types not available in published package

Awesome plugin, just had one small question/thing to point out.

The TS types don't seem to be available in the published package?

Could not find a declaration file for module '@graphile-contrib/pg-omit-archived'. '/home/jorlando/coding/can-courier/node_modules/@graphile-contrib/pg-omit-archived/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/graphile-contrib__pg-omit-archived` if it exists or add a new declaration (.d.ts) file containing `declare module '@graphile-contrib/pg-omit-archived';`

Ability to use a timestamp

Is it possible to use a nullable timestamp like deleted_at to implement a soft deletion as is customary in other frameworks? Sometimes it is useful to know when the removal occurred. In our case, we keep records of actions in the system, and the fact of deletion could be easily recorded along with the time.

Document how to use multiple instances

@benjie mentioned on discord that it was possible to use mutliple instances of this plugin simultaneously with different configurations for different columns. Can you add docs on how to do this?

Does not work with simple collections

When using Postgraphile as a library and passing simpleCollections: 'only', the argument includeArchived is not generated in schema and also there is no is_archived column anywhere in the generated sql.

Any estimate for the 3.0 GA release date?

First of all, thank you for this great Postgraphile plugin ❤️ I appreciate all the effort you are putting into maintaining and improving this package.

In my project, I would like to use the recently added "advanced expressions" mode, which is available in v3.0.0 relase candidates only. (I am interested in TypeScript typings too, but those can be easily supplied by a .d.ts file.)

The Releases page shows that the last 3.0 release candidate was published back in August 2021.

What is your plan for 3.0 GA? Are there any features or bugfixes missing? How can we (the community of users) help the project to reach 3.0 GA sooner?

Ability to use expression to omit rows

We have text column status and we would like to omit rows with certain value(s).

The idea is to allow to configure the plugin with kind of expression (eg status != 'deleted'). As we already have discussed, the syntax could be like:

pgStatusDeletedAppliesTo: ['app_public.my_table', 'app_public.my_other_table'],
pgStatusDeletedExpression: (sql, tableAlias) => sql.fragment`${tableAlias}.status != 'deleted'`,

Usage with permissions

I am looking into this plugin because recently a new requirement was added to my application: being able to see deleted entities, i.e.: soft deletes. This plugin looks perfect for my needs but I have a question regarding its usage along with user permissions.

I am currently using roles and row-level security to ensure users don't delete rows they shouldn't, but I am struggling to achieve the same result using this plugin. I understand that now instead of using delete* mutations I have to use update* mutations setting the archived or deleted_at fields to some value but this is not ideal for the tables where users should be able to update rows but not delete them.

A concrete example: in my application users can update their user profiles but they should not be able to delete them. What is even worse, since they can update the archived field they can also set it to null, essentially un-deleting their users.

Do you have suggestions about how to proceed in this case? Are there any other alternatives?

Thank you

v3.0.0 Package syntax error

@graphile-contrib/pg-omit-archived/dist/index.js:75
const pgRelevantColumnIsBoolean = relevantColumn?.type.category === "B";
^

SyntaxError: Unexpected token '.'

Option 'appendPlugins' should be an array of functions, found 'object'

When importing the plugin as a module and including it in the array for appendPlugins, I receive the following error:

Option 'appendPlugins' should be an array of functions, found 'object' at index 0","stack":"Error: Option 'appendPlugins' should be an array of functions, found 'object' at index 0\n at ensureValidPlugins (/usr/src/app/node_modules/postgraphile-core/node8plus/index.js:18:19)\n at getPostGraphileBuilder (/usr/src/app/node_modules/postgraphile-core/node8plus/index.js:169:5)\n at createPostGraphileSchema (/usr/src/app/node_modules/postgraphile-core/node8plus/index.js:224:62)\n

I am importing as follows:

import PgOmitArchived from '@graphile-contrib/pg-omit-archived'

Using version ^3.2.1

Works fine when its just required instead of imported as module.

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.