Create an incremental id upon publishing

System Information
  • Strapi Version: 4.5.6
  • Operating System: Ubuntu 22.04
  • Database: Postgres
  • Node Version: 18.12.1
  • NPM Version: 8.19.2

I am creating an application where users can submit certain posts, all automatically under the ‘Draft’ state. Upon approval of an admin, the post can move to ‘Published’, but should receive an ‘incremental_id’ equal to the latest published post’ incremental_id + 1.
For example: there are 500 posts submitted already and the admins have approved 95 posts (numbered with incremental_id’s from 1 to 95). Upon a new approval, the new post should automatically receive an incremental_id of 96.

I think that this could be solved with a lifecycle hook, but I’m somewhat stuck on it.
Any help would be appreciated!