AmaanRS / CampusConnect

CampusConnect project started in my Third Year of Engineering and became Fourth Year's final project
0 stars 0 forks source link

Unique id for models which do not have email #7

Open AmaanRS opened 3 months ago

AmaanRS commented 3 months ago

User nanoid to generate a unique id for committee and events model, because exposing mongodb objectid can cause security issues

import { customAlphabet } from 'nanoid'
const nanoid = customAlphabet('1234567890abcdef', 10)
model.id = nanoid() //=> "4f90d13a42"