Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: fairnesscoop/permacoop
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: ea50c883989d0fcedf6cb84abdb0e9d67dd8b1a6
Choose a base ref
..
head repository: fairnesscoop/permacoop
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 2493ecd1ea79d731f5857ebfac2195240a37738f
Choose a head ref
Original file line number Diff line number Diff line change
@@ -40,7 +40,9 @@ export class DeleteEventController {
@Res() res: Response
) {
try {
const event: EventView = await this.queryBus.execute(new GetEventByIdQuery(dto.id));
const event: EventView = await this.queryBus.execute(
new GetEventByIdQuery(dto.id)
);
await this.commandBus.execute(new DeleteEventCommand(dto.id, user));
res.redirect(303, makeMonthUrl(this.resolver, new Date(event.date)));
} catch (e) {
Original file line number Diff line number Diff line change
@@ -42,7 +42,7 @@ export class EditEventController {
@Inject('IQueryBus')
private readonly queryBus: IQueryBus,
private readonly resolver: RouteNameResolver
) { }
) {}

@Get(':id')
@WithName('faircalendar_events_edit')
@@ -102,7 +102,9 @@ export class EditEventController {
)
);

const event: EventView = await this.queryBus.execute(new GetEventByIdQuery(idDto.id));
const event: EventView = await this.queryBus.execute(
new GetEventByIdQuery(idDto.id)
);

res.redirect(303, makeMonthUrl(this.resolver, new Date(event.date)));
} catch (e) {
4 changes: 2 additions & 2 deletions src/Infrastructure/FairCalendar/Routing/urls.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { RouteNameResolver } from "src/Infrastructure/Common/ExtendedRouting/RouteNameResolver";
import { RouteNameResolver } from 'src/Infrastructure/Common/ExtendedRouting/RouteNameResolver';

export function makeMonthUrl(resolver: RouteNameResolver, date: Date): string {
const url = resolver.resolve('faircalendar_index');

const params = new URLSearchParams({
month: (date.getMonth() + 1).toString(),
year: (date.getFullYear()).toString(),
year: date.getFullYear().toString()
});

return url + '?' + params.toString();