AI Group Chat Bot
- Install dependencies:
npm install
- Set up environment variables:
· Create a .env
file in the root of your project.
· Add the necessary environment variables, such as database connection details.
- Start the development server:
npm start
This will start your application on the specified port.
Running Migrations
- Create a migration:
npm run migrate
This will generate a new migration file in the migrations
directory.
- Apply migrations:
npm run migrate:apply
This will run all pending migrations and update your database schema.
Opening Drizzle Studio
- Start Drizzle Studio:
npx drizzle-kit studio
This will open the Drizzle Studio interface in your default web browser.
- Use Drizzle Studio:
Explore your database schema and tables.
Generate code for your models based on the schema.
Run SQL queries and view results.
Available Routes
The following routes have been implemented in the project:
User Routes
POST /api/users
: Create a new userGET /api/users
: Get all usersGET /api/users/:id
: Get a user by IDPUT /api/users/:id
: Update a userDELETE /api/users/:id
: Delete a user
Chatbot Routes
POST /api/chatbots
: Create a new chatbotGET /api/chatbots
: Get all chatbotsGET /api/chatbots/:id
: Get a chatbot by IDDELETE /api/chatbots/:id
: Delete a chatbotPOST /api/chatbots/add-to-group
: Add a chatbot to a groupDELETE /api/chatbots/remove-from-group
: Remove a chatbot from a group
Group Routes
POST /api/groups
: Create a new groupGET /api/groups
: Get all groupsGET /api/groups/:id
: Get a group by IDDELETE /api/groups/:id
: Delete a group
Message Routes
POST /api/messages
: Create a new messageGET /api/messages/:groupId
: Get messages for a specific group
Swagger Documentation
- The project includes Swagger documentation for the API. You can access the documentation by navigating to
/api-docs
in your browser after starting the application