Skip to content

Commit

Permalink
Merge pull request #74 from rafaelurben/refactor
Browse files Browse the repository at this point in the history
Refactor to Typescript and restructured codebase
  • Loading branch information
rafaelurben authored Nov 10, 2024
2 parents 72b8419 + ac93641 commit 421c092
Show file tree
Hide file tree
Showing 135 changed files with 11,883 additions and 11,827 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/check_app.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: check_app.yml
on: [push, pull_request]

jobs:
check:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [ '20.x', '21.x', '22.x', '23.x' ]

defaults:
run:
working-directory: teamized/app

steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: npm ci
- name: Check prettier
run: npm run prettier-check
- name: Check typescript
run: npm run typescript-check
- name: Check eslint
run: npm run eslint-check
6 changes: 5 additions & 1 deletion renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,9 @@
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:recommended"
]
],
"lockFileMaintenance": {
"enabled": true,
"automerge": true
}
}
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Django==5.1.2
Django==5.1.3
6 changes: 1 addition & 5 deletions teamized/api/endpoints/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,8 @@ def endpoint_team(request, team: Team):
if not team.user_is_owner(user):
return NO_PERMISSION

name = request.POST.get("name", "")[:49]
description = request.POST.get("description", "")
team.update_from_post_data(request.POST)

team.name = name
team.description = description
team.save()
return JsonResponse(
{
"success": True,
Expand Down
8 changes: 4 additions & 4 deletions teamized/api/endpoints/todo.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ def endpoint_todolist(request, team: Team, todolist: ToDoList):
"id": todolist.uid,
"todolist": todolist.as_dict(),
"alert": {
"title": _("To-do-Lis­te geändert"),
"text": _("Die To-do-Lis­te wurde erfolgreich geändert."),
"title": _("To-do-Liste geändert"),
"text": _("Die To-do-Liste wurde erfolgreich geändert."),
},
}
)
Expand All @@ -100,8 +100,8 @@ def endpoint_todolist(request, team: Team, todolist: ToDoList):
{
"success": True,
"alert": {
"title": _("To-do-Lis­te gelöscht"),
"text": _("Die To-do-Lis­te wurde erfolgreich gelöscht."),
"title": _("To-do-Liste gelöscht"),
"text": _("Die To-do-Liste wurde erfolgreich gelöscht."),
},
}
)
Expand Down
11 changes: 6 additions & 5 deletions teamized/api/endpoints/workingtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,12 @@ def endpoint_tracking_live(request):
# Check if the user is already tracking a session
active_session = user.get_active_work_session()
if active_session is None:
raise exceptions.AlertException(
_("Es ist keine Sitzung im Gange."),
errorname="no_active_tracking_session_exists",
status=200,
)
return JsonResponse(
{
"error": "no_active_tracking_session_exists",
"message": _("Es ist keine Sitzung im Gange."),
}
) # this is intentionally code 200 to not fill up the console

# Return the session data
return JsonResponse(
Expand Down
6 changes: 6 additions & 0 deletions teamized/app/.prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"trailingComma": "es5",
"tabWidth": 4,
"semi": true,
"singleQuote": true
}
29 changes: 29 additions & 0 deletions teamized/app/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import pluginJs from '@eslint/js';
import pluginPrettierConfigRecommended from 'eslint-plugin-prettier/recommended';
import pluginReact from 'eslint-plugin-react';
import pluginReactHooks from 'eslint-plugin-react-hooks';
import pluginSimpleImportSort from 'eslint-plugin-simple-import-sort';
import globals from 'globals';
import tseslint from 'typescript-eslint';

/** @type {import('eslint').Linter.Config[]} */
export default [
{ files: ['**/*.{js,mjs,cjs,ts,jsx,tsx}'] },
{ languageOptions: { globals: globals.browser } },
pluginJs.configs.recommended,
...tseslint.configs.recommended,
pluginReact.configs.flat.recommended,
{
plugins: {
'react-hooks': pluginReactHooks,
'simple-import-sort': pluginSimpleImportSort,
},
rules: {
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'warn',
'simple-import-sort/imports': 'error',
'simple-import-sort/exports': 'warn',
},
},
pluginPrettierConfigRecommended,
];
Loading

0 comments on commit 421c092

Please sign in to comment.