Replies: 1 comment
-
Assuming your column is named const nanoid = require('nanoid');
module.exports = function registerHooks({ filter }) {
filter('items.create', (payload) => {
if (Array.isArray(payload)) return payload.map((item) => item.shortid = nanoid());
payload.shortid = nanoid();
return payload;
});
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am using nanoid to generate short ids. Every table has a field to store it.
What would be the best approach to generate a nanoid and save it to the record when saving the form to create a record?
If anyone could provide some high level pseudo I can go on from there.
Beta Was this translation helpful? Give feedback.
All reactions