@assetval/name
v0.2.25
Published
AssetVal's internal name schema
Downloads
30
Readme
Name
This is the Veritas Name Schema workspace.
Installation
yarn add @assetval/name
Usage
As a Class (Front End)
import { Name } from '@assetval/name';
const name = new Name({
first: 'John',
last: 'Doe',
middle: 'A',
preferred: 'Johnny'
});
As Schema (Back End)
import { NameSchema, Name } from '@assetval/name';
import { model } from 'mongoose';
export const NameModel = model<Name>('names', NameSchema);
As Validation (Back End)
import { nameSchemaValidation } from '@assetval/name';
import { z } from 'zod';
import { MagikRoutes } from '../middleware/RouterManager.js';
const ProfileRoute = MagikRoutes.getRouter('/profile');
ProfileRoute.post('/updateName', {
auth: 'ensureAuthenticated',
validationSchema: z.object({
body: nameSchemaValidation
}),
route: async (req, res): Promise<void> => {
// Do something
}
});
License
MIT
Authors
Contributing
Download the Schema repository and make sure you have the following installed:
- asdf
- NodeJS (ASDF)
- Yarn (Corepack / Node / ASDF)
- moonrepo
- git-chglog (ASDF)
Then run the following commands:
yarn install