<repo_name>Smokbomb/videolist<file_sep>/README.md
## Installation

Step 1 docker build -t videolist .

Step 2 docker run -d -p 3000:3000 videolist




<file_sep>/src/socket/events/events.gateway.ts
import {
    SubscribeMessage,
    WebSocketGateway,
    WebSocketServer,
    WsResponse,
} from '@nestjs/websockets';
import { from, Observable } from 'rxjs';
import { map } from 'rxjs/operators';
// import { VideoService } from 'video/video.service';

@WebSocketGateway()
export class EventsGateway {
    // constructor(private readonly videoService: VideoService) { }
    // @WebSocketServer() server;

    // @SubscribeMessage('video')
    // async getVideo(client, id: string): WsResponse<any> {
    //     await this.videoService.updateLike(id);
    //     return await { 'video': await this.videoService.findAll() };
    // }
}<file_sep>/src/video/video.controller.ts
import { Controller, Get, Post, Body, Param } from '@nestjs/common';
import { VideoService } from './video.service';

@Controller('video')
export class VideoController {
    constructor(private readonly videoService: VideoService) { }

    @Get()
     async findAll(): Promise<any[]> {
        return await this.videoService.findAll();
    }
    @Get(':id')
    findName(@Param() params) {
        return this.videoService.findById(params.id);
    }
    @Post()
    savePhoto(@Body() body) {
        if (body.like === '1') {
            this.videoService.updateLike(body.id);
        }
        if (body.view === '1') {
            this.videoService.updateView(body.id);
        }
    }
}
