# Name

This is the Veritas Name Schema workspace.

## Installation

```sh
yarn add @assetval/name
```

## Usage

### As a Class (Front End)

```ts
import { Name } from '@assetval/name';

const name = new Name({
  first: 'John',
  last: 'Doe',
  middle: 'A',
  preferred: 'Johnny'
});
```

### As Schema (Back End)

```ts
import { NameSchema, Name } from '@assetval/name';
import { model } from 'mongoose';

export const NameModel = model<Name>('names', NameSchema);
```

### As Validation (Back End)

```ts
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

- [Abourass](https://github.com/Abourass)

## 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:

```sh
yarn install
```
