Skip to content

Commit 1fe9cf2

Browse files
committed
Remove unnecessary checks on unexpected null input
These were added early on in a response to null problems. I believe these resulted from cypher queries whose types didn't match the reality of execution. One service would call another with the result of db types, and boom. Now we understand Cypher a lot better and can rely on these types.
1 parent 247b1dc commit 1fe9cf2

File tree

7 files changed

+0
-40
lines changed

7 files changed

+0
-40
lines changed

src/components/budget/budget.service.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import {
44
DuplicateException,
55
generateId,
66
type ID,
7-
InputException,
87
type ObjectView,
98
Order,
109
ServerException,
@@ -70,14 +69,6 @@ export class BudgetService {
7069
input: CreateBudgetRecord,
7170
changeset?: ID,
7271
): Promise<BudgetRecord> {
73-
const { organizationId, fiscalYear } = input;
74-
75-
if (!fiscalYear || !organizationId) {
76-
throw new InputException(
77-
!fiscalYear ? 'budget.fiscalYear' : 'budget.organizationId',
78-
);
79-
}
80-
8172
await this.verifyRecordUniqueness(input);
8273

8374
try {

src/components/ceremony/ceremony.service.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { Injectable } from '@nestjs/common';
22
import {
33
type ID,
4-
InputException,
54
type ObjectView,
65
ServerException,
76
type UnsecuredDto,
@@ -26,10 +25,6 @@ export class CeremonyService {
2625

2726
@HandleIdLookup(Ceremony)
2827
async readOne(id: ID, _view?: ObjectView): Promise<Ceremony> {
29-
if (!id) {
30-
throw new InputException('No ceremony id to search for', 'ceremony.id');
31-
}
32-
3328
const dto = await this.repo.readOne(id);
3429
return this.secure(dto);
3530
}

src/components/funding-account/funding-account.service.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,6 @@ export class FundingAccountService {
5757

5858
@HandleIdLookup(FundingAccount)
5959
async readOne(id: ID, _view?: ObjectView): Promise<FundingAccount> {
60-
if (!id) {
61-
throw new NotFoundException('Invalid: Blank ID');
62-
}
63-
6460
const result = await this.repo.readOne(id);
6561
return await this.secure(result);
6662
}

src/components/language/ethnologue-language/ethnologue-language.service.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ export class EthnologueLanguageService {
4141
input: UpdateEthnologueLanguage,
4242
sensitivity: Sensitivity,
4343
) {
44-
if (!input) return;
4544
const ethnologueLanguage = await this.repo.readOne(id);
4645

4746
const changes = this.repo.getActualChanges(ethnologueLanguage, input);

src/components/periodic-report/periodic-report.service.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import {
44
CreationFailed,
55
DateInterval,
66
type ID,
7-
NotFoundException,
87
type ObjectView,
98
type Range,
109
type UnsecuredDto,
@@ -92,13 +91,6 @@ export class PeriodicReportService {
9291

9392
@HandleIdLookup([FinancialReport, NarrativeReport, ProgressReport])
9493
async readOne(id: ID, _view?: ObjectView): Promise<PeriodicReport> {
95-
if (!id) {
96-
throw new NotFoundException(
97-
'No periodic report id to search for',
98-
'periodicReport.id',
99-
);
100-
}
101-
10294
const result = await this.repo.readOne(id);
10395
return this.secure(result);
10496
}

src/components/post/post.service.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,6 @@ export class PostService {
3434
) {}
3535

3636
async create(input: CreatePost): Promise<Post> {
37-
if (!input.parentId) {
38-
throw new ServerException(
39-
'A post must be associated with a parent node.',
40-
);
41-
}
4237
const perms = await this.getPermissionsFromPostable(input.parentId);
4338
perms.verifyCan('create');
4439

src/components/project/project-member/project-member.service.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { type MaybeAsync, setOf } from '@seedcompany/common';
33
import {
44
type ID,
55
InputException,
6-
NotFoundException,
76
type ObjectView,
87
Role,
98
ServerException,
@@ -60,13 +59,6 @@ export class ProjectMemberService {
6059

6160
@HandleIdLookup(ProjectMember)
6261
async readOne(id: ID, _view?: ObjectView): Promise<ProjectMember> {
63-
if (!id) {
64-
throw new NotFoundException(
65-
'No project member id to search for',
66-
'projectMember.id',
67-
);
68-
}
69-
7062
const dto = await this.repo.readOne(id);
7163
return this.secure(dto);
7264
}

0 commit comments

Comments
 (0)