Open webdevog opened 1 week ago
I think this should be possible with the where: { deletedAt: null }
/where: { deletedAt: Not(null) }
in the configuration?
@Helveg thanks for your response, but again your proposal - it is kind of global filtering in configuration. We can achieve this using withDeleted: true
or withDeleted: false
in configuration.
I'd like to have withDeleted: false
by default. So that - only active records are being returned in many places in my application, but in specific cases - for admin user purposes I'd like to specify some query parameter to return not only active records but deleted records (soft deleted to be precise) as well.
just pass your "custom query param" to the withDeleted
config then ? 😅
@ppetzold thank you. For sure it will work, but I thought that it would be a nice feature to have it in a predefined set of parameters because I think it can be commonly used. Anyway thank you, at least now I know that it is not build-in feature and I need to create my custom query parameter
Ok. I made such a solution without using any custom parameters:
findAll(query: PaginateQuery): Promise<Paginated<Facility>> { FACILITY_PAGINATE_CONFIG.withDeleted = query?.filter?.deletedAt === '$not:$null'; return paginate(query, this.r, FACILITY_PAGINATE_CONFIG); }
Hello! Firstly, thank you for the great library and your work! I need to control response by a filtering parameter like "withDeleted", so I can show to a user active records and deleted records depending on a some filter parameter (something like "withDeleted" or so on). So that user can restore deleted items etc. Can you please tell me the correct way to control withDeleted results? Thank you!