@assetval/conversation
v1.0.8
Published
AssetVal's conversation model
Downloads
26
Readme
Conversation
This is the Veritas Conversation / Message Schema workspace.
Installation
yarn add @assetval/conversation
Usage
As a Class (Front End)
import { Conversation, Message } from '@assetval/conversation';
const conversation = new Conversation({
});
const message = new Message({
body: 'Hello, World!',
});
As Schema (Back End)
import { ConversationSchema, Conversation } from '@assetval/conversation';
import { model } from 'mongoose';
export const ConversationModel = model<Conversation>('conversations', ConversationSchema);
As Validation (Back End)
import { ConversationValidationSchema } from '@assetval/conversation';
import { z } from 'zod';
import { MagikRoutes } from '../middleware/RouterManager.js';
const ProfileRoute = MagikRoutes.getRouter('/profile');
ProfileRoute.post('/updateConversation', {
auth: 'ensureAuthenticated',
validationSchema: z.object({
body: ConversationValidationSchema
}),
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