Skip to content

Commit 634db07

Browse files
committed
Rename ActorRepository to SystemAgentRepository
To actually match the concrete type it is for.
1 parent 2e5f9b6 commit 634db07

File tree

6 files changed

+18
-18
lines changed

6 files changed

+18
-18
lines changed

src/components/admin/admin.edgedb.repository.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ import { ID, Role } from '~/common';
33
import { RootUserAlias } from '~/core/config/root-user.config';
44
import { disableAccessPolicies, e, EdgeDB } from '~/core/edgedb';
55
import { AuthenticationRepository } from '../authentication/authentication.repository';
6-
import { ActorRepository } from '../user/actor.repository';
6+
import { SystemAgentRepository } from '../user/system-agent.repository';
77

88
@Injectable()
99
export class AdminEdgeDBRepository {
1010
private readonly db: EdgeDB;
1111
constructor(
1212
edgedb: EdgeDB,
1313
readonly auth: AuthenticationRepository,
14-
readonly actors: ActorRepository,
14+
readonly agents: SystemAgentRepository,
1515
) {
1616
this.db = edgedb.withOptions(disableAccessPolicies);
1717
}
@@ -38,7 +38,7 @@ export class AdminEdgeDBRepository {
3838
}
3939

4040
async createRootUser(id: ID, email: string, passwordHash: string) {
41-
const ghost = await this.actors.getGhost();
41+
const ghost = await this.agents.getGhost();
4242

4343
const newUser = e.insert(e.User, {
4444
id,
@@ -63,7 +63,7 @@ export class AdminEdgeDBRepository {
6363
}
6464

6565
async updateEmail(id: ID, email: string) {
66-
const ghost = await this.actors.getGhost();
66+
const ghost = await this.agents.getGhost();
6767
const u = e.cast(e.User, e.uuid(id));
6868
const query = e.update(u, () => ({ set: { email } }));
6969
await this.db

src/components/authentication/authentication.service.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import { ForgotPassword } from '~/core/email/templates';
2222
import { Privileges } from '../authorization';
2323
import { rolesForScope, withoutScope } from '../authorization/dto';
2424
import { AssignableRoles } from '../authorization/dto/assignable-roles';
25-
import { ActorRepository } from '../user/actor.repository';
25+
import { SystemAgentRepository } from '../user/system-agent.repository';
2626
import { AuthenticationRepository } from './authentication.repository';
2727
import { CryptoService } from './crypto.service';
2828
import { LoginInput, RegisterInput, ResetPasswordInput } from './dto';
@@ -42,7 +42,7 @@ export class AuthenticationService {
4242
@Logger('authentication:service') private readonly logger: ILogger,
4343
private readonly repo: AuthenticationRepository,
4444
private readonly edgedb: EdgeDB,
45-
private readonly actors: ActorRepository,
45+
private readonly agents: SystemAgentRepository,
4646
private readonly moduleRef: ModuleRef,
4747
) {}
4848

@@ -121,7 +121,7 @@ export class AuthenticationService {
121121

122122
const [result, anon] = await Promise.all([
123123
this.repo.resumeSession(token, impersonatee?.id),
124-
this.actors.getAnonymous(),
124+
this.agents.getAnonymous(),
125125
]);
126126

127127
if (!result) {

src/components/user/actor.edgedb.repository.ts renamed to src/components/user/system-agent.edgedb.repository.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { Injectable } from '@nestjs/common';
22
import { Role } from '~/common';
33
import { disableAccessPolicies, EdgeDB, edgeql } from '~/core/edgedb';
4-
import { ActorRepository } from './actor.repository';
4+
import { SystemAgentRepository } from './system-agent.repository';
55

66
@Injectable()
7-
export class ActorEdgeDBRepository extends ActorRepository {
7+
export class SystemAgentEdgeDBRepository extends SystemAgentRepository {
88
private readonly db: EdgeDB;
99
constructor(edgedb: EdgeDB) {
1010
super();

src/components/user/actor.neo4j.repository.ts renamed to src/components/user/system-agent.neo4j.repository.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ import { Injectable } from '@nestjs/common';
22
import { node } from 'cypher-query-builder';
33
import { ID, Role } from '~/common';
44
import { DatabaseService } from '~/core/database';
5-
import { ActorRepository } from './actor.repository';
5+
import { SystemAgentRepository } from './system-agent.repository';
66

77
@Injectable()
8-
export class ActorNeo4jRepository extends ActorRepository {
8+
export class SystemAgentNeo4jRepository extends SystemAgentRepository {
99
constructor(private readonly db: DatabaseService) {
1010
super();
1111
}

src/components/user/actor.repository.ts renamed to src/components/user/system-agent.repository.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { Role } from '~/common';
44
import { SystemAgent } from './dto';
55

66
@Injectable()
7-
export abstract class ActorRepository {
7+
export abstract class SystemAgentRepository {
88
@CachedByArg()
99
async getAnonymous() {
1010
return await this.upsertAgent('Anonymous');

src/components/user/user.module.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ import { LocationModule } from '../location/location.module';
77
import { OrganizationModule } from '../organization/organization.module';
88
import { PartnerModule } from '../partner/partner.module';
99
import { TimeZoneModule } from '../timezone';
10-
import { ActorEdgeDBRepository } from './actor.edgedb.repository';
1110
import { ActorLoader } from './actor.loader';
12-
import { ActorNeo4jRepository } from './actor.neo4j.repository';
13-
import { ActorRepository } from './actor.repository';
1411
import { AssignableRolesResolver } from './assignable-roles.resolver';
1512
import { EducationModule } from './education/education.module';
1613
import { KnownLanguageRepository } from './known-language.repository';
1714
import { KnownLanguageResolver } from './known-language.resolver';
1815
import { AddActorLabelMigration } from './migrations/add-actor-label.migration';
16+
import { SystemAgentEdgeDBRepository } from './system-agent.edgedb.repository';
17+
import { SystemAgentNeo4jRepository } from './system-agent.neo4j.repository';
18+
import { SystemAgentRepository } from './system-agent.repository';
1919
import { UnavailabilityModule } from './unavailability/unavailability.module';
2020
import { UserEdgeDBRepository } from './user.edgedb.repository';
2121
import { UserLoader } from './user.loader';
@@ -45,15 +45,15 @@ import { UserService } from './user.service';
4545
splitDb(UserRepository, UserEdgeDBRepository),
4646
KnownLanguageRepository,
4747
{
48-
...splitDb(ActorNeo4jRepository, ActorEdgeDBRepository),
49-
provide: ActorRepository,
48+
...splitDb(SystemAgentNeo4jRepository, SystemAgentEdgeDBRepository),
49+
provide: SystemAgentRepository,
5050
},
5151
AddActorLabelMigration,
5252
],
5353
exports: [
5454
UserService,
5555
UserRepository,
56-
ActorRepository,
56+
SystemAgentRepository,
5757
EducationModule,
5858
UnavailabilityModule,
5959
],

0 commit comments

Comments
 (0)