generated from EyeSeeTea/dhis2-app-skeleton
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: make verification field read only
for users not in incident manager user group
- Loading branch information
Showing
13 changed files
with
136 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { D2Api } from "@eyeseetea/d2-api/2.36"; | ||
import { UserGroupRepository } from "../../domain/repositories/UserGroupRepository"; | ||
import { apiToFuture, FutureData } from "../api-futures"; | ||
import { assertOrError } from "./utils/AssertOrError"; | ||
import { UserGroup } from "../../domain/entities/UserGroup"; | ||
|
||
export class UserGroupD2Repository implements UserGroupRepository { | ||
constructor(private api: D2Api) {} | ||
|
||
getUserGroupByCode(code: string): FutureData<UserGroup> { | ||
return apiToFuture( | ||
this.api.metadata.get({ | ||
userGroups: { | ||
fields: { | ||
id: true, | ||
}, | ||
filter: { | ||
code: { eq: code }, | ||
}, | ||
}, | ||
}) | ||
) | ||
.flatMap(response => assertOrError(response.userGroups[0], `User group ${code}`)) | ||
.map(userGroup => userGroup); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { Future } from "../../../domain/entities/generic/Future"; | ||
import { UserGroup } from "../../../domain/entities/UserGroup"; | ||
import { UserGroupRepository } from "../../../domain/repositories/UserGroupRepository"; | ||
import { FutureData } from "../../api-futures"; | ||
|
||
export class UserGroupTestRepository implements UserGroupRepository { | ||
getUserGroupByCode(_code: string): FutureData<UserGroup> { | ||
return Future.success({ | ||
id: "1", | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { Ref } from "./Ref"; | ||
|
||
export type UserGroup = Ref; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { FutureData } from "../../data/api-futures"; | ||
import { UserGroup } from "../entities/UserGroup"; | ||
|
||
export interface UserGroupRepository { | ||
getUserGroupByCode(code: string): FutureData<UserGroup>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { FutureData } from "../../data/api-futures"; | ||
import { Code } from "../entities/Ref"; | ||
import { UserGroup } from "../entities/UserGroup"; | ||
import { UserGroupRepository } from "../repositories/UserGroupRepository"; | ||
|
||
export class GetUserGroupByCodeUseCase { | ||
constructor(private userGroupRepository: UserGroupRepository) {} | ||
|
||
public execute(code: Code): FutureData<UserGroup> { | ||
return this.userGroupRepository.getUserGroupByCode(code); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters