Skip to content

Commit 52b15d7

Browse files
authored
Merge branch 'LordNayan:main' into main
2 parents 484319d + 87ec896 commit 52b15d7

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

apps/api/src/controllers/boards.controller.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Request, Response } from 'express';
22
import mongoose from 'mongoose';
3-
import { Board, Company, Post } from '../models/index.js';
3+
import { Board, Company, Post, Category } from '../models/index.js';
44
import { asyncHandler, AppError } from '../middlewares/index.js';
55

66
export const listBoards = asyncHandler(async (req: Request, res: Response): Promise<void> => {
@@ -150,6 +150,17 @@ export const createBoard = asyncHandler(async (req: Request, res: Response): Pro
150150
privateComments: privateComments || false,
151151
});
152152

153+
// Create default categories for the new board
154+
const defaultCategories = ['Feature Request', 'UI Improvement', 'Bugs'];
155+
await Category.insertMany(
156+
defaultCategories.map(categoryName => ({
157+
companyID,
158+
boardID: board._id,
159+
name: categoryName,
160+
postCount: 0,
161+
}))
162+
);
163+
153164
res.json({
154165
id: board._id.toString(),
155166
created: board.created.toISOString(),

0 commit comments

Comments
 (0)