-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
101a7d9
commit 1f4d2f5
Showing
2 changed files
with
145 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
@startuml | ||
class FilesResolver { | ||
-filesService: IFilesService | ||
+listDirectory(path: string): Promise<Project> | ||
+readFile(path: string): Promise<Project> | ||
} | ||
|
||
interface IFilesService { | ||
listDirectory(path: string): Promise<Project> | ||
readFile(path: string): Promise<Project> | ||
} | ||
|
||
class FilesServiceFactory { | ||
-configService: ConfigService | ||
-gitlabFilesService: GitlabFilesService | ||
-localFilesService: LocalFilesService | ||
+create(): IFilesService | ||
} | ||
|
||
class GitlabFilesService { | ||
-configService: ConfigService | ||
-parseArguments(path: string): Promise<{ domain: string; parsedPath: string }> | ||
-sendRequest(query: string): Promise<Project> | ||
-executeQuery(path: string, getQuery: QueryFunction): Promise<Project> | ||
+listDirectory(path: string): Promise<Project> | ||
+readFile(path: string): Promise<Project> | ||
} | ||
|
||
class LocalFilesService { | ||
-configService: ConfigService | ||
-getFileStats(fullPath: string, file: string): Promise<Project> | ||
+listDirectory(path: string): Promise<Project> | ||
+readFile(path: string): Promise<Project> | ||
} | ||
|
||
class ConfigService { | ||
+get(propertyPath: string): any | ||
} | ||
|
||
FilesResolver --> IFilesService: uses | ||
IFilesService <|.. GitlabFilesService: implements | ||
IFilesService <|.. LocalFilesService: implements | ||
FilesServiceFactory --> IFilesService: creates | ||
FilesServiceFactory --> ConfigService: uses | ||
GitlabFilesService --> ConfigService: uses | ||
LocalFilesService --> ConfigService: uses | ||
@enduml |
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,98 @@ | ||
@startuml | ||
actor Client | ||
actor Traefik | ||
box "RAMS" #LightGreen | ||
participant "FilesResolver" as FR | ||
participant "FilesServiceFactory" as FSF | ||
participant "ConfigService" as CS | ||
participant "IFilesService" as IFS | ||
participant "LocalFilesService" as LFS | ||
participant "GitlabFilesService" as GFS | ||
end box | ||
database "Local File System" as FS | ||
database "GitLab API" as GAPI | ||
|
||
Client -> Traefik : HTTP request | ||
Traefik -> FR : GraphQL query | ||
activate FR | ||
|
||
FR -> FSF : create() | ||
activate FSF | ||
|
||
FSF -> CS : getConfiguration("MODE") | ||
activate CS | ||
|
||
CS --> FSF : return configuration value | ||
deactivate CS | ||
|
||
alt MODE = Local | ||
FSF -> FR : return filesService (LFS) | ||
deactivate FSF | ||
|
||
FR -> IFS : listDirectory(path) or readFile(path) | ||
activate IFS | ||
|
||
IFS -> LFS : listDirectory(path) or readFile(path) | ||
activate LFS | ||
|
||
LFS -> CS : getConfiguration("LOCAL_PATH") | ||
activate CS | ||
|
||
CS --> LFS : return local path | ||
deactivate CS | ||
|
||
LFS -> FS : Access filesystem | ||
alt Filesystem error | ||
FS --> LFS : Filesystem error | ||
LFS -> LFS : Throw new InternalServerErrorException | ||
LFS --> IFS : Error | ||
else Successful file operation | ||
FS --> LFS : Return filesystem data | ||
LFS -> IFS : return Promise<Project> | ||
end | ||
deactivate LFS | ||
else MODE = GitLab | ||
FSF -> FR : return filesService (GFS) | ||
deactivate FSF | ||
|
||
FR -> IFS : listDirectory(path) or readFile(path) | ||
activate IFS | ||
|
||
IFS -> GFS : listDirectory(path) or readFile(path) | ||
activate GFS | ||
|
||
GFS -> GFS : parseArguments(path) | ||
GFS -> GFS : executeQuery() | ||
|
||
GFS -> CS : getConfiguration("GITLAB_API_URL", "GITLAB_TOKEN") | ||
activate CS | ||
|
||
CS --> GFS : return GitLab API URL and Token | ||
deactivate CS | ||
|
||
GFS -> GAPI : sendRequest() | ||
alt GitLab API error | ||
GAPI --> GFS : API error | ||
GFS -> GFS : Throw new Error("Invalid query") | ||
GFS --> IFS : Error | ||
else Successful GitLab API operation | ||
GAPI --> GFS : Return API response | ||
GFS -> IFS : return Promise<Project> | ||
end | ||
deactivate GFS | ||
end | ||
|
||
alt Error thrown | ||
IFS -> FR : return Error | ||
deactivate IFS | ||
FR -> Traefik : return Error | ||
Traefik -> Client : HTTP error response | ||
else Successful operation | ||
IFS -> FR : return Promise<Project> | ||
deactivate IFS | ||
FR -> Traefik : return Promise<Project> | ||
Traefik -> Client : HTTP response | ||
end | ||
|
||
deactivate FR | ||
@enduml |