Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#3 - User Authentication #18

Merged
merged 34 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
1b1ee3d
- setup
EwelinaSkrzypacz Nov 13, 2024
b5a0da2
- setup
EwelinaSkrzypacz Nov 13, 2024
c4da86b
- setup
EwelinaSkrzypacz Nov 13, 2024
abaa402
- setup
EwelinaSkrzypacz Nov 13, 2024
fe63b7b
- setup
EwelinaSkrzypacz Nov 13, 2024
05ef62d
- setup
EwelinaSkrzypacz Nov 13, 2024
ccef105
- setup
EwelinaSkrzypacz Nov 13, 2024
b419468
- delete .env
EwelinaSkrzypacz Nov 26, 2024
0db10d2
- add newlines
EwelinaSkrzypacz Nov 26, 2024
80f4fcb
solved .env
Silabalkan Nov 26, 2024
a19d841
test commit
Silabalkan Nov 26, 2024
ca2d6bc
user registration created
Silabalkan Dec 2, 2024
faf1dfd
- fixed errors
EwelinaSkrzypacz Dec 2, 2024
83c6e61
registration/login are created succesfuly
Silabalkan Dec 2, 2024
637063d
- fixed errors with register; rollback previous changes because they …
EwelinaSkrzypacz Dec 2, 2024
bc8387e
solved conflicts
Silabalkan Dec 2, 2024
9cbb2bd
Remove .env file from version control
Silabalkan Dec 2, 2024
c19f8d7
cs fix
Silabalkan Dec 2, 2024
a5cac1c
- lint fix; added lintf to make fix command
EwelinaSkrzypacz Dec 2, 2024
17245b5
- trying to fix .env.ci
EwelinaSkrzypacz Dec 2, 2024
768c04d
- trying to fix .env.ci
EwelinaSkrzypacz Dec 2, 2024
6e138ad
- fix database credentials
EwelinaSkrzypacz Dec 3, 2024
43f2655
- fix tests
EwelinaSkrzypacz Dec 3, 2024
0b6d43f
- cs fix
EwelinaSkrzypacz Dec 3, 2024
cad9b05
- fix factory
EwelinaSkrzypacz Dec 3, 2024
83123ab
The last line in the .gitignore file was removed
Silabalkan Dec 3, 2024
21a737d
The .gitignore file has been fixed
Silabalkan Dec 3, 2024
2646019
Fix coding style issues
Silabalkan Dec 3, 2024
1385afb
The errors on GitHub have been fixed
Silabalkan Dec 4, 2024
76bcc43
Fix: Addressed review comments
Silabalkan Dec 5, 2024
3fac8f8
The code design issues have been resolved
Silabalkan Dec 6, 2024
804cfbb
removed empty lin
Silabalkan Dec 6, 2024
2b9e073
fixed empty line error
Silabalkan Dec 6, 2024
04ae8aa
- trying to fix errors
EwelinaSkrzypacz Dec 12, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
APP_NAME=Interns2024c
VITE_APP_NAME=Interns2024c
APP_ENV=local
APP_KEY=base64:2Yx+YiYkFm79yggZKaCdW0PGRqGFw/B7m1Ex/GX46OU=
APP_DEBUG=true
APP_URL=http://interns2024c.blumilk.localhost

APP_LOCALE=pl
APP_FALLBACK_LOCALE=en
APP_FAKER_LOCALE=pl_PL

APP_MAINTENANCE_DRIVER=file

LOG_CHANNEL=stack
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug

DB_CONNECTION=pgsql
DB_HOST=interns2024c-db-dev
DB_PORT=5432
DB_DATABASE=interns2024c
DB_USERNAME=interns2024c
DB_PASSWORD=password
DB_ROOT_PASSWORD=example

SESSION_DRIVER=database
SESSION_LIFETIME=120
SESSION_ENCRYPT=false
SESSION_PATH=/
SESSION_DOMAIN=null

BROADCAST_CONNECTION=log
FILESYSTEM_DISK=local
QUEUE_CONNECTION=database

CACHE_STORE=database
CACHE_PREFIX=

MAIL_MAILER=smtp
MAIL_HOST=mailpit
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS="[email protected]"
MAIL_FROM_NAME="${APP_NAME}"

DOCKER_APP_HOST_PORT=43851
DOCKER_DATABASE_HOST_PORT=43853
DOCKER_MAILPIT_DASHBOARD_HOST_PORT=43854
DOCKER_INSTALL_XDEBUG=true

DOCKER_HOST_USER_ID=1000
23 changes: 23 additions & 0 deletions .env.ci
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
APP_NAME=interns2024c
APP_ENV=testing
APP_KEY=base64:WVG2VcHt+a2uzCw7n1tVUBPyw2kof644d6EoYA/UUAg=
APP_DEBUG=false
APP_URL=http://interns2024c.blumilk.localhost

