34 lines
859 B
TypeScript
34 lines
859 B
TypeScript
import { Controller, Get, Query, Req } from '@nestjs/common';
|
|
import { PostsService } from './posts.service';
|
|
|
|
@Controller('posts')
|
|
export class PostsController {
|
|
constructor(private readonly postsService: PostsService) {}
|
|
|
|
@Get()
|
|
getFeed(
|
|
@Req() req,
|
|
@Query('take') take?: string,
|
|
@Query('cursorId') cursorId?: string,
|
|
) {
|
|
return this.postsService.getFeed(req.user.id, {
|
|
mode: 'mixed',
|
|
take: take ? Number(take) : undefined,
|
|
cursorId: cursorId ? Number(cursorId) : undefined,
|
|
});
|
|
}
|
|
|
|
@Get('discovery')
|
|
getDiscovery(
|
|
@Req() req,
|
|
@Query('take') take?: string,
|
|
@Query('cursorId') cursorId?: string,
|
|
) {
|
|
return this.postsService.getFeed(req.user.id, {
|
|
mode: 'discovery',
|
|
take: take ? Number(take) : undefined,
|
|
cursorId: cursorId ? Number(cursorId) : undefined,
|
|
});
|
|
}
|
|
}
|