Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Distribuidos-Org/ms-alumnos/llms.txt

Use this file to discover all available pages before exploring further.

Send a remove_alumno message to permanently delete a student record from the database. The controller extracts the id from the payload via ParseIntPipe and passes it to the service, which calls TypeORM’s delete method directly by primary key. If no row is affected (i.e. result.affected === 0), the service throws an RpcException with HTTP status 404. There is no soft-delete — the record is gone immediately.

Message pattern

{ "cmd": "remove_alumno" }

Request payload

id
number
required
The numeric alumnoId of the student record to delete. Must be a positive integer.

Response

message
string
A confirmation string in the format Alumno #${id} removed successfully (e.g. "Alumno #5 removed successfully").

Example

import { connect, JSONCodec } from 'nats';

const nc = await connect({ servers: 'nats://localhost:4222' });
const jc = JSONCodec();

const res = await nc.request(
  'remove_alumno',
  jc.encode({ id: 5 }),
  { timeout: 5000 }
);

console.log(jc.decode(res.data));
// { message: 'Alumno #5 removed successfully' }
await nc.drain();

Errors

StatusCause
404No alumno exists with the given id. The exception payload is { "status": 404, "message": "Alumno #5 not found" } (where 5 is the requested ID).
400The id field is missing or cannot be parsed as a valid integer by ParseIntPipe.
Deletion is permanent. There is no soft-delete mechanism or recycle bin in this service. Once removed, the record cannot be recovered from the database. Always verify you have the correct alumnoId before calling this pattern.

Build docs developers (and LLMs) love