Skip to content
This repository has been archived by the owner on Feb 1, 2023. It is now read-only.

Commit

Permalink
Merge branch 'main' into #89-unit-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Anna-Sokolowska committed May 7, 2022
2 parents bd8c792 + b24753d commit 8120c8d
Show file tree
Hide file tree
Showing 70 changed files with 1,051 additions and 23,699 deletions.
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ CURRENT_UID=root
INSTALL_XDEBUG=false

EXTERNAL_PHP_PORT=80
EXTERNAL_NODE_PORT=3000
EXTERNAL_REDIS_PORT=6379

GOOGLE_CLIENT_ID=""
GOOGLE_CLIENT_SECRET=""
Expand Down
21 changes: 21 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
module.exports = {
env: {
browser: true,
es2021: true
},
extends: [
'standard',
'eslint:recommended'
],
parserOptions: {
ecmaVersion: 12,
sourceType: 'module'
},
rules: {
semi: [2, 'never'],
quotes: ['error', 'single'],
indent: ['error', 2],
'comma-dangle': ['error', 'always-multiline'],
'object-curly-spacing': ['error', 'always'],
}
}
31 changes: 31 additions & 0 deletions .github/workflows/js.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Lint JS stuff

on:
pull_request:
branches: [ "main" ]

jobs:
test-and-lint-js:
name: Lint JS stuff
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v2

- name: Cache dependencies
uses: actions/cache@v2
with:
path: node_modules
key: ${{ runner.os }}-npm-dependencies-${{ hashFiles('package.lock') }}
restore-keys: ${{ runner.os }}-npm-dependencies

- name: Set up node
uses: actions/setup-node@v2
with:
node-version: 16

- name: Instal npm dependencies
run: npm install

- name: Run JS linter
run: npm run eslint
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@ storage/redis/dump.rdb
.editorconfig
/storage/src/*
composer.lock
package-lock.json
yarn.lock
11 changes: 11 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,19 @@ sqlite-create: ## Create file for sqlite
key-generate: ## Create key for artisan
docker-compose exec php php artisan key:generate

node-bash: ## Enter to bash a container node
docker-compose exec node bash

node-install: ## Install all dep for node
docker-compose exec node npm install

node-build: ## Build frontend for node
docker-compose exec node npm run dev

init: ## First setup for project
$(MAKE) install
$(MAKE) node-install
$(MAKE) node-build
$(MAKE) sqlite-create
$(MAKE) start
$(MAKE) key-generate
Expand Down
1 change: 1 addition & 0 deletions config/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,6 @@
"Auth" => Illuminate\Support\Facades\Auth::class,
"Constants" => Blumilk\Meetup\Core\Models\Utils\Constants::class,
"AvailableNewsletter" => Blumilk\Meetup\Core\Enums\AvailableNewsletter::class,
"Str" => Illuminate\Support\Str::class,
],
];
1 change: 1 addition & 0 deletions config/database.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"url" => env("DATABASE_URL"),
"database" => env("DB_DATABASE", database_path("database.sqlite")),
"prefix" => "",
"exec" => "PRAGMA foreign_keys = ON;",
],
"mysql" => [
"driver" => "mysql",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ public function up(): void
$table->id();
$table->foreignId("user_id")->constrained()->onDelete("cascade");
$table->foreignId("organization_id")->nullable()->constrained()->onDelete("set null");
$table->foreignId("speaker_id")->nullable()->constrained()->onDelete("set null");
$table->string("title");
$table->text("description")->nullable();
$table->dateTime("date");
Expand Down
26 changes: 26 additions & 0 deletions database/migrations/2022_03_18_195003_create_news_table.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

declare(strict_types=1);

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class() extends Migration {
public function up(): void
{
Schema::create("news", function (Blueprint $table): void {
$table->id();
$table->foreignId("author_id")->constrained()->onDelete("cascade");
$table->string("title");
$table->longText("text");
$table->string("slug")->unique();
$table->timestamps();
});
}

public function down(): void
{
Schema::dropIfExists("news");
}
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

declare(strict_types=1);

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class() extends Migration {
public function up(): void
{
Schema::create("meetup_speaker", function (Blueprint $table): void {
$table->id();
$table->foreignId("meetup_id")->constrained()->onDelete("cascade");
$table->foreignId("speaker_id")->constrained()->onDelete("cascade");
});
}

public function down(): void
{
Schema::dropIfExists("meetup_speaker");
}
};
7 changes: 3 additions & 4 deletions database/seeders/DummyDataSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
use Blumilk\Meetup\Core\Models\User;
use Illuminate\Database\Seeder;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\Hash;

class DummyDataSeeder extends Seeder
{
Expand All @@ -20,7 +19,7 @@ public function run(): void
$user = User::factory([
"name" => "Admin",
"email" => "[email protected]",
"password" => Hash::make("password"),
"password" => "password",
"email_verified_at" => Carbon::createFromDate(2022, 01, 01),
])->create();

Expand All @@ -30,9 +29,9 @@ public function run(): void
foreach ($speakers as $speaker) {
Meetup::factory()->create([
"user_id" => $user,
"speaker_id" => $speakers->random(),
"organization_id" => $organizations->random(),
]);
])->speakers()->attach($speakers->random());

OrganizationProfile::factory()->create([
"organization_id" => $organizations->random(),
]);
Expand Down
13 changes: 11 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,21 @@ services:
image: 'redis:6'
command: redis-server --appendonly yes --requirepass "${REDIS_PASSWORD}"
ports:
- ${REDIS_PORT}:6379
- ${EXTERNAL_REDIS_PORT}:6379
volumes:
- ./storage/redis:/data
networks:
- meetup-dev

node:
image: "node:14"
tty: true
ports:
- ${EXTERNAL_NODE_PORT}:3000
working_dir: /src
volumes:
- ./:/src
networks:
- meetup-dev
networks:
meetup-dev:
driver: bridge
Loading

0 comments on commit 8120c8d

Please sign in to comment.