b310-digital / b310-digital/teammapper

WIP: Refactoring ideas collection

Open
#137 0 comments 0 reactions 0 assignees View on GitHub
refactoring
Dominant language
TypeScript
Stars
496
Forks
41
Avg merge
2h 16m
Merged PRs (30d)
11

Description

# Refactoring ideas

## Frontend
- [ ] Mmp data types include non mmp related entities, like deletedAt => remove those from mmp types
- [ ] Change flow of application: Async request to create the map, then redirect to the map.
- [ ] Make a guard out of the admin id check in the gateway
- [ ] Make use of a transaction for updateMap call in mapService. Currently, existing nodes are deleted before the json is imported. Thats fine but should be wrapped inside a transaction block. Otherwise the import fails and the map is completly empty.
- [ ] Refactor file download logic, use `window.URL.createObjectURL` and try to to remove fakeLink, e.g. by using `open`
```
public static downloadFile(name: string, content: string) {
const fakeLink = document.createElement('a');

const blob=new Blob([content]);
const objectUrl = window.URL.createObjectURL(blob);

fakeLink.href = objectUrl;
fakeLink.download = name;

document.body.appendChild(fakeLink);

fakeLink.click();

window.URL.revokeObjectURL(objectUrl)
document.body.removeChild(fakeLink);
}
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Choose one unchecked item rather than treating this collection as a single change. Start by locating the named entry points—mapService.updateMap, the gateway admin ID check, or the file download logic—and confirm the current behavior before changing it. Done means one focused refactor is completed without altering the intended application behavior and its relevant checks pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
backend, frontend
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.