Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
e9a3d03
Setup NestJS with nunjucks templates
florimondmanca Sep 15, 2023
157d599
Add login page
florimondmanca Sep 15, 2023
76bf8e9
Implement session-based auth
florimondmanca Sep 15, 2023
bfef892
Add e2e tests using Playwright
florimondmanca Sep 16, 2023
261324d
Add app shell, add named routes
florimondmanca Sep 16, 2023
54f9504
Add translations w/ Fluent, implement basic FairCalendar, fixes
florimondmanca Sep 16, 2023
bedffbf
Modularize CSS; update format/check
florimondmanca Sep 21, 2023
4fde229
Rework templates and css
florimondmanca Sep 21, 2023
cfcee3b
Tweaks, add proper RouteNameResolver
florimondmanca Sep 21, 2023
2c221e9
Add styles to select
florimondmanca Sep 21, 2023
a518cc2
Begin Faircalendar filters, add esbuild watch
florimondmanca Sep 22, 2023
89d8588
Add customer table and add form
florimondmanca Sep 22, 2023
2266568
Add customer edit, update nav
florimondmanca Sep 22, 2023
20f27b1
Drop Stimulus, use Web Component for FairCalendar
florimondmanca Sep 22, 2023
f6faa03
Add projects, generic table API
florimondmanca Sep 22, 2023
28aa0c0
Add breadcrumbs
florimondmanca Sep 22, 2023
9252a75
Add tasks, refactor templates per resource
florimondmanca Sep 22, 2023
9788c04
Rework home and login routing
florimondmanca Sep 22, 2023
f23e366
Remove File
florimondmanca Sep 22, 2023
7072be9
Add EditProfileController
florimondmanca Sep 22, 2023
1cfb4c8
Add user management, rework fullName
florimondmanca Sep 22, 2023
84e7a56
Tweak margins, tweak calendar, tweak dark mode
florimondmanca Sep 22, 2023
ddb4bfa
Fix tests, add more e2e tests, update README
florimondmanca Sep 22, 2023
9bd5f8b
Drop client/kit and client/proxy
florimondmanca Sep 22, 2023
af477dd
Restructure CSS, standardize buttons and links, rework nav, header, d…
florimondmanca Sep 26, 2023
ba9087a
Add leaves, add leave requests, add holidays to FairCalendar
florimondmanca Sep 26, 2023
44eb1ec
Add PayrollElements pages, rework Table implementation to reuse logic…
florimondmanca Sep 27, 2023
deba484
Add meal tickets pages, remove obsolete actions
florimondmanca Sep 27, 2023
823a1ad
Bring back calendar ICS export, add calendar url widget
florimondmanca Sep 27, 2023
079b8fe
Add calendar overview
florimondmanca Sep 28, 2023
1bc0a9d
Add dynamic faircalendar filters, rework faircalendar layout
florimondmanca Sep 28, 2023
261d276
Implement mobile menu v1
florimondmanca Oct 6, 2023
1f50b90
Improve mobile menu
florimondmanca Oct 11, 2023
3dc2655
More improvements and reorg
florimondmanca Oct 11, 2023
b71875f
Implement theme toggler
florimondmanca Oct 11, 2023
fdeb750
Clean up CSS
florimondmanca Oct 11, 2023
8509d30
Drop legacy client
florimondmanca Oct 11, 2023
b297313
Load FairCalendar JS only on FairCalendar page
florimondmanca Oct 11, 2023
e973014
Make mobile navbar fill entire height
florimondmanca Oct 11, 2023
9bd0574
Rework nav impl, add todos
florimondmanca Oct 12, 2023
f9b82eb
Fix unit tests
florimondmanca Oct 12, 2023
4268a8e
Implement multi-days faircalendar events
florimondmanca Oct 12, 2023
171e869
Replace FullCalendar by EventCalendar
florimondmanca Oct 13, 2023
b885387
Fix e2e tests
florimondmanca Oct 13, 2023
00aebe9
Fix: bring back clickable event
florimondmanca Oct 13, 2023
dc5b339
Show/hide mission fields, bring back faircalendar day click
florimondmanca Oct 13, 2023
f418a9c
Tweak turbolite, remove fullcalendar.js
florimondmanca Oct 24, 2023
64eb181
Switch to public .env + private .env.local
florimondmanca Oct 24, 2023
02152ae
Add Jelastic manifest
florimondmanca Oct 27, 2023
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
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ jobs:
with:
node-version: 16
cache: 'npm'
cache-dependency-path: client/kit/package-lock.json
cache-dependency-path: server/package-lock.json

- uses: actions/cache@v2
with:
path: ~/.cache/ms-playwright
key: ${{ runner.os }}-node-${{ hashFiles('**/client/kit/package-lock.json') }}
key: ${{ runner.os }}-node-${{ hashFiles('**/server/package-lock.json') }}

