Skip to content
This repository has been archived by the owner on Sep 30, 2024. It is now read-only.

Commit

Permalink
_id <-> id
Browse files Browse the repository at this point in the history
  • Loading branch information
Dnouv committed Aug 4, 2023
1 parent b5b96f9 commit e3b1c5a
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/definition/accessors/IRoleRead.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export interface IRoleRead {
* @returns null if no role is found.
* @throws If there is an error while retrieving the role.
*/
getOneByIdOrName(idOrName: IRole['_id'] | IRole['name'], appId: string): Promise<IRole | null>;
getOneByIdOrName(idOrName: IRole['id'] | IRole['name'], appId: string): Promise<IRole | null>;

/**
* Retrieves all custom roles.
Expand Down
2 changes: 1 addition & 1 deletion src/definition/roles/IRole.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ export interface IRole {
name: string;
protected: boolean;
scope: 'Users' | 'Subscriptions';
_id: string;
id: string;
}
2 changes: 1 addition & 1 deletion src/server/accessors/RoleRead.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { RoleBridge } from '../bridges';
export class RoleRead implements IRoleRead {
constructor(private roleBridge: RoleBridge, private appId: string) {}

public getOneByIdOrName(idOrName: IRole['_id'] | IRole['name']): Promise<IRole | null> {
public getOneByIdOrName(idOrName: IRole['id'] | IRole['name']): Promise<IRole | null> {
return this.roleBridge.doGetOneByIdOrName(idOrName, this.appId);
}

Expand Down
4 changes: 2 additions & 2 deletions src/server/bridges/RoleBridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { AppPermissions } from '../permissions/AppPermissions';
import { BaseBridge } from './BaseBridge';

export abstract class RoleBridge extends BaseBridge {
public async doGetOneByIdOrName(idOrName: IRole['_id'] | IRole['name'], appId: string): Promise<IRole | null> {
public async doGetOneByIdOrName(idOrName: IRole['id'] | IRole['name'], appId: string): Promise<IRole | null> {
if (this.hasReadPermission(appId)) {
return this.getOneByIdOrName(idOrName, appId);
}
Expand All @@ -17,7 +17,7 @@ export abstract class RoleBridge extends BaseBridge {
}
}

protected abstract getOneByIdOrName(idOrName: IRole['_id'] | IRole['name'], appId: string): Promise<IRole | null>;
protected abstract getOneByIdOrName(idOrName: IRole['id'] | IRole['name'], appId: string): Promise<IRole | null>;
protected abstract getCustomRoles(appId: string): Promise<Array<IRole>>;

private hasReadPermission(appId: string): boolean {
Expand Down
2 changes: 1 addition & 1 deletion tests/test-data/bridges/roleBridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { IRole } from '../../../src/definition/roles';
import { RoleBridge } from '../../../src/server/bridges';

export class TestsRoleBridge extends RoleBridge {
public getOneByIdOrName(idOrName: IRole['_id'] | IRole['name'], appId: string): Promise<IRole | null> {
public getOneByIdOrName(idOrName: IRole['id'] | IRole['name'], appId: string): Promise<IRole | null> {
throw new Error('Method not implemented.');
}

Expand Down

0 comments on commit e3b1c5a

Please sign in to comment.