Skip to content

Commit

Permalink
improve route names (#121)
Browse files Browse the repository at this point in the history
  • Loading branch information
JannikStreek authored Oct 7, 2022
1 parent 1a400b4 commit 4e90389
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion teammapper-backend/src/map/controllers/maps.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { MmpMap } from '../entities/mmpMap.entity';
import { MapsService } from '../services/maps.service';
import { IMmpClientDeleteRequest, IMmpClientMap, IMmpClientMapWithAdminId } from '../types';

@Controller('maps')
@Controller('api/maps')
export default class MapsController {
constructor(private mapsService: MapsService) {}

Expand Down
4 changes: 2 additions & 2 deletions teammapper-backend/test/app.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ describe('AppController (e2e)', () => {
await app.close();
});

it('/maps/:id(GET)', async () => {
it('/api/maps/:id(GET)', async () => {
const map: MmpMap = await mapRepo.save({ name: 'test' });
await nodesRepo.save({
nodeMapId: map.id,
coordinatesX: 3,
coordinatesY: 1,
});
const response: request.Response = await request(server).get(
`/maps/${map.id}`,
`/api/maps/${map.id}`,
);
expect(response.body.uuid).toEqual(map.id);
});
Expand Down
2 changes: 1 addition & 1 deletion teammapper-frontend/src/app/core/http/http.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Injectable } from '@angular/core'
*/
export enum API_URL {
LOCAL_ASSETS = './assets/data/',
ROOT = ''
ROOT = 'api'
}

@Injectable({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export class ShortcutsService {
description: 'TOOLTIPS.NEW_MAP',
callback: () => {
// use a full page reload here to reload all singleton services
window.location.replace('/app')
window.location.replace('/map')
}
}, {
keys: 'c',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ <h4 mat-line>{{ "PAGES.ABOUT.INTRODUCTION.APPLICATION_PROPERTIES.3" | translate
</mat-list>
</div>

<a color="accent" mat-flat-button routerLink="/app">
<a color="accent" mat-flat-button routerLink="/map">
{{ "GENERAL.TRY_IT" | translate }}
</a>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<mat-toolbar>
<a href="/app" target="_blank">
<a href="/map" target="_blank">
<button [title]="'TOOLTIPS.NEW_MAP' | translate"
color="primary" mat-icon-button>
<mat-icon>note_add</mat-icon>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export class ApplicationComponent implements OnInit {
const attachedMap = this.mapSyncService.getAttachedMap()

if (!givenId) {
history.replaceState({}, '', `/mmp/${attachedMap.cachedMap.uuid}`)
history.replaceState({}, '', `/map/${attachedMap.cachedMap.uuid}`)
}

this.node = this.mmpService.selectNode(this.mmpService.getRootNode().id)
Expand Down
6 changes: 6 additions & 0 deletions teammapper-frontend/src/app/root-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ import { RouterModule, Routes } from '@angular/router'
const routes: Routes = [{
path: '',
loadChildren: () => import('./modules/about/about.module').then(m => m.AboutModule)
}, {
path: 'map',
loadChildren: () => import('./modules/application/application.module').then(m => m.ApplicationModule)
}, {
path: 'map/:id',
loadChildren: () => import('./modules/application/application.module').then(m => m.ApplicationModule)
}, {
path: 'app',
loadChildren: () => import('./modules/application/application.module').then(m => m.ApplicationModule)
Expand Down
2 changes: 1 addition & 1 deletion teammapper-frontend/src/proxy.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"secure": false,
"changeOrigin": true
},
"/maps/*": {
"/api/*": {
"target": "http://localhost:3000",
"secure": false,
"changeOrigin": true
Expand Down

0 comments on commit 4e90389

Please sign in to comment.