-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEventController.ts
More file actions
39 lines (34 loc) · 1.15 KB
/
EventController.ts
File metadata and controls
39 lines (34 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import {
CurrentUser,
Get,
JsonController,
Param,
QueryParam,
} from "routing-controllers";
import { UserModel } from "../../models/UserModel";
import { EventTagModel } from "../../models/EventTagModel";
import { EventService } from "../../services/EventService";
import { EventPostSource, GetEventPostsResponse } from "../../types";
@JsonController("event/")
export class EventController {
private eventService: EventService;
constructor(eventService: EventService) {
this.eventService = eventService;
}
@Get("available-for-tagging/")
async getAvailableEventTags(
@CurrentUser() user: UserModel,
): Promise<EventTagModel[]> {
return this.eventService.getAvailableEventTags();
}
@Get(":eventTagId/posts/")
async getEventPosts(
@CurrentUser() user: UserModel,
@Param("eventTagId") eventTagId: string,
@QueryParam("page", { required: false }) page: number = 1,
@QueryParam("limit", { required: false }) limit: number = 10,
@QueryParam("source", { required: false }) source?: EventPostSource,
): Promise<GetEventPostsResponse> {
return this.eventService.getEventPosts(user, eventTagId, page, limit, source);
}
}