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

Big upgrade and merge of PR #570

Draft
wants to merge 102 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
102 commits
Select commit Hold shift + click to select a range
79334a2
Added Slack support. New class and new templates, both based off the …
Mar 29, 2018
dda281b
Removed any specific development data. Added instructions to settings…
Mar 29, 2018
39e7fbc
Merge branch 'slack'
Mar 29, 2018
e69898a
Correct config file. Remove unecessary comments and console.logs. Res…
Mar 29, 2018
a99ea32
Restore app config original parameters. Clean up code on email.js fil…
Mar 29, 2018
84b5061
Restore original fake email address on app config. Restoring spacing …
Mar 29, 2018
cdbe2af
Removed the DB migration and instead added the new slack_username fie…
Apr 2, 2018
7279661
Correct location of promise_reset_password_slack call.
Apr 2, 2018
9330f81
Add slack_username to the index vector correctly on the CSV importer.
Apr 2, 2018
1748cc3
Set 'send_slacks' config flag to false as default.
Apr 2, 2018
8c92c83
Changed slack_username column in Users to allow nulls to facilitate i…
Apr 2, 2018
f96c996
Fixed and added missing titles to all the pages.
Apr 3, 2018
685d875
add google auth provider
simllll Apr 11, 2018
617a9d2
cleanup
simllll Apr 11, 2018
2080c53
check for mail
simllll Apr 11, 2018
48e248a
only need mail
simllll Apr 11, 2018
1ef3836
use prepare for session
simllll Apr 11, 2018
33966a5
add some logging and fix domain check
simllll Apr 11, 2018
a07c2f2
library update and some rewrites
simllll Apr 11, 2018
dd3cff6
let's how the automatic tests perform...
simllll Apr 12, 2018
3b95cc6
leave request check for user
simllll Apr 12, 2018
6af80a9
leave request check for user
simllll Apr 12, 2018
e2cd897
smtp
simllll Apr 12, 2018
f4a1a97
smtp
simllll Apr 12, 2018
e2ef64f
email?=
simllll Apr 12, 2018
c57fe7c
email?=
simllll Apr 12, 2018
045fbab
email?=
simllll Apr 12, 2018
fdad5f0
email?=
simllll Apr 12, 2018
7a7c105
email?=
simllll Apr 12, 2018
97f4a64
email?=
simllll Apr 12, 2018
7ea4407
asnyc mails
simllll Apr 12, 2018
6ad7796
fix merge
simllll Apr 17, 2018
f8bff38
merged title and slack PR (by Morthor)
simllll Apr 17, 2018
9954b59
rm logs
simllll Apr 17, 2018
dde1ea7
revert calendar
simllll Apr 17, 2018
99d9557
simple anniversary calendar: added json output as comment in ical for…
simllll Jan 23, 2019
9c4c0e3
mysql2 as optional dep
simllll Jan 23, 2019
9521eae
sqlite3 to optional dep
simllll Jan 23, 2019
3615d59
add Anniversaries calendar link
simllll Jan 23, 2019
632be22
format all js files with prettier
simllll May 2, 2019
c9352b3
[WIP] upgrade express to 4.x, sequelize to 5.x,.. and more
simllll May 2, 2019
fa30ac2
[WIP] refactoring companyId -> company_id etc to fix errors and mixups
simllll May 2, 2019
ed3af6a
fix: user find of underscore has no findOne
simllll May 2, 2019
fc57f7e
fix/revert: active user filter / use null again
simllll May 2, 2019
c35548a
fix: department validation
simllll May 2, 2019
eb6126d
feat: add migration for copmanyId and DepartmentId
simllll May 2, 2019
3c0f06f
Configurable LDAP search filter. Issue #352
rafacouto Jul 5, 2019
5f3be73
Validation: ldap_config.searchfilter
rafacouto Jul 10, 2019
3209d6e
LDAP search filter default value.
rafacouto Jul 15, 2019
31fc242
#249 fixes the error "overlapping booking" when using mysql db
Larykath Nov 18, 2019
3403145
fix: remove slack required username
simllll Feb 2, 2020
7fd6461
feat: add leave type id
simllll Jul 9, 2021
21c2697
feat: encode base 64 again
simllll Jul 9, 2021
cd8a1fb
feat: encode base 64 again
simllll Jul 9, 2021
de23899
minimum changes for docker build to succeed
dougbreaux Sep 22, 2023
e507584
Merge pull request #1 from dougbreaux/master
mermetbt Oct 16, 2023
e90959f
Merge pull request #2 from dkraemerwork/feature/#249_mysql_overlappin…
mermetbt Oct 16, 2023
89a8452
Merge branch 'ldap-filter'
mermetbt Oct 16, 2023
f58af04
Merge prettier.
mermetbt Oct 16, 2023
b325efa
Add package-lock and editorconfig.
mermetbt Oct 16, 2023
25956a0
Add redis dependency.
mermetbt Oct 16, 2023
f9daa7f
Update package-lock.
mermetbt Oct 16, 2023
89285c4
Add docker compose. Fix merge issue.
mermetbt Oct 16, 2023
4cd81b6
Fix invalid version.
mermetbt Oct 16, 2023
29c8a81
Fix.
mermetbt Oct 16, 2023
267f3bd
Fix Dockerfile.
mermetbt Oct 16, 2023
9190ba5
Change Dockerfile.
mermetbt Oct 16, 2023
7796d51
Add support for env.
mermetbt Oct 16, 2023
5bc4f63
Fix issues.
mermetbt Oct 16, 2023
5beb524
Prettier.
mermetbt Oct 17, 2023
54c76fc
Prettier.
mermetbt Oct 17, 2023
981e552
Add prettierrc.
mermetbt Oct 17, 2023
e75c76f
Set quote to double quote.
mermetbt Oct 17, 2023
5e6730c
Add semi columns.
mermetbt Oct 17, 2023
59d23bd
Merge.
mermetbt Oct 17, 2023
52684a2
Prettier.
mermetbt Oct 17, 2023
1338b3c
Fix.
mermetbt Oct 17, 2023
bab0c76
Fix issues.
mermetbt Oct 18, 2023
cfb248f
Add eslint.
mermetbt Oct 18, 2023
d80e283
Prettier.
mermetbt Oct 18, 2023
2a568f4
Eslint
mermetbt Oct 18, 2023
29c0fde
Eslint and prettier.
mermetbt Oct 18, 2023
7fe3402
Set the test database to sqlite.
mermetbt Oct 18, 2023
bb33c96
Fix.
mermetbt Oct 18, 2023
42651da
Add environment variables.
mermetbt Oct 19, 2023
fbde1b1
fix: Solve part of the issues for the tests to pass.
mermetbt Oct 28, 2023
4c1c613
fix: Bug fixes and force consistency in the database.
mermetbt Oct 29, 2023
fda8405
fix: Issues with leave types and request approval.
mermetbt Oct 29, 2023
66800a5
fix: Fix leave types issue.
mermetbt Oct 29, 2023
050c96e
fix: Improve consistency of the database.
mermetbt Jan 26, 2024
c6ace7c
Create docker-image.yml
mermetbt Feb 6, 2024
1b078fc
fix: Email from not set in emails.
mermetbt Feb 7, 2024
f975b1d
Merge branch 'master' of github.com:AlienGen/timeoff-management-appli…
mermetbt Feb 7, 2024
f235e96
ci: keep bin dir into the docker image.
mermetbt Feb 7, 2024
91849a3
fix: LDAP configuration issue when checkboxes are not ticked. LDAP se…
mermetbt Feb 7, 2024
622761c
fix: Some environment variables were not working.
mermetbt Feb 7, 2024
a000cfa
fix: Change datatypes for comments and timezone.
mermetbt Feb 7, 2024
14eff2a
feat: Change configurations and update the documentation.
mermetbt Feb 7, 2024
362523a
fix: Google auth domains.
mermetbt Feb 8, 2024
46140ad
fix: Settings company wide schedule.
mermetbt Feb 8, 2024
02a2f93
fix: Change table names for comment and schedule.
mermetbt Feb 8, 2024
e9c6459
fix: Checkboxes in department settings not working.
mermetbt Feb 8, 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
2 changes: 1 addition & 1 deletion .codeclimate.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
languages:
JavaScript: true
exclude_paths:
- "public/js/bootstrap-datepicker.js"
- "public/js/bootstrap-datepicker.js"
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.git
.github
.vscode
docs
config/app.json
15 changes: 15 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# EditorConfig is awesome: https://EditorConfig.org

