Skip to content

Commit 80fc72b

Browse files
committed
Drop requestingUser / replace with currentUser
1 parent dab6572 commit 80fc72b

27 files changed

+33
-97
lines changed

src/components/authentication/authentication.repository.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import { type ID, ServerException, type Session } from '~/common';
55
import { DatabaseService, DbTraceLayer, OnIndex } from '~/core/database';
66
import {
77
ACTIVE,
8+
currentUser,
89
matchUserGloballyScopedRoles,
9-
requestingUser,
1010
variable,
1111
} from '~/core/database/query';
1212
import { type ScopedRole } from '../authorization/dto';
@@ -226,7 +226,7 @@ export class AuthenticationRepository {
226226
const result = await this.db
227227
.query()
228228
.match([
229-
requestingUser(session),
229+
currentUser,
230230
relation('out', '', 'password', ACTIVE),
231231
node('password', 'Property'),
232232
])
@@ -243,7 +243,7 @@ export class AuthenticationRepository {
243243
await this.db
244244
.query()
245245
.match([
246-
requestingUser(session),
246+
currentUser,
247247
relation('out', '', 'password', ACTIVE),
248248
node('password', 'Property'),
249249
])
@@ -331,7 +331,7 @@ export class AuthenticationRepository {
331331
await this.db
332332
.query()
333333
.match([
334-
requestingUser(session),
334+
currentUser,
335335
relation('out', 'oldRel', 'token', ACTIVE),
336336
node('token', 'Token'),
337337
])

src/components/budget/budget.repository.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import {
2222
merge,
2323
oncePerProject,
2424
paginate,
25-
requestingUser,
2625
sorting,
2726
} from '~/core/database/query';
2827
import { type FileId } from '../file/dto';
@@ -110,7 +109,6 @@ export class BudgetRepository extends DtoRepository<
110109
relation('in', '', 'budget', ACTIVE),
111110
node('project', 'Project', pickBy({ id: filter?.projectId })),
112111
])
113-
.match(requestingUser(session))
114112
.apply(
115113
this.privileges.forUser(session).filterToReadable({
116114
wrapContext: oncePerProject,

src/components/ceremony/ceremony.repository.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import {
1313
matchPropsAndProjectSensAndScopedRoles,
1414
oncePerProject,
1515
paginate,
16-
requestingUser,
1716
sorting,
1817
} from '~/core/database/query';
1918
import {
@@ -84,7 +83,6 @@ export class CeremonyRepository extends DtoRepository<
8483
]
8584
: []),
8685
])
87-
.match(requestingUser(session))
8886
.apply(
8987
this.privileges.forUser(session).filterToReadable({
9088
wrapContext: oncePerProject,

src/components/comments/comment-thread.repository.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import {
88
createRelationships,
99
merge,
1010
paginate,
11-
requestingUser,
1211
sorting,
1312
} from '~/core/database/query';
1413
import { CommentRepository } from './comment.repository';
@@ -83,7 +82,6 @@ export class CommentThreadRepository extends DtoRepository(CommentThread) {
8382
) {
8483
const result = await this.db
8584
.query()
86-
.match(requestingUser(session))
8785
.match([
8886
node('node', 'CommentThread'),
8987
...(parent

src/components/comments/comment.repository.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import {
1111
matchProps,
1212
merge,
1313
paginate,
14-
requestingUser,
1514
sorting,
1615
variable,
1716
} from '~/core/database/query';
@@ -92,7 +91,6 @@ export class CommentRepository extends DtoRepository(Comment) {
9291
async list(threadId: ID, input: CommentListInput, session: Session) {
9392
const result = await this.db
9493
.query()
95-
.match(requestingUser(session))
9694
.match([
9795
node('thread', 'CommentThread', { id: threadId }),
9896
relation('out', '', 'comment', ACTIVE),

src/components/engagement/engagement.repository.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ import {
4646
multiPropsAsSortString,
4747
oncePerProject,
4848
paginate,
49-
requestingUser,
5049
type SortCol,
5150
sortWith,
5251
textJoinMaybe,
@@ -547,7 +546,7 @@ export class EngagementRepository extends CommonRepository {
547546
: q,
548547
),
549548
)
550-
.match(requestingUser(session))
549+
.with('*') // needed between call & where
551550
.apply(engagementFilters(input.filter))
552551
.apply(
553552
this.privileges.for(session, IEngagement).filterToReadable({
@@ -857,10 +856,7 @@ export const engagementFilters = filter.define(() => EngagementFilters, {
857856
separateQueryForEachWord: true,
858857
minScore: 0.9,
859858
}),
860-
project: filter.sub(
861-
() => projectFilters,
862-
'requestingUser',
863-
)((sub) =>
859+
project: filter.sub(() => projectFilters)((sub) =>
864860
sub.match([
865861
node('outer'),
866862
relation('in', '', 'engagement'),

src/components/field-region/field-region.repository.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import {
1818
matchProps,
1919
merge,
2020
paginate,
21-
requestingUser,
2221
sorting,
2322
} from '~/core/database/query';
2423
import {
@@ -111,7 +110,6 @@ export class FieldRegionRepository extends DtoRepository(FieldRegion) {
111110
}
112111
const result = await this.db
113112
.query()
114-
.match(requestingUser(session))
115113
.match(node('node', 'FieldRegion'))
116114
.apply(sorting(FieldRegion, input))
117115
.apply(paginate(input, this.hydrate()))

src/components/field-zone/field-zone.repository.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import {
1919
matchProps,
2020
merge,
2121
paginate,
22-
requestingUser,
2322
sorting,
2423
} from '~/core/database/query';
2524
import {
@@ -129,7 +128,6 @@ export class FieldZoneRepository extends DtoRepository(FieldZone) {
129128
}
130129
const result = await this.db
131130
.query()
132-
.match(requestingUser(session))
133131
.match(node('node', 'FieldZone'))
134132
.apply(sorting(FieldZone, input))
135133
.apply(paginate(input, this.hydrate()))

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import {
99
matchProps,
1010
merge,
1111
paginate,
12-
requestingUser,
1312
sorting,
1413
variable,
1514
} from '~/core/database/query';
@@ -96,7 +95,6 @@ export class FundingAccountRepository extends DtoRepository(FundingAccount) {
9695
async list(input: FundingAccountListInput, session: Session) {
9796
const result = await this.db
9897
.query()
99-
.match(requestingUser(session))
10098
.match(node('node', 'FundingAccount'))
10199
.apply(sorting(FundingAccount, input))
102100
.apply(paginate(input, this.hydrate()))

src/components/language/language.repository.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ import {
4141
pinned,
4242
propSorter,
4343
rankSens,
44-
requestingUser,
4544
sortWith,
4645
variable,
4746
} from '~/core/database/query';
@@ -246,8 +245,6 @@ export class LanguageRepository extends DtoRepository<
246245
relation('out', '', 'language'),
247246
node('node'),
248247
])
249-
// match requesting user once (instead of once per row)
250-
.match(requestingUser(session))
251248
.apply(languageFilters(input.filter))
252249
.apply(
253250
this.privileges.forUser(session).filterToReadable({

0 commit comments

Comments
 (0)