Skip to content

Commit

Permalink
affectedRows
Browse files Browse the repository at this point in the history
  • Loading branch information
JEMeyer committed Jul 29, 2024
1 parent e6cb628 commit 2dc933f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/controllers/assignments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export const updateAssignment = async (req: Request, res: Response) => {
const idAsNumber = Number(id);

// First update the assignment record, and pull all current assignmentGpus
const [affectedARows, currentAssignmentGpus] = await Promise.all([
const [affectedRows, currentAssignmentGpus] = await Promise.all([
AssignmentService.updateAssignment(
idAsNumber,
name,
Expand Down Expand Up @@ -106,7 +106,7 @@ export const updateAssignment = async (req: Request, res: Response) => {
.filter(Boolean)
)
);
res.json({ affectedARows });
res.json({ affectedRows });
};

export const deployAssignments = async (req: Request, res: Response) => {
Expand Down
4 changes: 2 additions & 2 deletions src/controllers/gpu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ export const deleteGPU = async (req: Request, res: Response) => {
export const updateGPU = async (req: Request, res: Response) => {
const { id } = req.params;
const { name, vram_size, computer_id, weight, display_order } = req.body;
await GpuService.updateGPU(
const affectedRows = await GpuService.updateGPU(
Number(id),
name,
vram_size,
computer_id,
display_order,
weight
);
res.sendStatus(204);
res.json({ affectedRows });
};

export const getGpuLockStatuses = async (_req: Request, res: Response) => {
Expand Down
13 changes: 9 additions & 4 deletions src/controllers/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,16 +95,21 @@ export const deleteModel = async (req: Request, res: Response) => {

export const updateModel = async (req: Request, res: Response) => {
const { name, size, model_type, display_order } = req.body;
let affectedRows = 0;
switch (model_type) {
case 'llm':
await LlmService.updateLLM(name, size, display_order);
affectedRows = await LlmService.updateLLM(name, size, display_order);
break;
case 'diffusor':
await DiffusorService.updateDiffusor(name, size, display_order);
affectedRows = await DiffusorService.updateDiffusor(
name,
size,
display_order
);
break;
case 'stt':
case 'tts':
await SpeechModelService.updateSpeechModel(
affectedRows = await SpeechModelService.updateSpeechModel(
name,
size,
model_type,
Expand All @@ -116,5 +121,5 @@ export const updateModel = async (req: Request, res: Response) => {
return;
}

res.sendStatus(204);
res.json({ affectedRows });
};

0 comments on commit 2dc933f

Please sign in to comment.