feat(backend): Koeniginnenbewertung (Modul 31)
QueenEvaluation-Modell (Volksstaerke, Sanftmut, Wabensitz, Schwarm- trieb, Brutbild, Honigertrag je Skala 1-5) als Sub-Ressource der Queens-API: GET/POST /queens/:id/evaluations. Vorgezogen vor Modul 27 (Statistik), da dessen Koeniginnen-Auswertungen auf diesen Daten aufbauen.
This commit is contained in:
1 parent
0fc13952fb
commit
50268fa591
8 files changed
+245
-1
No files matched your search
@@ -53,6 +53,9 @@ describe('Queens (e2e)', () => {
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
if (queenId) {
|
||||
await prisma.queenEvaluation.deleteMany({ where: { queenId } });
|
||||
}
|
||||
await prisma.queenColonyHistory.deleteMany({ where: { colonyId } });
|
||||
if (colonyId) {
|
||||
await prisma.colony.update({
|
||||
@@ -102,4 +105,29 @@ describe('Queens (e2e)', () => {
|
||||
.expect(200);
|
||||
expect(history.body).toHaveLength(1);
|
||||
});
|
||||
|
||||
it('adds a queen evaluation and lists it back', async () => {
|
||||
await request(app.getHttpServer())
|
||||
.post(`/api/v1/queens/${queenId}/evaluations`)
|
||||
.set('Authorization', `Bearer ${beekeeperToken}`)
|
||||
.send({
|
||||
colonyId,
|
||||
date: new Date().toISOString(),
|
||||
colonyStrength: 4,
|
||||
gentleness: 5,
|
||||
combBuild: 3,
|
||||
swarmingTendency: 2,
|
||||
broodPattern: 4,
|
||||
honeyYield: 5,
|
||||
})
|
||||
.expect(201);
|
||||
|
||||
const response = await request(app.getHttpServer())
|
||||
.get(`/api/v1/queens/${queenId}/evaluations`)
|
||||
.set('Authorization', `Bearer ${beekeeperToken}`)
|
||||
.expect(200);
|
||||
const evaluations = response.body as { colonyStrength: number }[];
|
||||
expect(evaluations).toHaveLength(1);
|
||||
expect(evaluations[0]?.colonyStrength).toBe(4);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user