-
-
Notifications
You must be signed in to change notification settings - Fork 217
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #952 from Franceq34/add-secondary-mapper-for-project
Add secondary mapper for project object
- Loading branch information
Showing
4 changed files
with
33 additions
and
4 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 |
---|---|---|
@@ -1,15 +1,18 @@ | ||
import { Project } from '@/generator/domain/Project'; | ||
import { ProjectService } from '@/generator/domain/ProjectService'; | ||
import { AxiosHttp } from '@/http/AxiosHttp'; | ||
import { RestProject, toRestProject } from '@/generator/secondary/RestProject'; | ||
|
||
export default class ProjectRepository implements ProjectService { | ||
constructor(private axiosHttp: AxiosHttp) {} | ||
|
||
async init(project: Project): Promise<void> { | ||
await this.axiosHttp.post('api/projects/init', project); | ||
const restProject: RestProject = toRestProject(project); | ||
await this.axiosHttp.post('api/projects/init', restProject); | ||
} | ||
|
||
async addMaven(project: Project): Promise<void> { | ||
await this.axiosHttp.post('api/build-tools/maven', project); | ||
const restProject: RestProject = toRestProject(project); | ||
await this.axiosHttp.post('api/build-tools/maven', restProject); | ||
} | ||
} |
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,9 @@ | ||
import { Project } from '@/generator/domain/Project'; | ||
|
||
export interface RestProject { | ||
folder: string; | ||
} | ||
|
||
export const toRestProject = (project: Project): RestProject => ({ | ||
folder: project.folder, | ||
}); |
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
14 changes: 14 additions & 0 deletions
14
src/test/javascript/spec/generator/secondary/RestProject.spec.ts
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,14 @@ | ||
import { RestProject, toRestProject } from '@/generator/secondary/RestProject'; | ||
import { Project } from '@/generator/domain/Project'; | ||
|
||
describe('RestProject', () => { | ||
it('should convert to Project', () => { | ||
const project: Project = { | ||
folder: 'folder', | ||
}; | ||
|
||
expect(toRestProject(project)).toEqual<RestProject>({ | ||
folder: 'folder', | ||
}); | ||
}); | ||
}); |