feat: Add company linking to personal contacts
- Add companyId column to personal_contacts table - Update personal-contact service to include companyName in list - Add getContactsByCompanyId function for company contacts endpoint - Add GET /companies/:companyId/contacts endpoint - Add companyId to contact validation schema 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -7,6 +7,7 @@ const normalizePayload = (body) => ({
|
||||
phone: body.phone?.trim(),
|
||||
email: body.email?.trim(),
|
||||
secondaryEmail: body.secondaryEmail?.trim() || null,
|
||||
companyId: body.companyId || null,
|
||||
})
|
||||
|
||||
export const listPersonalContacts = async (req, res, next) => {
|
||||
@@ -57,3 +58,13 @@ export const deletePersonalContact = async (req, res, next) => {
|
||||
next(error)
|
||||
}
|
||||
}
|
||||
|
||||
export const getContactsByCompany = async (req, res, next) => {
|
||||
try {
|
||||
const { companyId } = req.params
|
||||
const contacts = await personalContactService.getContactsByCompanyId(companyId)
|
||||
res.status(200).json({ success: true, data: contacts })
|
||||
} catch (error) {
|
||||
next(error)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user