LOG_CHANNEL=stack
LOG_LEVEL=debug

BROADCAST_DRIVER=log
CACHE_DRIVER=array
FILESYSTEM_DISK=local
QUEUE_CONNECTION=sync
SESSION_DRIVER=array
SESSION_LIFETIME=120
MAIL_MAILER=array

DB_CONNECTION=pgsql
DB_HOST=127.0.0.1
DB_PORT=5432
DB_DATABASE=interns2024c
DB_USERNAME=interns2024c
DB_PASSWORD=password
53 changes: 53 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
APP_NAME=Interns2024c
VITE_APP_NAME=Interns2024c
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_URL=http://interns2024c.blumilk.localhost

APP_LOCALE=pl
APP_FALLBACK_LOCALE=en
APP_FAKER_LOCALE=pl_PL

APP_MAINTENANCE_DRIVER=file

LOG_CHANNEL=stack
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug

DB_CONNECTION=pgsql
DB_HOST=interns2024c-db-dev
DB_PORT=5432
DB_DATABASE=interns2024c
DB_USERNAME=interns2024c
DB_PASSWORD=password
DB_ROOT_PASSWORD=example

SESSION_DRIVER=database
SESSION_LIFETIME=120
SESSION_ENCRYPT=false
SESSION_PATH=/
SESSION_DOMAIN=null

BROADCAST_CONNECTION=log
FILESYSTEM_DISK=local
QUEUE_CONNECTION=database

CACHE_STORE=database
CACHE_PREFIX=

MAIL_MAILER=smtp
MAIL_HOST=mailpit
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS="[email protected]"
MAIL_FROM_NAME="${APP_NAME}"

DOCKER_APP_HOST_PORT=43851
DOCKER_DATABASE_HOST_PORT=43853
DOCKER_MAILPIT_DASHBOARD_HOST_PORT=43854
DOCKER_INSTALL_XDEBUG=true

DOCKER_HOST_USER_ID=1000
11 changes: 11 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
* text=auto eol=lf

*.blade.php diff=html
*.css diff=css
*.html diff=html
*.md diff=markdown
*.php diff=php

/.github export-ignore
CHANGELOG.md export-ignore
.styleci.yml export-ignore
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@EwelinaSkrzypacz
12 changes: 12 additions & 0 deletions .github/workflows/check-pr-title.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Check PR Title
on:
pull_request:
branches: [ "main" ]
types: [opened, edited, synchronize, ready_for_review, reopened]

jobs:
check-pr-title:
name: Check PR title
runs-on: ubuntu-latest
steps:
- uses: blumilksoftware/action-pr-title@e05fc76a1cc45b33644f1de51218be43ac121dd0 # v1.2.0 # https://github.com/blumilksoftware/action-pr-title
40 changes: 40 additions & 0 deletions .github/workflows/test-and-lint-js.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Test & lint JS codebase

on:
pull_request:
branches: [ "main" ]
types: [opened, synchronize, reopened, ready_for_review]
paths:
- '**.js'
- '**.ts'
- '**.vue'
- 'package.json'
- 'package.lock'

jobs:
test-and-lint-js:
name: Test & lint JS codebase
timeout-minutes: 10
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 # https://github.com/actions/checkout

- name: Cache dependencies
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 # https://github.com/actions/cache
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@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4 # https://github.com/actions/setup-node
with:
node-version: 21

- name: Instal npm dependencies
run: npm clean-install

- name: Run JS linter
run: npm run lint
66 changes: 66 additions & 0 deletions .github/workflows/test-and-lint-php.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Test & lint PHP codebase

on:
pull_request:
branches: [ "main" ]
types: [opened, synchronize, reopened, ready_for_review]
paths:
- '**.php'
- 'composer.json'
- 'composer.lock'
- 'phpunit.xml'
- 'env.ci'

jobs:
test-and-lint-php:
name: Test & lint PHP codebase
timeout-minutes: 10
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
services:
pgsql:
image: postgres:16.3-alpine3.18@sha256:64e18e8fb3e9c9aac89ac590c5dd8306b862478404f76cd9b5f7720d012b4c47 # https://hub.docker.com/_/postgres
env:
POSTGRES_DB: interns2024b
POSTGRES_USER: interns2024b
POSTGRES_PASSWORD: password
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 3s
--health-timeout 3s
--health-retries 5
ports:
- 5432:5432

steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 # https://github.com/actions/checkout

- name: Validate composer.json and composer.lock
run: composer validate

