generated from bastian/boilerplate
mandatory
This commit is contained in:
@@ -96,8 +96,8 @@ export class FurnitureService {
|
||||
const saved = await this.furniture.requirements.save(
|
||||
this.furniture.requirements.create({
|
||||
projectId,
|
||||
roomId: dto.roomId,
|
||||
name: dto.name.trim(),
|
||||
roomId: dto.roomId ?? null,
|
||||
name: dto.name?.trim() || 'Unbenannter Möbelbedarf',
|
||||
description: dto.description?.trim() || null,
|
||||
category: dto.category,
|
||||
priority: dto.priority,
|
||||
@@ -144,8 +144,8 @@ export class FurnitureService {
|
||||
id,
|
||||
dto.version,
|
||||
{
|
||||
roomId: dto.roomId,
|
||||
name: dto.name.trim(),
|
||||
roomId: dto.roomId ?? null,
|
||||
name: dto.name?.trim() || 'Unbenannter Möbelbedarf',
|
||||
description: dto.description?.trim() || null,
|
||||
category: dto.category,
|
||||
priority: dto.priority,
|
||||
@@ -159,10 +159,10 @@ export class FurnitureService {
|
||||
await this.activity(
|
||||
projectId,
|
||||
userId,
|
||||
before.roomId === dto.roomId
|
||||
before.roomId === (dto.roomId ?? null)
|
||||
? 'furniture.requirement-updated'
|
||||
: 'furniture.requirement-moved',
|
||||
{ requirementId: id, roomId: dto.roomId },
|
||||
{ requirementId: id, roomId: dto.roomId ?? null },
|
||||
);
|
||||
return this.owned(this.furniture.requirements, projectId, id);
|
||||
}
|
||||
@@ -1016,7 +1016,7 @@ export class FurnitureService {
|
||||
const requirement = requirements.find(
|
||||
(entry) => entry.id === selection.requirementId,
|
||||
);
|
||||
if (requirement)
|
||||
if (requirement?.roomId)
|
||||
byRoom[requirement.roomId] = sumMoney([
|
||||
byRoom[requirement.roomId] ?? '0',
|
||||
totalFor(selection),
|
||||
@@ -1123,7 +1123,7 @@ export class FurnitureService {
|
||||
const decimal = (value?: number) =>
|
||||
value === undefined ? null : value.toFixed(2);
|
||||
return {
|
||||
name: dto.name.trim(),
|
||||
name: dto.name?.trim() || 'Unbenannter Möbelvorschlag',
|
||||
manufacturer: text(dto.manufacturer),
|
||||
model: text(dto.model),
|
||||
description: text(dto.description),
|
||||
@@ -1222,10 +1222,10 @@ export class FurnitureService {
|
||||
}
|
||||
private async validateRequirementLinks(
|
||||
projectId: string,
|
||||
roomId: string,
|
||||
roomId?: string,
|
||||
responsibleUserId?: string,
|
||||
) {
|
||||
await this.owned(this.renovation.rooms, projectId, roomId);
|
||||
if (roomId) await this.owned(this.renovation.rooms, projectId, roomId);
|
||||
if (responsibleUserId) {
|
||||
const member = await this.projects.findMembership(
|
||||
projectId,
|
||||
|
||||
Reference in New Issue
Block a user