Initial
This commit is contained in:
@@ -126,16 +126,23 @@ export function listVCenterConnectionRecords(req, res) {
|
||||
export function createVCenterConnectionRecord(req, res) {
|
||||
const parsed = vcenterConnectionSchema.safeParse(req.body);
|
||||
if (!parsed.success) return res.status(400).json({ error: 'Invalid VMware connection payload' });
|
||||
if (!parsed.data.password) return res.status(400).json({ error: 'A VMware password is required when creating a connection' });
|
||||
res.status(201).json(createVCenterConnection(parsed.data, req.user.id));
|
||||
try {
|
||||
res.status(201).json(createVCenterConnection(parsed.data, req.user.id));
|
||||
} catch (error) {
|
||||
res.status(400).json({ error: error.message });
|
||||
}
|
||||
}
|
||||
|
||||
export function updateVCenterConnectionRecord(req, res) {
|
||||
const parsed = vcenterConnectionSchema.safeParse(req.body);
|
||||
if (!parsed.success) return res.status(400).json({ error: 'Invalid VMware connection payload' });
|
||||
const connection = updateVCenterConnection(req.params.connectionId, parsed.data, req.user.id);
|
||||
if (!connection) return res.status(404).json({ error: 'VMware connection not found' });
|
||||
res.json(connection);
|
||||
try {
|
||||
const connection = updateVCenterConnection(req.params.connectionId, parsed.data, req.user.id);
|
||||
if (!connection) return res.status(404).json({ error: 'VMware connection not found' });
|
||||
res.json(connection);
|
||||
} catch (error) {
|
||||
res.status(400).json({ error: error.message });
|
||||
}
|
||||
}
|
||||
|
||||
export function deleteVCenterConnectionRecord(req, res) {
|
||||
|
||||
Reference in New Issue
Block a user