# top-most EditorConfig file
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.js]
quote_type = single
33 changes: 33 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"env": {
"browser": true,
"commonjs": true,
"es2021": true
},
"extends": [
"standard",
"prettier",
"plugin:mocha/recommended"
],
"parserOptions": {
"ecmaVersion": "latest"
},
"plugins": [
"mocha"
],
"rules": {
"camelcase": 0,
"space-before-function-paren": 0,
"arrow-body-style": ["error", "as-needed"],
//"prefer-arrow-callback": [
// "error",
// { "allowNamedFunctions": true }
//],
"func-style": [
"error",
"declaration",
{ "allowArrowFunctions": true }
]

}
}
38 changes: 38 additions & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Publish Docker image

on:
push:
branches:
- master
- release/*
release:
types: [published]

jobs:
push_to_registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v4

- name: Log in to Docker Hub
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: aliengen/timeoff-management-application

- name: Build and push Docker image
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@
*.swm
node_modules/
*.sqlite
*.DS_Store
t/integration/test.csv
6 changes: 6 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"semi": false,
"singleQuote": true,
"arrowParens": "avoid",
"trailingComma": "none"
}
25 changes: 25 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": "explicit",
"source.addMissingImports": "explicit",
"source.fixAll.eslint": "explicit"
},
"search.exclude": {
"**/node_modules": true,
"**/.vscode": true,
"**/build": true,
"**/dist": true
},
"git.autofetch": true,
"editor.trimAutoWhitespace": true,
"files.encoding": "utf8",
"files.trimFinalNewlines": false,
"files.trimTrailingWhitespace": true,
"css.validate": false,
"editor.quickSuggestions": {
"strings": true
},
"editor.detectIndentation": false,
"editor.tabSize": 2
}
44 changes: 26 additions & 18 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,38 +5,46 @@
# =============
# 1. Create an empty directory and copy this file into it.
#
# 2. Create image with:
# 2. Create image with:
# docker build --tag timeoff:latest .
#
# 3. Run with:
# 3. Run with:
# docker run -d -p 3000:3000 --name alpine_timeoff timeoff
#
# 4. Login to running container (to update config (vi config/app.json):
# docker exec -ti --user root alpine_timeoff /bin/sh
# --------------------------------------------------------------------
FROM alpine:latest as dependencies
FROM node:16-alpine

RUN apk add --no-cache \
nodejs npm
RUN apk update
#RUN apk upgrade

COPY package.json .
RUN npm install
# Install dependencies
RUN apk add \
git \
make \
python3 \
g++ \
gcc \
libc-dev \
clang

FROM alpine:latest
WORKDIR /app

LABEL org.label-schema.schema-version="1.0"
LABEL org.label-schema.docker.cmd="docker run -d -p 3000:3000 --name alpine_timeoff"

RUN apk add --no-cache \
nodejs npm \
vim
# Cache the docker layer with the node_modules
COPY package.json /app/package.json
COPY package-lock.json /app/package-lock.json

RUN adduser --system app --home /app
USER app
WORKDIR /app
RUN npm install -y

# Copy the application into the container.
COPY . /app
COPY --from=dependencies node_modules ./node_modules

CMD npm start
# Add user so it doesn't run as root
RUN adduser --system app --home /app
USER app

EXPOSE 3000

CMD npm start
151 changes: 145 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

# TimeOff.Management

Web application for managing employee absences.
Expand Down Expand Up @@ -51,9 +50,9 @@ Ability to back up entire company leave data into CSV file. So it could be used

The most used customer paths are mobile friendly:

* employee is able to request new leave from mobile device
- employee is able to request new leave from mobile device

* supervisor is able to record decision from the mobile as well.
- supervisor is able to record decision from the mobile as well.

**Lots of other little things that would make life easier**

Expand All @@ -80,18 +79,158 @@ Create company account and use cloud based version.

### Self hosting

```bash
# Clone the repository
git clone https://github.com/timeoff-management/application.git timeoff-management
cd timeoff-management
```

Edit the configuration inside the `config` folder.

#### Standalone

Install TimeOff.Management application within your infrastructure:

(make sure you have Node.js (>=4.0.0) and SQLite installed)
(make sure you have Node.js (>=16.0.0) and SQLite installed)

```bash
git clone https://github.com/timeoff-management/application.git timeoff-management
cd timeoff-management
npm install
npm start
```

Open http://localhost:3000/ in your browser.

#### Using Docker

##### Using an image from DockerHub [aliengen/timeoff-management-application](https://hub.docker.com/r/aliengen/timeoff-management-application)

```bash
# Pull the image
docker pull aliengen/timeoff-management-application:master

# Run the container using an `env` file to load the configuration
docker run -d -p 3000:3000 --env-file ./env --name timeoff aliengen/timeoff-management-application:master

# Or you can run the container using the `app.json` file to load the configuration
docker run -d -p 3000:3000 -v ./config/app.json:/app/config/app.json --name timeoff aliengen/timeoff-management-application:master
```

##### Build the image manually

You can build the image from the latest version of the repository.

```bash
# Build the docker image
docker build --tag timeoff:latest .

# Launch the docker image
docker run -d -p 3000:3000 --name alpine_timeoff timeoff
```

##### Using Docker-compose

```bash
docker-compose up
```

## Configuration

### Using environment variables

| Variable | Description | Default value |
| ------------------------- | ------------------------------------------------------------ | --------------- |
| BRANDING_URL | URL of the application | http://app.timeoff.management/ |
| BRANDING_WEBSITE | URL of the company's website | http://timeoff.management/ |
| PORT | Port of the application | 3000 |
| NODE_ENV | Environment of NodeJs | development |
| CRYPTO_SECRET | Secret for password hashing | |
| DATABASE_URL | Database URL format (`mysql://localhost:3306/database`) | |
| DB_HOST | Database hostname | |
| DB_DATABASE | Database name | |
| DB_USERNAME | Database username | |
| DB_PASSWORD | Database password | |
| DB_DIALECT | Database dialect (sqlite, mysql, postgres) | sqlite |
| DB_STORAGE | Database storage file | db.[ENV].sqlite |
| DB_LOGGING | Logging of queries | false |
| DB_POOL_MAX | Maximum number of connection in pool | 5 |
| DB_POOL_MIN | Minimum number of connection in pool | 0 |
| DB_POOL_ACQUIRE | The maximum time, in milliseconds, that pool will try to get connection before throwing error | 60000 |
| DB_POOL_IDLE | The maximum time, in milliseconds, that a connection can be idle before being released. | 10000 |
| SMTP_HOST | Host of the smtp server | localhost |
| SMTP_PORT | Port of the smtp server | 25 |
| SMTP_FROM | Sender email | [email protected] |
| SMTP_AUTH_USER | Username for the smtp server | |
| SMTP_AUTH_PASS | Password for the smtp server | |
| SMTP_REQUIRE_TLS | Use STARTTLS | false |
| SESSIONS_SECRET | Secret for the sessions | |
| SESSIONS_STORE | Storage for the sessions (`sequelize`,`redis`) | sequelize |
| SESSIONS_REDIS_HOST | Redis hostname | localhost |
| SESSIONS_REDIS_PORT | Redis port | 6379 |
| SLACK_TOKEN | If set, the Slack token to send message | |
| SLACK_BOT_NAME | Name of the bot on Slack | |
| SLACK_ICON_URL | Icon of the bot on Slack | |
| LOGIN_DEFAULT | Display the default login form | true |
| LOGIN_GOOGLE | Enable the authentication with Google | false |
| GOOGLE_ANALYTICS_TRACKER | Google Analytics tracker code | |
| GOOGLE_AUTH_CLIENTID | Google Auth client ID | |
| GOOGLE_AUTH_CLIENTSECRET | Google Auth client secret | |
| GOOGLE_AUTH_DOMAINS | Allowed domains | |
| OPTIONS_REGISTRATION | Allow users to create a new company account on Timeoff | true |

### Using the JSON configuration files

#### app.json

```json
{
"branding": {
"url": "http://app.timeoff.management",
"website": "http://timeoff.management"
},
"crypto_secret": "Secret used for password hashing",
"login": {
"default": true,
"google": false
},
"smtp": {
"host": "localhost",
"port": 25,
"from": "[email protected]",
"auth": {
"user": "user",
"pass": "pass"
}
},
"sessions": {
"secret": "Secret used for sessions",
"store": "sequelize",
"redis": {
"host": "localhost",
"port": 6379
}
},
"google": {
"analytics": {
"tracker": "Your GA tracker code"
},
"auth": {
"clientId": "123",
"clientSecret": "123",
"domains": ["myalloweddomain.com"]
}
},
"slack": {
"token": "Get your Web API token from you Slack admin page.",
"icon_url": "The image can be hosted anywhere, but I would recoment to upload an icon to your Slack and use it's url.",
"bot_name": "The display name for the messages being sent."
},
"options": {
"registration": true
},
}
```


## Run tests

We have quite a wide test coverage, to make sure that the main user paths work as expected.
Expand Down
Loading