-
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.
refactor: update config transformer to build full image urls (#129)
- Loading branch information
Showing
10 changed files
with
62 additions
and
33 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
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 |
---|---|---|
@@ -1,14 +1,25 @@ | ||
import { AppContext } from '../common/types/core.d.ts'; | ||
import { AppContext, ErrorResponse } from '../common/types/core.d.ts'; | ||
import { Repository } from './repository/index.ts'; | ||
import { LocalSource } from './local/index.ts'; | ||
import { collection } from '../common/mongo/index.ts'; | ||
import { Status } from 'jsr:@oak/[email protected]/status'; | ||
|
||
export const config = async ({ state, response }: AppContext) => { | ||
const localSource = new LocalSource(collection('config', state.local)); | ||
const repository = new Repository( | ||
state.features, | ||
localSource, | ||
); | ||
const configuration = await repository.getConfiguration(); | ||
|
||
response.type = 'application/json'; | ||
response.body = await repository.getConfiguration(); | ||
if (configuration) { | ||
response.status = Status.OK; | ||
response.body = await repository.getConfiguration(); | ||
} else { | ||
response.status = Status.InternalServerError; | ||
response.body = <ErrorResponse> { | ||
message: 'An error occured while fetching configuration', | ||
}; | ||
} | ||
}; |
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
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