- name: Cache dependencies
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 # https://github.com/actions/cache
with:
path: vendor
key: ${{ runner.os }}-composer-dependencies-${{ hashFiles('composer.lock') }}
restore-keys: ${{ runner.os }}-composer-dependencies

- name: Setup PHP
uses: shivammathur/setup-php@c541c155eee45413f5b09a52248675b1a2575231 # 2.31.1 # https://github.com/shivammathur/setup-php
with:
php-version: 8.3
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, pdo_pgsql, intl
coverage: none

- name: Install Composer dependencies
run: composer install --prefer-dist --no-interaction

- name: Run PHP linter
run: composer cs

- name: Copy .env
run: cp .env.ci .env

- name: Execute tests
run: php artisan test --env=ci
23 changes: 23 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/.phpunit.cache
/node_modules
/public/build
/public/hot
/public/storage
/storage/*.key
/storage/pail
/vendor
.env
.env.backup
.env.production
.phpactor.json
.phpunit.result.cache
Homestead.json
Homestead.yaml
auth.json
npm-debug.log
yarn-error.log
/.fleet
/.idea
/.vscode
/.zed
.php-cs-fixer.cache
66 changes: 66 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
export COMPOSE_DOCKER_CLI_BUILD = 1
export DOCKER_BUILDKIT = 1

include .env

SHELL := /bin/bash

DOCKER_COMPOSE_FILE = docker-compose.yaml
DOCKER_COMPOSE_APP_CONTAINER = app
DOCKER_COMPOSE_DATABASE_CONTAINER = database

CURRENT_USER_ID = $(shell id --user)
CURRENT_USER_GROUP_ID = $(shell id --group)
CURRENT_DIR = $(shell pwd)

DATABASE_USERNAME=interns2024c
TEST_DATABASE_NAME=interns2024c-test

init: check-env-file
@make build \
&& make run \
&& docker compose --file ${DOCKER_COMPOSE_FILE} exec --user "${CURRENT_USER_ID}:${CURRENT_USER_GROUP_ID}" ${DOCKER_COMPOSE_APP_CONTAINER} bash "./environment/dev/scripts/init.sh" \
&& make create-test-db

check-env-file:
@if [ ! -f ".env" ]; then \
echo "Create .env file and adjust." ;\
exit 1;\
fi; \

build:
@docker compose --file ${DOCKER_COMPOSE_FILE} build --pull

run:
@docker compose --file ${DOCKER_COMPOSE_FILE} up --detach

stop:
@docker compose --file ${DOCKER_COMPOSE_FILE} stop

restart: stop run

shell:
@docker compose --file ${DOCKER_COMPOSE_FILE} exec --user "${CURRENT_USER_ID}:${CURRENT_USER_GROUP_ID}" ${DOCKER_COMPOSE_APP_CONTAINER} bash

shell-root:
@docker compose --file ${DOCKER_COMPOSE_FILE} exec ${DOCKER_COMPOSE_APP_CONTAINER} bash

test:
@docker compose --file ${DOCKER_COMPOSE_FILE} exec --user "${CURRENT_USER_ID}:${CURRENT_USER_GROUP_ID}" ${DOCKER_COMPOSE_APP_CONTAINER} composer test

fix:
@docker compose --file ${DOCKER_COMPOSE_FILE} exec --user "${CURRENT_USER_ID}:${CURRENT_USER_GROUP_ID}" ${DOCKER_COMPOSE_APP_CONTAINER} bash -c 'composer csf'

analyse:
@docker compose --file ${DOCKER_COMPOSE_FILE} exec --user "${CURRENT_USER_ID}:${CURRENT_USER_GROUP_ID}" ${DOCKER_COMPOSE_APP_CONTAINER} bash -c 'composer analyse'

dev:
@docker compose --file ${DOCKER_COMPOSE_FILE} exec --user "${CURRENT_USER_ID}:${CURRENT_USER_GROUP_ID}" ${DOCKER_COMPOSE_APP_CONTAINER} bash -c 'npm run dev'

queue:
@docker compose --file ${DOCKER_COMPOSE_FILE} exec --user "${CURRENT_USER_ID}:${CURRENT_USER_GROUP_ID}" ${DOCKER_COMPOSE_APP_CONTAINER} php artisan queue:work

create-test-db:
@docker compose --file ${DOCKER_COMPOSE_FILE} exec ${DOCKER_COMPOSE_DATABASE_CONTAINER} bash -c 'createdb --username=${DATABASE_USERNAME} ${TEST_DATABASE_NAME} &> /dev/null && echo "Created database for tests (${TEST_DATABASE_NAME})." || echo "Database for tests (${TEST_DATABASE_NAME}) exists."'

.PHONY: init check-env-file build run stop restart shell shell-root test fix create-test-db queue analyse dev
Loading