Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .docker/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
COMPOSE_PROJECT_NAME=Filmator
Empty file modified .docker/data/.gitignore
100644 → 100755
Empty file.
20 changes: 17 additions & 3 deletions .docker/docker-compose.yml
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ services:
container_name: Database
image: mariadb:10.6.4-focal
environment:
- MYSQL_DATABASE=Filmator
- MYSQL_DATABASE=filmator
- MYSQL_ROOT_PASSWORD=root
volumes:
- ./data/db/:/var/lib/mysql:delegated
Expand All @@ -18,6 +18,20 @@ services:
working_dir: /srv
volumes:
- ./../:/srv:delegated
- ./php/php.ini:/usr/local/etc/php.ini-production

node:
container_name: Node
build:
context: ./..
dockerfile: ./.docker/node/Dockerfile
working_dir: /srv
volumes:
- ./../:/srv:delegated
ports:
- "8080:8080"
- "8888:8888"
command: [ "tail", "-f", "/dev/null" ]

nginx:
container_name: Nginx
Expand All @@ -29,7 +43,7 @@ services:
- NGINX_PHP_HOST=php
ports:
# change localhost:port here (edit left-one)
- 80:80
- 90:80

phpmyadmin:
container_name: phpMyAdmin
Expand All @@ -41,4 +55,4 @@ services:
- MYSQL_PASSWORD=root
ports:
# change database:port here (edit left-one)
- "10000:80"
- "20000:80"
Empty file modified .docker/nginx/default.conf
100644 → 100755
Empty file.
15 changes: 15 additions & 0 deletions .docker/node/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM node:16.9.1-alpine3.14

USER root

# Setup user docker
RUN adduser -S docker

WORKDIR /srv/

RUN rm -rf /srv/node_modules
RUN mkdir /srv/node_modules
RUN chown -R docker /srv/node_modules
RUN chown docker /srv/package.json

USER docker
15 changes: 13 additions & 2 deletions .docker/php/Dockerfile
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
FROM php:8.1.1-fpm-alpine3.15

USER root

# Setup user docker
RUN adduser -S docker

# Sudo
RUN apk add sudo

# Install Git
RUN apk update && apk upgrade && \
apk add git
Expand All @@ -18,12 +26,15 @@ RUN apk add --no-cache \
libwebp-dev \
freetype-dev

# As of PHP 7.4 we don't need to add --with-png
RUN docker-php-ext-configure gd --with-jpeg --with-webp --with-freetype
# Install gd
RUN apk add zlib-dev libzip libpng libjpeg-turbo libwebp freetype libpng-dev libwebp-dev libjpeg-turbo-dev freetype-dev # since PHP 7.4 don't need to add --with-png
RUN docker-php-ext-configure gd --enable-gd --with-freetype --with-jpeg --with-webp
RUN docker-php-ext-install gd

# Install PHP Intl
RUN apk add icu-dev
RUN docker-php-ext-configure intl && docker-php-ext-install intl

WORKDIR /srv/

USER docker
1 change: 1 addition & 0 deletions .docker/php/php.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
UPLOAD_MAX_FILESIZE=10M
Empty file modified .gitattributes
100644 → 100755
Empty file.
Empty file modified .github/workflows/build.yml
100644 → 100755
Empty file.
Empty file modified .gitignore
100644 → 100755
Empty file.
Empty file modified LICENSE.txt
100644 → 100755
Empty file.
9 changes: 9 additions & 0 deletions Makefile
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@ logs:
exec\:php:
docker-compose -f .docker/docker-compose.yml exec php sh;

# Exec sh on Node container
exec\:node:
docker-compose -f .docker/docker-compose.yml exec node sh;

setup:
docker-compose -f .docker/docker-compose.yml exec php composer install;
docker-compose -f .docker/docker-compose.yml exec node npm install;
make init

init:
docker-compose -f .docker/docker-compose.yml exec php composer install;
docker-compose -f .docker/docker-compose.yml exec php bin/console orm:schema-tool:drop --force --full-database;
Expand Down
Empty file modified README.md
100644 → 100755
Empty file.
Empty file modified app/Bootstrap.php
100644 → 100755
Empty file.
23 changes: 23 additions & 0 deletions app/Model/Database/Entity/AbstractListEntity.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

declare(strict_types=1);

namespace App\Model\Database\Entity;

use Doctrine\ORM\Mapping as ORM;

abstract class AbstractListEntity
{

#[ORM\Id]
#[ORM\GeneratedValue(strategy: "AUTO")]
#[ORM\Column(type: "integer", nullable: false)]
protected int $id;


public function getId(): int
{
return $this->id;
}

}
54 changes: 15 additions & 39 deletions app/Model/Database/Entity/ActorEntity.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,40 @@

namespace App\Model\Database\Entity;

use DateTime;
use App\Model\Trait\hasCreatedAt;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Nette\Utils\Strings;