- name: Tests
run: make ci
Expand Down
5 changes: 0 additions & 5 deletions .scrutinizer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,3 @@ build:
tests:
override:
- js-scrutinizer-run
filter:
excluded_paths:
- 'client/legacy/static'
- 'client/legacy/src/store'
- 'client/kit/static'
8 changes: 0 additions & 8 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,6 @@
"eslint.format.enable": true,
"eslint.lintTask.enable": true,
"eslint.workingDirectories": [
{
"directory": "./client/legacy",
"changeProcessCWD": true
},
{
"directory": "./client/kit",
"changeProcessCWD": true
},
{
"directory": "./server",
"changeProcessCWD": true
Expand Down
170 changes: 37 additions & 133 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,71 +3,29 @@ help:

compose = docker-compose -p permacoop

# See color codes here: http://jafrog.com/2013/11/23/colors-in-terminal.html
run_api = ./tools/colorize_prefix.sh [api] 30
run_client_legacy = ./tools/colorize_prefix.sh [client:legacy] 31
run_client_legacy_tailwind = ./tools/colorize_prefix.sh [client:legacy:tailwind] "38;5;52"
run_client_kit = ./tools/colorize_prefix.sh [client:kit] "38;5;202"
run_client_proxy = ./tools/colorize_prefix.sh [client:proxy] 32

client_proxy_port = 3001
client_legacy_port = 3002
client_kit_port = 3003

install: ## Install API and client
make install-api
make install-client
ifneq ($(ANSIBLE),1)
make install-dev
endif

install-api: ## Install API
cp -n server/.env.dist server/.env
cd server && npm ci

install-client: install-client-legacy install-client-kit install-client-proxy ## Install client

install-client-legacy: ## Install legacy client
cp -n client/legacy/.env.dist client/legacy/.env
cd client/legacy && npm ci
run_server = ./tools/colorize_prefix.sh [server] 31
run_watch = ./tools/colorize_prefix.sh [watch] 36

install-client-kit: ## Install SvelteKit client
cd client/kit && npm ci
install: ## Install
make install-deps
make install-dev

install-client-proxy: ## Install client proxy
cd client/proxy && npm ci

install-client-e2e: ## Install E2E client dependencies
cd client/kit && npx playwright install firefox
install-deps: ## Install dependencies
cd server && npm ci

install-dev: ## Install local development dependencies and services
make up
cd server && npx playwright install firefox
make build
make database-test-init

start: ## Start containers, API and client
make up
make -j 2 start-api start-client

start-api: ## Run API
${run_api} "cd server && npm run start:dev"

start-client: ## Run client
make -j 3 start-client-legacy start-client-kit start-client-proxy

start-client-legacy: ## Run legacy client
make -j 2 start-client-legacy-dev start-client-legacy-tailwind
start: ## Start
make -j 2 start-server start-watch

start-client-legacy-dev:
PORT=${client_legacy_port} ${run_client_legacy} "cd client/legacy && npm run dev"
start-server: up
${run_server} "cd server && npm run start:dev"

start-client-legacy-tailwind:
${run_client_legacy_tailwind} "cd client/legacy && npm run watch:tailwind"

start-client-kit: ## Run SvelteKit client
PORT=${client_kit_port} ${run_client_kit} "cd client/kit && npm run dev"

start-client-proxy: ## Start client proxy
LEGACY_PORT=${client_legacy_port} KIT_PORT=${client_kit_port} PORT=${client_proxy_port} ${run_client_proxy} "cd client/proxy && npm run dev"
start-watch:
${run_watch} "cd server && npm run assets:watch"

compose: ## Run Docker compose command (args: CMD)
${compose} ${CMD}
Expand All @@ -87,108 +45,54 @@ rm: stop ## Stop and remove containers
ps: ## Show running containers
make compose CMD=ps

build: build-api build-client ## Build API and client
build: dist assets ## Build dist and assets

build-api: ## Build API dist
dist:
cd server && npm run build

build-client: build-client-legacy build-client-kit ## Build client

build-client-legacy: ## Build legacy client
cd client/legacy && npm run build

build-client-kit: ## Build SvelteKit client
cd client/kit && npm run build

start-dist: ## Serve built API and client
make -j 2 start-dist-api start-dist-client

start-dist-api: ## Serve built API
${run_api} "cd server && npm run start:prod"

start-dist-client: ## Serve built client
make -j 3 start-dist-client-legacy start-dist-client-kit start-client-proxy

start-dist-client-legacy: ## Serve built legacy client
PORT=${client_legacy_port} ${run_client_legacy} "cd client/legacy && npm run start"
assets:
cd server && npm run assets:build

start-dist-client-kit: ## Serve built client
HOST=127.0.0.1 PORT=${client_kit_port} ${run_client_kit} "cd client/kit && npm run start"
start-dist: up ## Serve built server
cd server && npm run start:prod

test: test-api test-client-unit ## Run test suite

test-api: ## Run API tests
test: ## Run tests
cd server && npm run test -- $(FILE)

test-api-watch: ## Run API tests in watch mode
test-watch: ## Run tests in watch mode
cd server && npm run test:watch

test-api-cov: ## Run API tests with coverage enabled
test-cov: ## Run tests with coverage enabled
cd server && npm run test:cov

test-client: test-client-legacy-unit test-client-kit-unit ## Run client tests

test-client-legacy-unit: ## Run legacy client unit tests
cd client/legacy && npm run test-unit

test-client-kit-unit: ## Run SvelteKit client unit tests
cd client/kit && npm run test:coverage

test-client-e2e: ## Run client E2E tests (servers must be running)
make database-seed
cd client/kit && npm run test-e2e

test-client-ci: test-client test-client-e2e-ci
test-e2e:
cd server && npx playwright test

test-client-e2e-ci: ## Run client E2E tests
make database-seed
cd client/kit && npm run test-e2e:ci

linter: linter-api linter-client ## Run linters

linter-api: ## Run API linters
linter: ## Run linters
cd server && npm run lint

linter-client: linter-client-legacy linter-client-kit ## Run client linters

linter-client-legacy: ## Run legacy client linters
cd client/legacy && npm run lint

linter-client-kit: ## Run SvelteKit client linters
cd client/kit && npm run lint

format: format-api format-client ## Run code formatting

format-api: ## Run API code formatting
format: ## Run code formatting
cd server && npm run format

format-client: format-client-kit ## Run client code formatting

format-client-kit: ## Run SvelteKit client code formatting
cd client/kit && npm run format

database-migrate: ## Database migrations
cd server && npm run migration:migrate

database-test-init: ## Initialize test database
database-test-init: up ## Initialize test database
make compose CMD="exec -T database createdb permacoop_test" || echo 'Does the test DB already exist? Ignoring...'
DATABASE_NAME=permacoop_test make database-migrate
make database-migrate DATABASE_NAME=permacoop_test
make database-seed DATABASE_NAME=permacoop_test

database-migration: ## Generate a database migration
cd server && npm run migration:generate -- migrations/$(NAME)
cd server && npm run migration:create -- migrations/$(NAME)

database-seed: ## Seed database
cd server && npm run build && npm run seed:run
cd server && npm run seed:run

database-connect: ## Connect to the database container
${compose} exec database psql -h database -d permacoop

ci: ## Run CI checks
make compose CMD="up -d"
ci: up ## Run CI checks
make install
make install-client-e2e
make build
make database-migrate
make test-api-cov
make database-test-init
make test-client-ci
make linter
make test-cov
make test-e2e CI=1
24 changes: 2 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,7 @@ This command will create the default user "John Doe" :
}
```

The server and client will be started:

- API documentation available on <http://localhost:3000/api>
- Client available on <http://localhost:3001/>
The server will be available at <http://localhost:3000>.

## Helpers

Expand All @@ -91,16 +88,10 @@ To run tests, use:
make test
```

For E2E tests, you will need to install additional dependencies first:

```bash
make install-client-e2e
```

Run E2E tests using:

```bash
make test-client-e2e
make test-e2e
```

### Code quality
Expand All @@ -125,12 +116,6 @@ To generate a migration from the current state of the code, run:
make database-migration NAME=add_some_column
```

## Security

The client must send the user `apiToken` in the Authorization header when making requests to protected resources : `Authorization: Bearer <apiToken>`

To retrieve the `apiToken`, make a post request on `/login` with a user email and password.

## Features

- Tasks management
Expand All @@ -142,11 +127,6 @@ To retrieve the `apiToken`, make a post request on `/login` with a user email an
- Leaves
- Cooperators / employee
- Savings records
- Accounting
- Quotations
- Daily rates
- Invoicing
- Contacts managment

## Credits

Expand Down
5 changes: 1 addition & 4 deletions ansible/group_vars/web.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ git_repo: "https://github.com/fairnesscoop/permacoop.git"

letsencrypt_email: "equipe@fairness.coop"

api_port: 3000
client_proxy_port: 3001
client_legacy_port: 3002
client_kit_port: 3003
server_port: 3000

domain_name: "{{ inventory_hostname }}"
17 changes: 0 additions & 17 deletions ansible/roles/web/tasks/dotenv.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,3 @@
mode: 0644
become: true

- name: Ensure legacy client .env file is up to date
template:
src: .env-client-legacy.j2
dest: "{{ workdir }}/client/legacy/.env"
owner: root
group: root
mode: 0644
become: true

- name: Ensure kit client .env.local file is up to date
template:
src: .env-client-kit.j2
dest: "{{ workdir }}/client/kit/.env.local"
owner: root
group: root
mode: 0644
become: true
19 changes: 2 additions & 17 deletions ansible/roles/web/tasks/supervisor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,8 @@
mode: 0644
become: true

- name: Ensure api is running
supervisorctl: name=api state=present
become: true
notify: reload nginx

- name: Ensure client-legacy is running
supervisorctl: name=client-legacy state=present
become: true
notify: reload nginx

- name: Ensure client-kit is running
supervisorctl: name=client-kit state=present
become: true
notify: reload nginx

- name: Ensure client-proxy is running
supervisorctl: name=client-proxy state=present
- name: Ensure server is running
supervisorctl: name=server state=present
become: true
notify: reload nginx

Expand Down
2 changes: 0 additions & 2 deletions ansible/roles/web/templates/.env-client-kit.j2

This file was deleted.

3 changes: 0 additions & 3 deletions ansible/roles/web/templates/.env-client-legacy.j2

This file was deleted.

Loading