codesxt / strapi-plugin-autoincrement

A strapi plugin to add autoincrementable fields

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Strapi Autoincrement

NPM Version Monthly download on NPM License Follow Bruno Faúndez Repo stars

A plugin created to add autoincrementable Custom Fields to the Strapi open-source headless CMS.

How it works

Internally, it creates a two Content Types to store the counters: one for integers and other for bigintegers.

An entry is created automatically in the corresponding Content-Type when you add one of the Custom Fields and use them for the first time. They add the corresponding value and increment the counter in the beforeCreate lifecycle hook.

Features

  • Add integer counter custom field: Allows you to add a custom field to your Content Types that uses an integer value.
  • Add biginteger counter custom field: Allows you to add a custom field to your Content Types that uses a biginteger value, if you want to count a lot.

Installation

You need to have a Strapi project with version 4.4 or superior to user Custom Fields.

Inside your Strapi app, add the package:

With npm:

npm install strapi-plugin-autoincrement

With yarn:

yarn add strapi-plugin-autoincrement

Then run build:

npm run build

or:

yarn build

Roadmap

Here are some planned improvements for the plugin, but they may change based on design decisions.

  • Fix bug on using the integer field in the Content Type Builder (invalid default value)
  • Add settings option to select initial counter value (by default they start at 0)

Links

About

A strapi plugin to add autoincrementable fields

License:MIT License


Languages

Language:JavaScript 100.0%