#[ORM\Entity]
#[ORM\Table(name: "actor")]
final class ActorEntity
class ActorEntity extends AbstractListEntity
{

#[ORM\Id]
#[ORM\GeneratedValue(strategy: "AUTO")]
#[ORM\Column(type: "integer", nullable: false)]
protected int $id;
use hasCreatedAt;

#[ORM\Column(type: "string", nullable: false)]
protected string $slug;

#[ORM\Column(type: "string", nullable: false)]
protected string $name;
private const IMAGE_PATH = "img/fixture/actor/";


#[ORM\Column(type: "string", nullable: false)]
protected string $imagePoster;
protected string $slug;

#[ORM\Column(type: "string", nullable: false)]
protected string $imageBanner;
protected string $name;

/** @var Collection<int, UserEntity> */
#[ORM\ManyToMany(targetEntity: UserEntity::class, mappedBy: "likeActor")]
#[ORM\JoinTable(name: "like_actor")]
protected Collection $likeUser;


public function getId(): int
public function __construct(string $name)
{
return $this->id;
$this->name = $name;
$this->slug = Strings::webalize($name);
$this->createdAt = new DateTime();
}


Expand All @@ -45,45 +45,21 @@ public function getSlug(): string
}


public function setSlug(string $slug): void
{
$this->slug = $slug;
}


public function getName(): string
{
return $this->name;
}


public function setName(string $name): void
{
$this->name = $name;
}


public function getImagePoster(): string
{
return $this->imagePoster;
}


public function setImagePoster(string $imagePoster): void
{
$this->imagePoster = $imagePoster;
return self::IMAGE_PATH . $this->getId() . "/" . $this->getId() . self::POSTER_PREFIX;
}


public function getImageBanner(): string
{
return $this->imageBanner;
}


public function setImageBanner(string $imageBanner): void
{
$this->imageBanner = $imageBanner;
return self::IMAGE_PATH . $this->getId() . "/" . $this->getId() . self::BANNER_PREFIX;
}


Expand Down
46 changes: 13 additions & 33 deletions app/Model/Database/Entity/ArticleEntity.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,22 @@
namespace App\Model\Database\Entity;

use App\Model\Enum\Admin\Content\Month\EDateMonth;
use App\Model\Enum\Admin\Content\Month\EMonthFacade;
use DateTime;
use App\Model\Trait\hasCreatedAt;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Nette\Utils\Strings;

#[ORM\Entity]
#[ORM\Table(name: "article")]
class ArticleEntity
class ArticleEntity extends AbstractListEntity
{

#[ORM\Id]
#[ORM\GeneratedValue(strategy: "AUTO")]
#[ORM\Column(type: "integer", nullable: false)]
protected int $id;
use hasCreatedAt;


private const IMAGE_PATH = "img/fixture/article/";


#[ORM\Column(type: "string", nullable: false)]
protected string $name;
Expand All @@ -27,12 +29,6 @@ class ArticleEntity
#[ORM\Column(type: "string", nullable: true)]
protected ?string $description;

#[ORM\Column(type: "string", nullable: false)]
protected string $image;

#[ORM\Column(type: "datetime", nullable: false)]
protected DateTime $createdAt;

/** @var Collection<int, UserEntity> */
#[ORM\ManyToMany(targetEntity: UserEntity::class, mappedBy: "likeArticle")]
#[ORM\JoinTable(name: "like_article")]
Expand All @@ -48,9 +44,11 @@ class ArticleEntity
protected Collection $articleLast;


public function getId(): int
public function __construct(string $name)
{
return $this->id;
$this->name = $name;
$this->slug = Strings::webalize($name);
$this->createdAt = new DateTime();
}


Expand All @@ -60,24 +58,12 @@ public function getName(): string
}


public function setName(string $name): void
{
$this->name = $name;
}


public function getSlug(): string
{
return $this->slug;
}


public function setSlug(string $slug): void
{
$this->slug = $slug;
}


public function getDescription(): ?string
{
return $this->description;
Expand All @@ -92,13 +78,7 @@ public function setDescription(?string $description): void

public function getImage(): string
{
return $this->image;
}


public function setImage(string $image): void
{
$this->image = $image;
return self::IMAGE_PATH . $this->getId() . "/" . $this->getId();
}


Expand Down
22 changes: 5 additions & 17 deletions app/Model/Database/Entity/ArticleLastEntity.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -5,41 +5,29 @@
namespace App\Model\Database\Entity;

use DateTime;
use App\Model\Trait\hasCreatedAt;
use Doctrine\ORM\Mapping as ORM;

#[ORM\Entity]
#[ORM\Table(name: "article_last")]
class ArticleLastEntity
class ArticleLastEntity extends AbstractListEntity
{
#[ORM\Id]
#[ORM\GeneratedValue(strategy: "AUTO")]
#[ORM\Column(type: "integer", nullable: false)]
protected int $id;

use hasCreatedAt;


#[ORM\ManyToOne(targetEntity: UserEntity::class, inversedBy: "userArticleLast")]
protected UserEntity $user;

#[ORM\ManyToOne(targetEntity: ArticleEntity::class, inversedBy: "articleLast")]
protected ArticleEntity $article;

#[ORM\Column(type: "datetime", nullable: false)]
protected DateTime $createdAt;


public function __construct()
{
$this->createdAt = new DateTime();
}

public function getCreatedAt(): DateTime
{
return $this->createdAt;
}

public function setCreatedAt(DateTime $createdAt): void
{
$this->createdAt = $createdAt;
}

public function getUser(): UserEntity
{
Expand Down
Loading