moved project from github
This commit is contained in:
parent
c684f67ad4
commit
4337ea03cc
17
taskManagement/.editorconfig
Normal file
17
taskManagement/.editorconfig
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
# Editor configuration, see https://editorconfig.org
|
||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
charset = utf-8
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 2
|
||||||
|
insert_final_newline = true
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
|
||||||
|
[*.ts]
|
||||||
|
quote_type = single
|
||||||
|
ij_typescript_use_double_quotes = false
|
||||||
|
|
||||||
|
[*.md]
|
||||||
|
max_line_length = off
|
||||||
|
trim_trailing_whitespace = false
|
||||||
43
taskManagement/.gitignore
vendored
Normal file
43
taskManagement/.gitignore
vendored
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
# See https://docs.github.com/get-started/getting-started-with-git/ignoring-files for more about ignoring files.
|
||||||
|
|
||||||
|
# Compiled output
|
||||||
|
/dist
|
||||||
|
/tmp
|
||||||
|
/out-tsc
|
||||||
|
/bazel-out
|
||||||
|
|
||||||
|
# Node
|
||||||
|
/node_modules
|
||||||
|
npm-debug.log
|
||||||
|
yarn-error.log
|
||||||
|
|
||||||
|
# IDEs and editors
|
||||||
|
.idea/
|
||||||
|
.project
|
||||||
|
.classpath
|
||||||
|
.c9/
|
||||||
|
*.launch
|
||||||
|
.settings/
|
||||||
|
*.sublime-workspace
|
||||||
|
|
||||||
|
# Visual Studio Code
|
||||||
|
.vscode/*
|
||||||
|
!.vscode/settings.json
|
||||||
|
!.vscode/tasks.json
|
||||||
|
!.vscode/launch.json
|
||||||
|
!.vscode/extensions.json
|
||||||
|
.history/*
|
||||||
|
|
||||||
|
# Miscellaneous
|
||||||
|
/.angular/cache
|
||||||
|
.sass-cache/
|
||||||
|
/connect.lock
|
||||||
|
/coverage
|
||||||
|
/libpeerconnection.log
|
||||||
|
testem.log
|
||||||
|
/typings
|
||||||
|
__screenshots__/
|
||||||
|
|
||||||
|
# System files
|
||||||
|
.DS_Store
|
||||||
|
Thumbs.db
|
||||||
4
taskManagement/.vscode/extensions.json
vendored
Normal file
4
taskManagement/.vscode/extensions.json
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=827846
|
||||||
|
"recommendations": ["angular.ng-template"]
|
||||||
|
}
|
||||||
20
taskManagement/.vscode/launch.json
vendored
Normal file
20
taskManagement/.vscode/launch.json
vendored
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||||
|
"version": "0.2.0",
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"name": "ng serve",
|
||||||
|
"type": "chrome",
|
||||||
|
"request": "launch",
|
||||||
|
"preLaunchTask": "npm: start",
|
||||||
|
"url": "http://localhost:4200/"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "ng test",
|
||||||
|
"type": "chrome",
|
||||||
|
"request": "launch",
|
||||||
|
"preLaunchTask": "npm: test",
|
||||||
|
"url": "http://localhost:9876/debug.html"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
42
taskManagement/.vscode/tasks.json
vendored
Normal file
42
taskManagement/.vscode/tasks.json
vendored
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
{
|
||||||
|
// For more information, visit: https://go.microsoft.com/fwlink/?LinkId=733558
|
||||||
|
"version": "2.0.0",
|
||||||
|
"tasks": [
|
||||||
|
{
|
||||||
|
"type": "npm",
|
||||||
|
"script": "start",
|
||||||
|
"isBackground": true,
|
||||||
|
"problemMatcher": {
|
||||||
|
"owner": "typescript",
|
||||||
|
"pattern": "$tsc",
|
||||||
|
"background": {
|
||||||
|
"activeOnStart": true,
|
||||||
|
"beginsPattern": {
|
||||||
|
"regexp": "(.*?)"
|
||||||
|
},
|
||||||
|
"endsPattern": {
|
||||||
|
"regexp": "bundle generation complete"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "npm",
|
||||||
|
"script": "test",
|
||||||
|
"isBackground": true,
|
||||||
|
"problemMatcher": {
|
||||||
|
"owner": "typescript",
|
||||||
|
"pattern": "$tsc",
|
||||||
|
"background": {
|
||||||
|
"activeOnStart": true,
|
||||||
|
"beginsPattern": {
|
||||||
|
"regexp": "(.*?)"
|
||||||
|
},
|
||||||
|
"endsPattern": {
|
||||||
|
"regexp": "bundle generation complete"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
59
taskManagement/README.md
Normal file
59
taskManagement/README.md
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
# TaskManagement
|
||||||
|
|
||||||
|
This project was generated using [Angular CLI](https://github.com/angular/angular-cli) version 20.3.6.
|
||||||
|
|
||||||
|
## Development server
|
||||||
|
|
||||||
|
To start a local development server, run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ng serve
|
||||||
|
```
|
||||||
|
|
||||||
|
Once the server is running, open your browser and navigate to `http://localhost:4200/`. The application will automatically reload whenever you modify any of the source files.
|
||||||
|
|
||||||
|
## Code scaffolding
|
||||||
|
|
||||||
|
Angular CLI includes powerful code scaffolding tools. To generate a new component, run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ng generate component component-name
|
||||||
|
```
|
||||||
|
|
||||||
|
For a complete list of available schematics (such as `components`, `directives`, or `pipes`), run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ng generate --help
|
||||||
|
```
|
||||||
|
|
||||||
|
## Building
|
||||||
|
|
||||||
|
To build the project run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ng build
|
||||||
|
```
|
||||||
|
|
||||||
|
This will compile your project and store the build artifacts in the `dist/` directory. By default, the production build optimizes your application for performance and speed.
|
||||||
|
|
||||||
|
## Running unit tests
|
||||||
|
|
||||||
|
To execute unit tests with the [Karma](https://karma-runner.github.io) test runner, use the following command:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ng test
|
||||||
|
```
|
||||||
|
|
||||||
|
## Running end-to-end tests
|
||||||
|
|
||||||
|
For end-to-end (e2e) testing, run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ng e2e
|
||||||
|
```
|
||||||
|
|
||||||
|
Angular CLI does not come with an end-to-end testing framework by default. You can choose one that suits your needs.
|
||||||
|
|
||||||
|
## Additional Resources
|
||||||
|
|
||||||
|
For more information on using the Angular CLI, including detailed command references, visit the [Angular CLI Overview and Command Reference](https://angular.dev/tools/cli) page.
|
||||||
91
taskManagement/angular.json
Normal file
91
taskManagement/angular.json
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
{
|
||||||
|
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
|
||||||
|
"version": 1,
|
||||||
|
"newProjectRoot": "projects",
|
||||||
|
"projects": {
|
||||||
|
"taskManagement": {
|
||||||
|
"projectType": "application",
|
||||||
|
"schematics": {
|
||||||
|
"@schematics/angular:component": {
|
||||||
|
"style": "scss"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "",
|
||||||
|
"sourceRoot": "src",
|
||||||
|
"prefix": "app",
|
||||||
|
"architect": {
|
||||||
|
"build": {
|
||||||
|
"builder": "@angular/build:application",
|
||||||
|
"options": {
|
||||||
|
"browser": "src/main.ts",
|
||||||
|
"tsConfig": "tsconfig.app.json",
|
||||||
|
"inlineStyleLanguage": "scss",
|
||||||
|
"assets": [
|
||||||
|
{
|
||||||
|
"glob": "**/*",
|
||||||
|
"input": "public"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"styles": [
|
||||||
|
"src/styles.scss"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"configurations": {
|
||||||
|
"production": {
|
||||||
|
"budgets": [
|
||||||
|
{
|
||||||
|
"type": "initial",
|
||||||
|
"maximumWarning": "500kB",
|
||||||
|
"maximumError": "1MB"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "anyComponentStyle",
|
||||||
|
"maximumWarning": "4kB",
|
||||||
|
"maximumError": "8kB"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"outputHashing": "all"
|
||||||
|
},
|
||||||
|
"development": {
|
||||||
|
"optimization": false,
|
||||||
|
"extractLicenses": false,
|
||||||
|
"sourceMap": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"defaultConfiguration": "production"
|
||||||
|
},
|
||||||
|
"serve": {
|
||||||
|
"builder": "@angular/build:dev-server",
|
||||||
|
"configurations": {
|
||||||
|
"production": {
|
||||||
|
"buildTarget": "taskManagement:build:production"
|
||||||
|
},
|
||||||
|
"development": {
|
||||||
|
"buildTarget": "taskManagement:build:development"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"defaultConfiguration": "development"
|
||||||
|
},
|
||||||
|
"extract-i18n": {
|
||||||
|
"builder": "@angular/build:extract-i18n"
|
||||||
|
},
|
||||||
|
"test": {
|
||||||
|
"builder": "@angular/build:karma",
|
||||||
|
"options": {
|
||||||
|
"tsConfig": "tsconfig.spec.json",
|
||||||
|
"inlineStyleLanguage": "scss",
|
||||||
|
"assets": [
|
||||||
|
{
|
||||||
|
"glob": "**/*",
|
||||||
|
"input": "public"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"styles": [
|
||||||
|
"src/styles.scss"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
15
taskManagement/orval.config.js
Normal file
15
taskManagement/orval.config.js
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
module.exports = {
|
||||||
|
taskManagement: {
|
||||||
|
input: {
|
||||||
|
target: './src/app/api/api.json',
|
||||||
|
},
|
||||||
|
output: {
|
||||||
|
mode: 'tags-split',
|
||||||
|
target: './src/app/api/api.ts',
|
||||||
|
schemas: './src/app/api/model',
|
||||||
|
client: 'angular',
|
||||||
|
fileExtension: '.gen.ts',
|
||||||
|
baseUrl: 'http://localhost:8080',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
12630
taskManagement/package-lock.json
generated
Normal file
12630
taskManagement/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
51
taskManagement/package.json
Normal file
51
taskManagement/package.json
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
{
|
||||||
|
"name": "task-management",
|
||||||
|
"version": "0.0.0",
|
||||||
|
"scripts": {
|
||||||
|
"ng": "ng",
|
||||||
|
"start": "ng serve",
|
||||||
|
"build": "ng build",
|
||||||
|
"watch": "ng build --watch --configuration development",
|
||||||
|
"test": "ng test",
|
||||||
|
"generate-api": "npx orval --config ./orval.config.js"
|
||||||
|
},
|
||||||
|
"prettier": {
|
||||||
|
"printWidth": 100,
|
||||||
|
"singleQuote": true,
|
||||||
|
"overrides": [
|
||||||
|
{
|
||||||
|
"files": "*.html",
|
||||||
|
"options": {
|
||||||
|
"parser": "angular"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"private": true,
|
||||||
|
"dependencies": {
|
||||||
|
"@angular/cdk": "^20.2.9",
|
||||||
|
"@angular/common": "^20.3.0",
|
||||||
|
"@angular/compiler": "^20.3.0",
|
||||||
|
"@angular/core": "^20.3.0",
|
||||||
|
"@angular/forms": "^20.3.0",
|
||||||
|
"@angular/material": "^20.2.9",
|
||||||
|
"@angular/platform-browser": "^20.3.0",
|
||||||
|
"@angular/router": "^20.3.0",
|
||||||
|
"@orval/angular": "^7.14.0",
|
||||||
|
"rxjs": "~7.8.0",
|
||||||
|
"tslib": "^2.3.0"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@angular/build": "^20.3.6",
|
||||||
|
"@angular/cli": "^20.3.6",
|
||||||
|
"@angular/compiler-cli": "^20.3.0",
|
||||||
|
"@types/jasmine": "~5.1.0",
|
||||||
|
"jasmine-core": "~5.9.0",
|
||||||
|
"karma": "~6.4.0",
|
||||||
|
"karma-chrome-launcher": "~3.2.0",
|
||||||
|
"karma-coverage": "~2.2.0",
|
||||||
|
"karma-jasmine": "~5.1.0",
|
||||||
|
"karma-jasmine-html-reporter": "~2.1.0",
|
||||||
|
"typescript": "~5.9.2"
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
taskManagement/public/favicon.ico
Normal file
BIN
taskManagement/public/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
468
taskManagement/src/app/api/api.json
Normal file
468
taskManagement/src/app/api/api.json
Normal file
@ -0,0 +1,468 @@
|
|||||||
|
{
|
||||||
|
"openapi": "3.1.0",
|
||||||
|
"info": {
|
||||||
|
"title": "OpenAPI definition",
|
||||||
|
"version": "v0"
|
||||||
|
},
|
||||||
|
"servers": [
|
||||||
|
{
|
||||||
|
"url": "http://localhost:8080",
|
||||||
|
"description": "Generated server url"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"paths": {
|
||||||
|
"/users/{id}": {
|
||||||
|
"get": {
|
||||||
|
"tags": [
|
||||||
|
"user-controller"
|
||||||
|
],
|
||||||
|
"operationId": "loadUser",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "id",
|
||||||
|
"in": "path",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"type": "integer",
|
||||||
|
"format": "int32"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK",
|
||||||
|
"content": {
|
||||||
|
"*/*": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/UserDto"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"put": {
|
||||||
|
"tags": [
|
||||||
|
"user-controller"
|
||||||
|
],
|
||||||
|
"operationId": "updateUser",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "id",
|
||||||
|
"in": "path",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"type": "integer",
|
||||||
|
"format": "int32"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"requestBody": {
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/UserDto"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"delete": {
|
||||||
|
"tags": [
|
||||||
|
"user-controller"
|
||||||
|
],
|
||||||
|
"operationId": "deleteUser",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "id",
|
||||||
|
"in": "path",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"type": "integer",
|
||||||
|
"format": "int32"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/tasks/{id}": {
|
||||||
|
"get": {
|
||||||
|
"tags": [
|
||||||
|
"task-controller"
|
||||||
|
],
|
||||||
|
"operationId": "loadTask",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "id",
|
||||||
|
"in": "path",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"type": "integer",
|
||||||
|
"format": "int32"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK",
|
||||||
|
"content": {
|
||||||
|
"*/*": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/TaskDto"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"put": {
|
||||||
|
"tags": [
|
||||||
|
"task-controller"
|
||||||
|
],
|
||||||
|
"operationId": "updateTask",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "id",
|
||||||
|
"in": "path",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"type": "integer",
|
||||||
|
"format": "int32"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"requestBody": {
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/TaskDto"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"delete": {
|
||||||
|
"tags": [
|
||||||
|
"task-controller"
|
||||||
|
],
|
||||||
|
"operationId": "deleteTask",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "id",
|
||||||
|
"in": "path",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"type": "integer",
|
||||||
|
"format": "int32"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/projects/{id}": {
|
||||||
|
"get": {
|
||||||
|
"tags": [
|
||||||
|
"project-controller"
|
||||||
|
],
|
||||||
|
"operationId": "loadProject",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "id",
|
||||||
|
"in": "path",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"type": "integer",
|
||||||
|
"format": "int32"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK",
|
||||||
|
"content": {
|
||||||
|
"*/*": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/ProjectDto"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"put": {
|
||||||
|
"tags": [
|
||||||
|
"project-controller"
|
||||||
|
],
|
||||||
|
"operationId": "updateProject",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "id",
|
||||||
|
"in": "path",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"type": "integer",
|
||||||
|
"format": "int32"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"requestBody": {
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/ProjectDto"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"delete": {
|
||||||
|
"tags": [
|
||||||
|
"project-controller"
|
||||||
|
],
|
||||||
|
"operationId": "deleteProject",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "id",
|
||||||
|
"in": "path",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"type": "integer",
|
||||||
|
"format": "int32"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/users": {
|
||||||
|
"get": {
|
||||||
|
"tags": [
|
||||||
|
"user-controller"
|
||||||
|
],
|
||||||
|
"operationId": "loadAllUsers",
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK",
|
||||||
|
"content": {
|
||||||
|
"*/*": {
|
||||||
|
"schema": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/components/schemas/UserDto"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"post": {
|
||||||
|
"tags": [
|
||||||
|
"user-controller"
|
||||||
|
],
|
||||||
|
"operationId": "createUser",
|
||||||
|
"requestBody": {
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/UserDto"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/projects": {
|
||||||
|
"get": {
|
||||||
|
"tags": [
|
||||||
|
"project-controller"
|
||||||
|
],
|
||||||
|
"operationId": "loadAllProjects",
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK",
|
||||||
|
"content": {
|
||||||
|
"*/*": {
|
||||||
|
"schema": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/components/schemas/ProjectDto"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"post": {
|
||||||
|
"tags": [
|
||||||
|
"project-controller"
|
||||||
|
],
|
||||||
|
"operationId": "createProject",
|
||||||
|
"requestBody": {
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/ProjectDto"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/projects/{projectId}/tasks": {
|
||||||
|
"post": {
|
||||||
|
"tags": [
|
||||||
|
"task-controller"
|
||||||
|
],
|
||||||
|
"operationId": "createTask",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "projectId",
|
||||||
|
"in": "path",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"type": "integer",
|
||||||
|
"format": "int32"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"requestBody": {
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/TaskDto"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"components": {
|
||||||
|
"schemas": {
|
||||||
|
"TaskDto": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"id": {
|
||||||
|
"type": "integer",
|
||||||
|
"format": "int32"
|
||||||
|
},
|
||||||
|
"title": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"description": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"status": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": [
|
||||||
|
"OPEN",
|
||||||
|
"IN_PROGRESS",
|
||||||
|
"DONE"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"projectId": {
|
||||||
|
"type": "integer",
|
||||||
|
"format": "int32"
|
||||||
|
},
|
||||||
|
"users": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/components/schemas/UserDto"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"UserDto": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"id": {
|
||||||
|
"type": "integer",
|
||||||
|
"format": "int32"
|
||||||
|
},
|
||||||
|
"firstName": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"lastName": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"tasks": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/components/schemas/TaskDto"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"ProjectDto": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"id": {
|
||||||
|
"type": "integer",
|
||||||
|
"format": "int32"
|
||||||
|
},
|
||||||
|
"title": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"tasks": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/components/schemas/TaskDto"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
15
taskManagement/src/app/api/model/index.ts
Normal file
15
taskManagement/src/app/api/model/index.ts
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
/**
|
||||||
|
* Generated by orval v7.14.0 🍺
|
||||||
|
* Do not edit manually.
|
||||||
|
* OpenAPI definition
|
||||||
|
* OpenAPI spec version: v0
|
||||||
|
*/
|
||||||
|
|
||||||
|
export * from './projectDto';
|
||||||
|
export * from './projectPO';
|
||||||
|
export * from './taskDto';
|
||||||
|
export * from './taskDtoStatus';
|
||||||
|
export * from './taskPO';
|
||||||
|
export * from './taskPOStatus';
|
||||||
|
export * from './userDto';
|
||||||
|
export * from './userPO';
|
||||||
13
taskManagement/src/app/api/model/projectDto.ts
Normal file
13
taskManagement/src/app/api/model/projectDto.ts
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
/**
|
||||||
|
* Generated by orval v7.14.0 🍺
|
||||||
|
* Do not edit manually.
|
||||||
|
* OpenAPI definition
|
||||||
|
* OpenAPI spec version: v0
|
||||||
|
*/
|
||||||
|
import type { TaskDto } from './taskDto';
|
||||||
|
|
||||||
|
export interface ProjectDto {
|
||||||
|
id?: number;
|
||||||
|
title?: string;
|
||||||
|
tasks?: TaskDto[];
|
||||||
|
}
|
||||||
16
taskManagement/src/app/api/model/projectPO.ts
Normal file
16
taskManagement/src/app/api/model/projectPO.ts
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
/**
|
||||||
|
* Generated by orval v7.14.0 🍺
|
||||||
|
* Do not edit manually.
|
||||||
|
* OpenAPI definition
|
||||||
|
* OpenAPI spec version: v0
|
||||||
|
*/
|
||||||
|
import type { TaskPO } from './taskPO';
|
||||||
|
|
||||||
|
export interface ProjectPO {
|
||||||
|
/** Unique identifier of the project */
|
||||||
|
readonly id?: number;
|
||||||
|
/** Title of the project */
|
||||||
|
title: string;
|
||||||
|
/** List of tasks belonging to the project */
|
||||||
|
tasks?: TaskPO[];
|
||||||
|
}
|
||||||
17
taskManagement/src/app/api/model/taskDto.ts
Normal file
17
taskManagement/src/app/api/model/taskDto.ts
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
/**
|
||||||
|
* Generated by orval v7.14.0 🍺
|
||||||
|
* Do not edit manually.
|
||||||
|
* OpenAPI definition
|
||||||
|
* OpenAPI spec version: v0
|
||||||
|
*/
|
||||||
|
import type { TaskDtoStatus } from './taskDtoStatus';
|
||||||
|
import type { UserDto } from './userDto';
|
||||||
|
|
||||||
|
export interface TaskDto {
|
||||||
|
id?: number;
|
||||||
|
title?: string;
|
||||||
|
description?: string;
|
||||||
|
status?: TaskDtoStatus;
|
||||||
|
projectId?: number;
|
||||||
|
users?: UserDto[];
|
||||||
|
}
|
||||||
16
taskManagement/src/app/api/model/taskDtoStatus.ts
Normal file
16
taskManagement/src/app/api/model/taskDtoStatus.ts
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
/**
|
||||||
|
* Generated by orval v7.14.0 🍺
|
||||||
|
* Do not edit manually.
|
||||||
|
* OpenAPI definition
|
||||||
|
* OpenAPI spec version: v0
|
||||||
|
*/
|
||||||
|
|
||||||
|
export type TaskDtoStatus = typeof TaskDtoStatus[keyof typeof TaskDtoStatus];
|
||||||
|
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
||||||
|
export const TaskDtoStatus = {
|
||||||
|
OPEN: 'OPEN',
|
||||||
|
IN_PROGRESS: 'IN_PROGRESS',
|
||||||
|
DONE: 'DONE',
|
||||||
|
} as const;
|
||||||
24
taskManagement/src/app/api/model/taskPO.ts
Normal file
24
taskManagement/src/app/api/model/taskPO.ts
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
/**
|
||||||
|
* Generated by orval v7.14.0 🍺
|
||||||
|
* Do not edit manually.
|
||||||
|
* OpenAPI definition
|
||||||
|
* OpenAPI spec version: v0
|
||||||
|
*/
|
||||||
|
import type { TaskPOStatus } from './taskPOStatus';
|
||||||
|
import type { ProjectPO } from './projectPO';
|
||||||
|
import type { UserPO } from './userPO';
|
||||||
|
|
||||||
|
export interface TaskPO {
|
||||||
|
/** Unique identifier of the task */
|
||||||
|
readonly id?: number;
|
||||||
|
/** Title of the task */
|
||||||
|
title: string;
|
||||||
|
/** Description of the task */
|
||||||
|
description?: string;
|
||||||
|
/** Status of the task. Available status are OPEN, IN PROGRESS and DONE */
|
||||||
|
status: TaskPOStatus;
|
||||||
|
/** The project belonging to the task */
|
||||||
|
project?: ProjectPO;
|
||||||
|
/** List of users belonging to the task */
|
||||||
|
users?: UserPO[];
|
||||||
|
}
|
||||||
19
taskManagement/src/app/api/model/taskPOStatus.ts
Normal file
19
taskManagement/src/app/api/model/taskPOStatus.ts
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
/**
|
||||||
|
* Generated by orval v7.14.0 🍺
|
||||||
|
* Do not edit manually.
|
||||||
|
* OpenAPI definition
|
||||||
|
* OpenAPI spec version: v0
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Status of the task. Available status are OPEN, IN PROGRESS and DONE
|
||||||
|
*/
|
||||||
|
export type TaskPOStatus = typeof TaskPOStatus[keyof typeof TaskPOStatus];
|
||||||
|
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
||||||
|
export const TaskPOStatus = {
|
||||||
|
OPEN: 'OPEN',
|
||||||
|
IN_PROGRESS: 'IN_PROGRESS',
|
||||||
|
DONE: 'DONE',
|
||||||
|
} as const;
|
||||||
14
taskManagement/src/app/api/model/userDto.ts
Normal file
14
taskManagement/src/app/api/model/userDto.ts
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
/**
|
||||||
|
* Generated by orval v7.14.0 🍺
|
||||||
|
* Do not edit manually.
|
||||||
|
* OpenAPI definition
|
||||||
|
* OpenAPI spec version: v0
|
||||||
|
*/
|
||||||
|
import type { TaskDto } from './taskDto';
|
||||||
|
|
||||||
|
export interface UserDto {
|
||||||
|
id?: number;
|
||||||
|
firstName?: string;
|
||||||
|
lastName?: string;
|
||||||
|
tasks?: TaskDto[];
|
||||||
|
}
|
||||||
17
taskManagement/src/app/api/model/userPO.ts
Normal file
17
taskManagement/src/app/api/model/userPO.ts
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
/**
|
||||||
|
* Generated by orval v7.14.0 🍺
|
||||||
|
* Do not edit manually.
|
||||||
|
* OpenAPI definition
|
||||||
|
* OpenAPI spec version: v0
|
||||||
|
*/
|
||||||
|
import type { TaskPO } from './taskPO';
|
||||||
|
|
||||||
|
export interface UserPO {
|
||||||
|
/** Unique identifier of the user */
|
||||||
|
readonly id?: number;
|
||||||
|
/** Firstname of the user */
|
||||||
|
firstName: string;
|
||||||
|
/** Lastname of the user */
|
||||||
|
lastName: string;
|
||||||
|
tasks?: TaskPO[];
|
||||||
|
}
|
||||||
@ -0,0 +1,115 @@
|
|||||||
|
/**
|
||||||
|
* Generated by orval v7.14.0 🍺
|
||||||
|
* Do not edit manually.
|
||||||
|
* OpenAPI definition
|
||||||
|
* OpenAPI spec version: v0
|
||||||
|
*/
|
||||||
|
import {
|
||||||
|
HttpClient
|
||||||
|
} from '@angular/common/http';
|
||||||
|
import type {
|
||||||
|
HttpContext,
|
||||||
|
HttpEvent,
|
||||||
|
HttpHeaders,
|
||||||
|
HttpParams,
|
||||||
|
HttpResponse as AngularHttpResponse
|
||||||
|
} from '@angular/common/http';
|
||||||
|
|
||||||
|
import {
|
||||||
|
Injectable,
|
||||||
|
inject
|
||||||
|
} from '@angular/core';
|
||||||
|
|
||||||
|
import {
|
||||||
|
Observable
|
||||||
|
} from 'rxjs';
|
||||||
|
|
||||||
|
import type {
|
||||||
|
ProjectDto
|
||||||
|
} from '.././model';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
interface HttpClientOptions {
|
||||||
|
headers?: HttpHeaders | Record<string, string | string[]>;
|
||||||
|
context?: HttpContext;
|
||||||
|
params?:
|
||||||
|
| HttpParams
|
||||||
|
| Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
|
||||||
|
reportProgress?: boolean;
|
||||||
|
withCredentials?: boolean;
|
||||||
|
credentials?: RequestCredentials;
|
||||||
|
keepalive?: boolean;
|
||||||
|
priority?: RequestPriority;
|
||||||
|
cache?: RequestCache;
|
||||||
|
mode?: RequestMode;
|
||||||
|
redirect?: RequestRedirect;
|
||||||
|
referrer?: string;
|
||||||
|
integrity?: string;
|
||||||
|
transferCache?: {includeHeaders?: string[]} | boolean;
|
||||||
|
timeout?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Injectable({ providedIn: 'root' })
|
||||||
|
export class ProjectControllerService {
|
||||||
|
private readonly http = inject(HttpClient);
|
||||||
|
loadProject<TData = ProjectDto>(id: number, options?: HttpClientOptions & { observe?: 'body' }): Observable<TData>;
|
||||||
|
loadProject<TData = ProjectDto>(id: number, options?: HttpClientOptions & { observe: 'events' }): Observable<HttpEvent<TData>>;
|
||||||
|
loadProject<TData = ProjectDto>(id: number, options?: HttpClientOptions & { observe: 'response' }): Observable<AngularHttpResponse<TData>>;
|
||||||
|
loadProject<TData = ProjectDto>(
|
||||||
|
id: number, options?: HttpClientOptions & { observe?: any }): Observable<any> {
|
||||||
|
return this.http.get<TData>(
|
||||||
|
`http://localhost:8080/projects/${id}`,options
|
||||||
|
);
|
||||||
|
}
|
||||||
|
updateProject<TData = void>(id: number,
|
||||||
|
projectDto: ProjectDto, options?: HttpClientOptions & { observe?: 'body' }): Observable<TData>;
|
||||||
|
updateProject<TData = void>(id: number,
|
||||||
|
projectDto: ProjectDto, options?: HttpClientOptions & { observe: 'events' }): Observable<HttpEvent<TData>>;
|
||||||
|
updateProject<TData = void>(id: number,
|
||||||
|
projectDto: ProjectDto, options?: HttpClientOptions & { observe: 'response' }): Observable<AngularHttpResponse<TData>>;
|
||||||
|
updateProject<TData = void>(
|
||||||
|
id: number,
|
||||||
|
projectDto: ProjectDto, options?: HttpClientOptions & { observe?: any }): Observable<any> {
|
||||||
|
return this.http.put<TData>(
|
||||||
|
`http://localhost:8080/projects/${id}`,
|
||||||
|
projectDto,options
|
||||||
|
);
|
||||||
|
}
|
||||||
|
deleteProject<TData = void>(id: number, options?: HttpClientOptions & { observe?: 'body' }): Observable<TData>;
|
||||||
|
deleteProject<TData = void>(id: number, options?: HttpClientOptions & { observe: 'events' }): Observable<HttpEvent<TData>>;
|
||||||
|
deleteProject<TData = void>(id: number, options?: HttpClientOptions & { observe: 'response' }): Observable<AngularHttpResponse<TData>>;
|
||||||
|
deleteProject<TData = void>(
|
||||||
|
id: number, options?: HttpClientOptions & { observe?: any }): Observable<any> {
|
||||||
|
return this.http.delete<TData>(
|
||||||
|
`http://localhost:8080/projects/${id}`,options
|
||||||
|
);
|
||||||
|
}
|
||||||
|
loadAllProjects<TData = ProjectDto[]>( options?: HttpClientOptions & { observe?: 'body' }): Observable<TData>;
|
||||||
|
loadAllProjects<TData = ProjectDto[]>( options?: HttpClientOptions & { observe: 'events' }): Observable<HttpEvent<TData>>;
|
||||||
|
loadAllProjects<TData = ProjectDto[]>( options?: HttpClientOptions & { observe: 'response' }): Observable<AngularHttpResponse<TData>>;
|
||||||
|
loadAllProjects<TData = ProjectDto[]>(
|
||||||
|
options?: HttpClientOptions & { observe?: any }): Observable<any> {
|
||||||
|
return this.http.get<TData>(
|
||||||
|
`http://localhost:8080/projects`,options
|
||||||
|
);
|
||||||
|
}
|
||||||
|
createProject<TData = void>(projectDto: ProjectDto, options?: HttpClientOptions & { observe?: 'body' }): Observable<TData>;
|
||||||
|
createProject<TData = void>(projectDto: ProjectDto, options?: HttpClientOptions & { observe: 'events' }): Observable<HttpEvent<TData>>;
|
||||||
|
createProject<TData = void>(projectDto: ProjectDto, options?: HttpClientOptions & { observe: 'response' }): Observable<AngularHttpResponse<TData>>;
|
||||||
|
createProject<TData = void>(
|
||||||
|
projectDto: ProjectDto, options?: HttpClientOptions & { observe?: any }): Observable<any> {
|
||||||
|
return this.http.post<TData>(
|
||||||
|
`http://localhost:8080/projects`,
|
||||||
|
projectDto,options
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export type LoadProjectClientResult = NonNullable<ProjectDto>
|
||||||
|
export type UpdateProjectClientResult = NonNullable<void>
|
||||||
|
export type DeleteProjectClientResult = NonNullable<void>
|
||||||
|
export type LoadAllProjectsClientResult = NonNullable<ProjectDto[]>
|
||||||
|
export type CreateProjectClientResult = NonNullable<void>
|
||||||
@ -0,0 +1,109 @@
|
|||||||
|
/**
|
||||||
|
* Generated by orval v7.14.0 🍺
|
||||||
|
* Do not edit manually.
|
||||||
|
* OpenAPI definition
|
||||||
|
* OpenAPI spec version: v0
|
||||||
|
*/
|
||||||
|
import {
|
||||||
|
HttpClient
|
||||||
|
} from '@angular/common/http';
|
||||||
|
import type {
|
||||||
|
HttpContext,
|
||||||
|
HttpEvent,
|
||||||
|
HttpHeaders,
|
||||||
|
HttpParams,
|
||||||
|
HttpResponse as AngularHttpResponse
|
||||||
|
} from '@angular/common/http';
|
||||||
|
|
||||||
|
import {
|
||||||
|
Injectable,
|
||||||
|
inject
|
||||||
|
} from '@angular/core';
|
||||||
|
|
||||||
|
import {
|
||||||
|
Observable
|
||||||
|
} from 'rxjs';
|
||||||
|
|
||||||
|
import type {
|
||||||
|
TaskDto
|
||||||
|
} from '.././model';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
interface HttpClientOptions {
|
||||||
|
headers?: HttpHeaders | Record<string, string | string[]>;
|
||||||
|
context?: HttpContext;
|
||||||
|
params?:
|
||||||
|
| HttpParams
|
||||||
|
| Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
|
||||||
|
reportProgress?: boolean;
|
||||||
|
withCredentials?: boolean;
|
||||||
|
credentials?: RequestCredentials;
|
||||||
|
keepalive?: boolean;
|
||||||
|
priority?: RequestPriority;
|
||||||
|
cache?: RequestCache;
|
||||||
|
mode?: RequestMode;
|
||||||
|
redirect?: RequestRedirect;
|
||||||
|
referrer?: string;
|
||||||
|
integrity?: string;
|
||||||
|
transferCache?: {includeHeaders?: string[]} | boolean;
|
||||||
|
timeout?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Injectable({ providedIn: 'root' })
|
||||||
|
export class TaskControllerService {
|
||||||
|
private readonly http = inject(HttpClient);
|
||||||
|
loadTask<TData = TaskDto>(id: number, options?: HttpClientOptions & { observe?: 'body' }): Observable<TData>;
|
||||||
|
loadTask<TData = TaskDto>(id: number, options?: HttpClientOptions & { observe: 'events' }): Observable<HttpEvent<TData>>;
|
||||||
|
loadTask<TData = TaskDto>(id: number, options?: HttpClientOptions & { observe: 'response' }): Observable<AngularHttpResponse<TData>>;
|
||||||
|
loadTask<TData = TaskDto>(
|
||||||
|
id: number, options?: HttpClientOptions & { observe?: any }): Observable<any> {
|
||||||
|
return this.http.get<TData>(
|
||||||
|
`http://localhost:8080/tasks/${id}`,options
|
||||||
|
);
|
||||||
|
}
|
||||||
|
updateTask<TData = void>(id: number,
|
||||||
|
taskDto: TaskDto, options?: HttpClientOptions & { observe?: 'body' }): Observable<TData>;
|
||||||
|
updateTask<TData = void>(id: number,
|
||||||
|
taskDto: TaskDto, options?: HttpClientOptions & { observe: 'events' }): Observable<HttpEvent<TData>>;
|
||||||
|
updateTask<TData = void>(id: number,
|
||||||
|
taskDto: TaskDto, options?: HttpClientOptions & { observe: 'response' }): Observable<AngularHttpResponse<TData>>;
|
||||||
|
updateTask<TData = void>(
|
||||||
|
id: number,
|
||||||
|
taskDto: TaskDto, options?: HttpClientOptions & { observe?: any }): Observable<any> {
|
||||||
|
return this.http.put<TData>(
|
||||||
|
`http://localhost:8080/tasks/${id}`,
|
||||||
|
taskDto,options
|
||||||
|
);
|
||||||
|
}
|
||||||
|
deleteTask<TData = void>(id: number, options?: HttpClientOptions & { observe?: 'body' }): Observable<TData>;
|
||||||
|
deleteTask<TData = void>(id: number, options?: HttpClientOptions & { observe: 'events' }): Observable<HttpEvent<TData>>;
|
||||||
|
deleteTask<TData = void>(id: number, options?: HttpClientOptions & { observe: 'response' }): Observable<AngularHttpResponse<TData>>;
|
||||||
|
deleteTask<TData = void>(
|
||||||
|
id: number, options?: HttpClientOptions & { observe?: any }): Observable<any> {
|
||||||
|
return this.http.delete<TData>(
|
||||||
|
`http://localhost:8080/tasks/${id}`,options
|
||||||
|
);
|
||||||
|
}
|
||||||
|
createTask<TData = void>(projectId: number,
|
||||||
|
taskDto: TaskDto, options?: HttpClientOptions & { observe?: 'body' }): Observable<TData>;
|
||||||
|
createTask<TData = void>(projectId: number,
|
||||||
|
taskDto: TaskDto, options?: HttpClientOptions & { observe: 'events' }): Observable<HttpEvent<TData>>;
|
||||||
|
createTask<TData = void>(projectId: number,
|
||||||
|
taskDto: TaskDto, options?: HttpClientOptions & { observe: 'response' }): Observable<AngularHttpResponse<TData>>;
|
||||||
|
createTask<TData = void>(
|
||||||
|
projectId: number,
|
||||||
|
taskDto: TaskDto, options?: HttpClientOptions & { observe?: any }): Observable<any> {
|
||||||
|
return this.http.post<TData>(
|
||||||
|
`http://localhost:8080/projects/${projectId}/tasks`,
|
||||||
|
taskDto,options
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export type LoadTaskClientResult = NonNullable<TaskDto>
|
||||||
|
export type UpdateTaskClientResult = NonNullable<void>
|
||||||
|
export type DeleteTaskClientResult = NonNullable<void>
|
||||||
|
export type CreateTaskClientResult = NonNullable<void>
|
||||||
@ -0,0 +1,115 @@
|
|||||||
|
/**
|
||||||
|
* Generated by orval v7.14.0 🍺
|
||||||
|
* Do not edit manually.
|
||||||
|
* OpenAPI definition
|
||||||
|
* OpenAPI spec version: v0
|
||||||
|
*/
|
||||||
|
import {
|
||||||
|
HttpClient
|
||||||
|
} from '@angular/common/http';
|
||||||
|
import type {
|
||||||
|
HttpContext,
|
||||||
|
HttpEvent,
|
||||||
|
HttpHeaders,
|
||||||
|
HttpParams,
|
||||||
|
HttpResponse as AngularHttpResponse
|
||||||
|
} from '@angular/common/http';
|
||||||
|
|
||||||
|
import {
|
||||||
|
Injectable,
|
||||||
|
inject
|
||||||
|
} from '@angular/core';
|
||||||
|
|
||||||
|
import {
|
||||||
|
Observable
|
||||||
|
} from 'rxjs';
|
||||||
|
|
||||||
|
import type {
|
||||||
|
UserDto
|
||||||
|
} from '.././model';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
interface HttpClientOptions {
|
||||||
|
headers?: HttpHeaders | Record<string, string | string[]>;
|
||||||
|
context?: HttpContext;
|
||||||
|
params?:
|
||||||
|
| HttpParams
|
||||||
|
| Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>>;
|
||||||
|
reportProgress?: boolean;
|
||||||
|
withCredentials?: boolean;
|
||||||
|
credentials?: RequestCredentials;
|
||||||
|
keepalive?: boolean;
|
||||||
|
priority?: RequestPriority;
|
||||||
|
cache?: RequestCache;
|
||||||
|
mode?: RequestMode;
|
||||||
|
redirect?: RequestRedirect;
|
||||||
|
referrer?: string;
|
||||||
|
integrity?: string;
|
||||||
|
transferCache?: {includeHeaders?: string[]} | boolean;
|
||||||
|
timeout?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Injectable({ providedIn: 'root' })
|
||||||
|
export class UserControllerService {
|
||||||
|
private readonly http = inject(HttpClient);
|
||||||
|
loadUser<TData = UserDto>(id: number, options?: HttpClientOptions & { observe?: 'body' }): Observable<TData>;
|
||||||
|
loadUser<TData = UserDto>(id: number, options?: HttpClientOptions & { observe: 'events' }): Observable<HttpEvent<TData>>;
|
||||||
|
loadUser<TData = UserDto>(id: number, options?: HttpClientOptions & { observe: 'response' }): Observable<AngularHttpResponse<TData>>;
|
||||||
|
loadUser<TData = UserDto>(
|
||||||
|
id: number, options?: HttpClientOptions & { observe?: any }): Observable<any> {
|
||||||
|
return this.http.get<TData>(
|
||||||
|
`http://localhost:8080/users/${id}`,options
|
||||||
|
);
|
||||||
|
}
|
||||||
|
updateUser<TData = void>(id: number,
|
||||||
|
userDto: UserDto, options?: HttpClientOptions & { observe?: 'body' }): Observable<TData>;
|
||||||
|
updateUser<TData = void>(id: number,
|
||||||
|
userDto: UserDto, options?: HttpClientOptions & { observe: 'events' }): Observable<HttpEvent<TData>>;
|
||||||
|
updateUser<TData = void>(id: number,
|
||||||
|
userDto: UserDto, options?: HttpClientOptions & { observe: 'response' }): Observable<AngularHttpResponse<TData>>;
|
||||||
|
updateUser<TData = void>(
|
||||||
|
id: number,
|
||||||
|
userDto: UserDto, options?: HttpClientOptions & { observe?: any }): Observable<any> {
|
||||||
|
return this.http.put<TData>(
|
||||||
|
`http://localhost:8080/users/${id}`,
|
||||||
|
userDto,options
|
||||||
|
);
|
||||||
|
}
|
||||||
|
deleteUser<TData = void>(id: number, options?: HttpClientOptions & { observe?: 'body' }): Observable<TData>;
|
||||||
|
deleteUser<TData = void>(id: number, options?: HttpClientOptions & { observe: 'events' }): Observable<HttpEvent<TData>>;
|
||||||
|
deleteUser<TData = void>(id: number, options?: HttpClientOptions & { observe: 'response' }): Observable<AngularHttpResponse<TData>>;
|
||||||
|
deleteUser<TData = void>(
|
||||||
|
id: number, options?: HttpClientOptions & { observe?: any }): Observable<any> {
|
||||||
|
return this.http.delete<TData>(
|
||||||
|
`http://localhost:8080/users/${id}`,options
|
||||||
|
);
|
||||||
|
}
|
||||||
|
loadAllUsers<TData = UserDto[]>( options?: HttpClientOptions & { observe?: 'body' }): Observable<TData>;
|
||||||
|
loadAllUsers<TData = UserDto[]>( options?: HttpClientOptions & { observe: 'events' }): Observable<HttpEvent<TData>>;
|
||||||
|
loadAllUsers<TData = UserDto[]>( options?: HttpClientOptions & { observe: 'response' }): Observable<AngularHttpResponse<TData>>;
|
||||||
|
loadAllUsers<TData = UserDto[]>(
|
||||||
|
options?: HttpClientOptions & { observe?: any }): Observable<any> {
|
||||||
|
return this.http.get<TData>(
|
||||||
|
`http://localhost:8080/users`,options
|
||||||
|
);
|
||||||
|
}
|
||||||
|
createUser<TData = void>(userDto: UserDto, options?: HttpClientOptions & { observe?: 'body' }): Observable<TData>;
|
||||||
|
createUser<TData = void>(userDto: UserDto, options?: HttpClientOptions & { observe: 'events' }): Observable<HttpEvent<TData>>;
|
||||||
|
createUser<TData = void>(userDto: UserDto, options?: HttpClientOptions & { observe: 'response' }): Observable<AngularHttpResponse<TData>>;
|
||||||
|
createUser<TData = void>(
|
||||||
|
userDto: UserDto, options?: HttpClientOptions & { observe?: any }): Observable<any> {
|
||||||
|
return this.http.post<TData>(
|
||||||
|
`http://localhost:8080/users`,
|
||||||
|
userDto,options
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export type LoadUserClientResult = NonNullable<UserDto>
|
||||||
|
export type UpdateUserClientResult = NonNullable<void>
|
||||||
|
export type DeleteUserClientResult = NonNullable<void>
|
||||||
|
export type LoadAllUsersClientResult = NonNullable<UserDto[]>
|
||||||
|
export type CreateUserClientResult = NonNullable<void>
|
||||||
14
taskManagement/src/app/app.config.ts
Normal file
14
taskManagement/src/app/app.config.ts
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
import { ApplicationConfig, provideBrowserGlobalErrorListeners, provideZonelessChangeDetection } from '@angular/core';
|
||||||
|
import { provideRouter } from '@angular/router';
|
||||||
|
|
||||||
|
import { routes } from './app.routes';
|
||||||
|
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
|
||||||
|
|
||||||
|
export const appConfig: ApplicationConfig = {
|
||||||
|
providers: [
|
||||||
|
provideBrowserGlobalErrorListeners(),
|
||||||
|
provideZonelessChangeDetection(),
|
||||||
|
provideRouter(routes),
|
||||||
|
provideHttpClient(withInterceptorsFromDi())
|
||||||
|
]
|
||||||
|
};
|
||||||
4
taskManagement/src/app/app.html
Normal file
4
taskManagement/src/app/app.html
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
<div class="app-container">
|
||||||
|
<app-header></app-header>
|
||||||
|
<app-content></app-content>
|
||||||
|
</div>
|
||||||
8
taskManagement/src/app/app.routes.ts
Normal file
8
taskManagement/src/app/app.routes.ts
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
import { Routes } from '@angular/router';
|
||||||
|
import { ProjectPageContainer } from './components/project-page/project/project-page-container/project-page-container';
|
||||||
|
|
||||||
|
export const routes: Routes = [
|
||||||
|
{path: "", redirectTo: "/project", pathMatch: "full"},
|
||||||
|
{path: "project", component: ProjectPageContainer }
|
||||||
|
|
||||||
|
];
|
||||||
5
taskManagement/src/app/app.scss
Normal file
5
taskManagement/src/app/app.scss
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
.app-container {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
min-height: 100vh;
|
||||||
|
}
|
||||||
13
taskManagement/src/app/app.ts
Normal file
13
taskManagement/src/app/app.ts
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
import { Component, signal } from '@angular/core';
|
||||||
|
import { Header } from './components/skeleton/header/header';
|
||||||
|
import { Content } from './components/skeleton/content/content';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-root',
|
||||||
|
imports: [Header, Content],
|
||||||
|
templateUrl: './app.html',
|
||||||
|
styleUrl: './app.scss'
|
||||||
|
})
|
||||||
|
export class App {
|
||||||
|
protected readonly title = signal('taskManagement');
|
||||||
|
}
|
||||||
@ -0,0 +1,17 @@
|
|||||||
|
@if(this.showCreateDialog) {
|
||||||
|
<h2 mat-dialog-title>Create Project</h2>
|
||||||
|
} @else {
|
||||||
|
<h2 mat-dialog-title>Edit Project</h2>
|
||||||
|
}
|
||||||
|
|
||||||
|
<mat-dialog-content>
|
||||||
|
<mat-form-field>
|
||||||
|
<mat-label>Title</mat-label>
|
||||||
|
<input matInput [formControl]="title" [value]="this.projectTitle" required />
|
||||||
|
</mat-form-field>
|
||||||
|
</mat-dialog-content>
|
||||||
|
<mat-dialog-actions>
|
||||||
|
<button matButton="elevated" (click)="saveProject()">Save</button>
|
||||||
|
<button matButton="elevated" mat-dialog-close>Close</button>
|
||||||
|
</mat-dialog-actions>
|
||||||
|
|
||||||
@ -0,0 +1,23 @@
|
|||||||
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { CreateUpdateProjectDialogComponent } from './create-update-project-dialog-component';
|
||||||
|
|
||||||
|
describe('CreateProjectDialogComponent', () => {
|
||||||
|
let component: CreateUpdateProjectDialogComponent;
|
||||||
|
let fixture: ComponentFixture<CreateUpdateProjectDialogComponent>;
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
await TestBed.configureTestingModule({
|
||||||
|
imports: [CreateUpdateProjectDialogComponent]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
|
||||||
|
fixture = TestBed.createComponent(CreateUpdateProjectDialogComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
@ -0,0 +1,50 @@
|
|||||||
|
import { ChangeDetectorRef, Component, inject, OnInit } from '@angular/core';
|
||||||
|
import { FormControl, FormsModule, ReactiveFormsModule, Validators } from '@angular/forms';
|
||||||
|
import { MatButtonModule } from '@angular/material/button';
|
||||||
|
import { MAT_DIALOG_DATA, MatDialogModule, MatDialogRef } from '@angular/material/dialog';
|
||||||
|
import {MatFormFieldModule} from '@angular/material/form-field';
|
||||||
|
import { MatInputModule } from '@angular/material/input';
|
||||||
|
import { firstValueFrom, lastValueFrom } from 'rxjs';
|
||||||
|
import { ProjectControllerService } from '../../../../api/project-controller/project-controller.service.gen';
|
||||||
|
import { ProjectDto } from '../../../../api/model';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-create-project-dialog-component',
|
||||||
|
imports: [MatDialogModule, MatButtonModule, MatFormFieldModule, MatInputModule, FormsModule, ReactiveFormsModule],
|
||||||
|
templateUrl: './create-update-project-dialog-component.html',
|
||||||
|
styleUrl: './create-update-project-dialog-component.scss'
|
||||||
|
})
|
||||||
|
export class CreateUpdateProjectDialogComponent implements OnInit {
|
||||||
|
public title = new FormControl('', [Validators.required]);
|
||||||
|
private readonly _dialogRef = inject(MatDialogRef<CreateUpdateProjectDialogComponent>);
|
||||||
|
private _data = inject(MAT_DIALOG_DATA);
|
||||||
|
public showCreateDialog: boolean = true;
|
||||||
|
public projectTitle: String | undefined;
|
||||||
|
|
||||||
|
|
||||||
|
constructor(private projectService: ProjectControllerService) {}
|
||||||
|
|
||||||
|
public async ngOnInit(): Promise<void> {
|
||||||
|
if(this._data && this._data.projectId) {
|
||||||
|
this.showCreateDialog = false;
|
||||||
|
|
||||||
|
const project = await firstValueFrom(this.projectService.loadProject(this._data.projectId));
|
||||||
|
this.projectTitle = project.title;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async saveProject(): Promise<void> {
|
||||||
|
if(this.title.value) {
|
||||||
|
const project: ProjectDto = {
|
||||||
|
title: this.title.value,
|
||||||
|
}
|
||||||
|
|
||||||
|
if(this.showCreateDialog) {
|
||||||
|
await firstValueFrom( this.projectService.createProject(project));
|
||||||
|
} else {
|
||||||
|
await firstValueFrom(this.projectService.updateProject(this._data.projectId, project));
|
||||||
|
}
|
||||||
|
this._dialogRef.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
<h2 mat-dialog-title>Delete Project</h2>
|
||||||
|
<mat-dialog-content>
|
||||||
|
Are you sure you want delete the selected project with id {{this.data.projectId}}?
|
||||||
|
</mat-dialog-content>
|
||||||
|
<mat-dialog-actions>
|
||||||
|
<button matButton="elevated" (click)="deleteProject()">Yes</button>
|
||||||
|
<button matButton="elevated" mat-dialog-close>Cancel</button>
|
||||||
|
</mat-dialog-actions>
|
||||||
@ -0,0 +1,23 @@
|
|||||||
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { DeleteProjectDialog } from './delete-project-dialog';
|
||||||
|
|
||||||
|
describe('DeleteProjectDialog', () => {
|
||||||
|
let component: DeleteProjectDialog;
|
||||||
|
let fixture: ComponentFixture<DeleteProjectDialog>;
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
await TestBed.configureTestingModule({
|
||||||
|
imports: [DeleteProjectDialog]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
|
||||||
|
fixture = TestBed.createComponent(DeleteProjectDialog);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
@ -0,0 +1,32 @@
|
|||||||
|
import { Component, inject, OnInit } from '@angular/core';
|
||||||
|
import { MAT_DIALOG_DATA, MatDialogModule, MatDialogRef } from '@angular/material/dialog';
|
||||||
|
import { ProjectControllerService } from '../../../../api/project-controller/project-controller.service.gen';
|
||||||
|
import { firstValueFrom } from 'rxjs';
|
||||||
|
import { MatButtonModule } from '@angular/material/button';
|
||||||
|
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-delete-project-dialog',
|
||||||
|
imports: [MatDialogModule, MatButtonModule],
|
||||||
|
templateUrl: './delete-project-dialog.html',
|
||||||
|
styleUrl: './delete-project-dialog.scss'
|
||||||
|
})
|
||||||
|
export class DeleteProjectDialog {
|
||||||
|
public data = inject(MAT_DIALOG_DATA);
|
||||||
|
private readonly _dialogRef = inject(MatDialogRef<DeleteProjectDialog>);
|
||||||
|
|
||||||
|
constructor(private projectService: ProjectControllerService){}
|
||||||
|
|
||||||
|
public async deleteProject(): Promise<void> {
|
||||||
|
|
||||||
|
if(this.data.projectId) {
|
||||||
|
await firstValueFrom(this.projectService.deleteProject(this.data.projectId));
|
||||||
|
}
|
||||||
|
|
||||||
|
this._dialogRef.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,18 @@
|
|||||||
|
|
||||||
|
<section class="projects-navigation">
|
||||||
|
<span><h2>Projects</h2></span>
|
||||||
|
<button matMiniFab (click)="openCreateProjectDialog()" class="margin-right"><mat-icon>add</mat-icon></button>
|
||||||
|
<button matMiniFab (click)="openDeleteProjectDialog()" class="margin-right"><mat-icon>delete</mat-icon></button>
|
||||||
|
<button matMiniFab (click)="openEditProjectDialog()" class="margin-right"><mat-icon>edit</mat-icon></button>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section>
|
||||||
|
|
||||||
|
<form [formGroup]="projectForm">
|
||||||
|
<mat-selection-list #projectsList [formControl]="projectsControl" name="projects" [multiple]="false">
|
||||||
|
@for(project of this.projects; track project) {
|
||||||
|
<mat-list-option [value]="project.id" (click)="onChange(project.id)">{{project.title}}</mat-list-option>
|
||||||
|
}
|
||||||
|
</mat-selection-list>
|
||||||
|
</form>
|
||||||
|
</section>
|
||||||
@ -0,0 +1,7 @@
|
|||||||
|
.projects-navigation {
|
||||||
|
margin: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.margin-right {
|
||||||
|
margin-right: 10px;
|
||||||
|
}
|
||||||
@ -0,0 +1,23 @@
|
|||||||
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { ProjectComponent } from './project-component';
|
||||||
|
|
||||||
|
describe('ProjectComponent', () => {
|
||||||
|
let component: ProjectComponent;
|
||||||
|
let fixture: ComponentFixture<ProjectComponent>;
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
await TestBed.configureTestingModule({
|
||||||
|
imports: [ProjectComponent]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
|
||||||
|
fixture = TestBed.createComponent(ProjectComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
@ -0,0 +1,95 @@
|
|||||||
|
import { ChangeDetectorRef, Component, EventEmitter, inject, OnChanges, OnInit, Output, SimpleChanges } from '@angular/core';
|
||||||
|
import { MatButtonModule } from '@angular/material/button';
|
||||||
|
import {MatDialog} from '@angular/material/dialog';
|
||||||
|
import { CreateUpdateProjectDialogComponent } from '../create-update-project-dialog-component/create-update-project-dialog-component';
|
||||||
|
import { firstValueFrom } from 'rxjs';
|
||||||
|
import { MatListModule } from '@angular/material/list';
|
||||||
|
import { DeleteProjectDialog } from '../delete-project-dialog/delete-project-dialog';
|
||||||
|
import { FormControl, FormGroup, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
||||||
|
import { ProjectDto } from '../../../../api/model';
|
||||||
|
import { ProjectControllerService } from '../../../../api/project-controller/project-controller.service.gen';
|
||||||
|
import { MatIconModule } from '@angular/material/icon';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-project-component',
|
||||||
|
imports: [MatButtonModule, MatListModule, FormsModule, ReactiveFormsModule, MatIconModule],
|
||||||
|
templateUrl: './project-component.html',
|
||||||
|
styleUrl: './project-component.scss'
|
||||||
|
})
|
||||||
|
export class ProjectComponent implements OnInit {
|
||||||
|
public projects: ProjectDto[] = [];
|
||||||
|
public projectForm: FormGroup;
|
||||||
|
public projectsControl = new FormControl();
|
||||||
|
|
||||||
|
private readonly _createProjectDialog = inject(MatDialog);
|
||||||
|
private readonly _deleteProjectDialog = inject(MatDialog);
|
||||||
|
private readonly _editProjectDialog = inject(MatDialog);
|
||||||
|
private _changeDetection = inject(ChangeDetectorRef);
|
||||||
|
|
||||||
|
@Output()
|
||||||
|
selectedProject = new EventEmitter<ProjectDto>();
|
||||||
|
|
||||||
|
constructor(private _projectService: ProjectControllerService) {
|
||||||
|
this.projectForm = new FormGroup({
|
||||||
|
projects: this.projectsControl,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public openCreateProjectDialog() {
|
||||||
|
const dialogRef = this._createProjectDialog.open(CreateUpdateProjectDialogComponent);
|
||||||
|
|
||||||
|
dialogRef.afterClosed().subscribe(async () => {
|
||||||
|
await this._loadProjects();
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
public openDeleteProjectDialog() {
|
||||||
|
const dialogRef = this._deleteProjectDialog.open(DeleteProjectDialog, {
|
||||||
|
data: {
|
||||||
|
projectId: this.projectsControl.value
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
dialogRef.afterClosed().subscribe(async () => {
|
||||||
|
await this._loadProjects();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public openEditProjectDialog() {
|
||||||
|
const dialogRef = this._editProjectDialog.open(CreateUpdateProjectDialogComponent, {
|
||||||
|
data: {
|
||||||
|
projectId: this.projectsControl.value
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
dialogRef.afterClosed().subscribe(async () => {
|
||||||
|
await this._loadProjects();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public onChange(projectId: number | undefined) {
|
||||||
|
if(projectId) {
|
||||||
|
let project: ProjectDto | undefined;
|
||||||
|
this.projects.forEach(_project => {
|
||||||
|
if(_project.id === projectId) {
|
||||||
|
project = _project;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.selectedProject.emit(project);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public async ngOnInit(): Promise<void> {
|
||||||
|
await this._loadProjects();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async _loadProjects() {
|
||||||
|
try {
|
||||||
|
this.projects = await firstValueFrom(this._projectService.loadAllProjects());
|
||||||
|
this._changeDetection.detectChanges();
|
||||||
|
} catch(error) {
|
||||||
|
console.error("Error loading projects: ", error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
<mat-drawer-container class="container">
|
||||||
|
<mat-drawer mode="side" opened><app-project-component (selectedProject)="showTasks($event)"></app-project-component></mat-drawer>
|
||||||
|
<mat-drawer-content class="content-area">
|
||||||
|
@if(this.selectedProjectSubject.value){
|
||||||
|
<app-task-component [project]="selectedProject$ | async"></app-task-component>
|
||||||
|
}
|
||||||
|
</mat-drawer-content>
|
||||||
|
</mat-drawer-container>
|
||||||
@ -0,0 +1,10 @@
|
|||||||
|
.container {
|
||||||
|
flex: 1;
|
||||||
|
width: 100%;
|
||||||
|
height: 90vh;
|
||||||
|
margin: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content-area {
|
||||||
|
padding-left: 50px;
|
||||||
|
}
|
||||||
@ -0,0 +1,23 @@
|
|||||||
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { Project } from './project-page-container';
|
||||||
|
|
||||||
|
describe('Project', () => {
|
||||||
|
let component: Project;
|
||||||
|
let fixture: ComponentFixture<Project>;
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
await TestBed.configureTestingModule({
|
||||||
|
imports: [Project]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
|
||||||
|
fixture = TestBed.createComponent(Project);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
@ -0,0 +1,26 @@
|
|||||||
|
import { Component } from '@angular/core';
|
||||||
|
import { BehaviorSubject } from 'rxjs';
|
||||||
|
import { MatSidenavModule } from '@angular/material/sidenav';
|
||||||
|
import { CommonModule } from '@angular/common';
|
||||||
|
import { ProjectDto } from '../../../../api/model';
|
||||||
|
import { ProjectComponent } from '../project-component/project-component';
|
||||||
|
import { TaskComponent } from '../../task/task-component/task-component';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-project',
|
||||||
|
imports: [MatSidenavModule, ProjectComponent, TaskComponent, CommonModule],
|
||||||
|
templateUrl: './project-page-container.html',
|
||||||
|
styleUrl: './project-page-container.scss'
|
||||||
|
})
|
||||||
|
export class ProjectPageContainer {
|
||||||
|
public selectedProjectSubject = new BehaviorSubject<ProjectDto | null>(null);
|
||||||
|
public selectedProject$ = this.selectedProjectSubject.asObservable();
|
||||||
|
|
||||||
|
|
||||||
|
public showTasks(project: ProjectDto) {
|
||||||
|
this.selectedProjectSubject.next(project);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -0,0 +1,45 @@
|
|||||||
|
@if(this.showCreateDialog) {
|
||||||
|
<h2 mat-dialog-title>Create Task</h2>
|
||||||
|
} @else {
|
||||||
|
<h2 mat-dialog-title>Edit Task</h2>
|
||||||
|
}
|
||||||
|
|
||||||
|
<mat-dialog-content>
|
||||||
|
<mat-form-field>
|
||||||
|
<mat-label>Title</mat-label>
|
||||||
|
<input matInput [formControl]="title" [value]="this.taskTitle" required />
|
||||||
|
</mat-form-field>
|
||||||
|
<br />
|
||||||
|
<mat-form-field>
|
||||||
|
<mat-label>Description</mat-label>
|
||||||
|
<input matInput [formControl]="description" [value]="this.taskDescription"/>
|
||||||
|
</mat-form-field>
|
||||||
|
<br />
|
||||||
|
<mat-form-field>
|
||||||
|
<mat-label>Status</mat-label>
|
||||||
|
<mat-select [(ngModel)]="selectedStatus" name="status" required>
|
||||||
|
@for (status of statusEnum; track status) {
|
||||||
|
@if(this.showCreateDialog) {
|
||||||
|
<mat-option [value]="status">{{status}}</mat-option>
|
||||||
|
} @else {
|
||||||
|
<mat-option [value]="this.selectedStatus">{{status}}</mat-option>
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
</mat-select>
|
||||||
|
</mat-form-field>
|
||||||
|
<br />
|
||||||
|
<mat-form-field>
|
||||||
|
<mat-label>User</mat-label>
|
||||||
|
<mat-select [(ngModel)]="selectedUser" name="user" multiple required>
|
||||||
|
@for(user of userList; track user) {
|
||||||
|
<mat-option [value]="user">{{user.firstName}} {{user.lastName}}</mat-option>
|
||||||
|
|
||||||
|
}
|
||||||
|
</mat-select>
|
||||||
|
</mat-form-field>
|
||||||
|
</mat-dialog-content>
|
||||||
|
<mat-dialog-actions>
|
||||||
|
<button matButton="elevated" (click)="saveTask()">Save</button>
|
||||||
|
<button matButton="elevated" mat-dialog-close>Close</button>
|
||||||
|
</mat-dialog-actions>
|
||||||
@ -0,0 +1,23 @@
|
|||||||
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { CreateTaskDialogComponent } from './create-update-task-dialog-component';
|
||||||
|
|
||||||
|
describe('CreateTaskDialogComponent', () => {
|
||||||
|
let component: CreateTaskDialogComponent;
|
||||||
|
let fixture: ComponentFixture<CreateTaskDialogComponent>;
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
await TestBed.configureTestingModule({
|
||||||
|
imports: [CreateTaskDialogComponent]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
|
||||||
|
fixture = TestBed.createComponent(CreateTaskDialogComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
@ -0,0 +1,67 @@
|
|||||||
|
import { Component, inject, OnInit } from '@angular/core';
|
||||||
|
import { FormControl, FormsModule, ReactiveFormsModule, Validators } from '@angular/forms';
|
||||||
|
import { MAT_DIALOG_DATA, MatDialogModule, MatDialogRef } from '@angular/material/dialog';
|
||||||
|
import { firstValueFrom, lastValueFrom } from 'rxjs';
|
||||||
|
import { MatButtonModule } from '@angular/material/button';
|
||||||
|
import { MatFormFieldModule } from '@angular/material/form-field';
|
||||||
|
import { MatInputModule } from '@angular/material/input';
|
||||||
|
import { MatSelectModule } from '@angular/material/select';
|
||||||
|
import { TaskControllerService } from '../../../../api/task-controller/task-controller.service.gen';
|
||||||
|
import { TaskDto, TaskDtoStatus, UserDto } from '../../../../api/model';
|
||||||
|
import { UserControllerService } from '../../../../api/user-controller/user-controller.service.gen';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-create-task-dialog-component',
|
||||||
|
imports: [MatDialogModule, MatButtonModule, MatFormFieldModule, MatInputModule, FormsModule, ReactiveFormsModule, MatSelectModule],
|
||||||
|
templateUrl: './create-update-task-dialog-component.html',
|
||||||
|
styleUrl: './create-update-task-dialog-component.scss'
|
||||||
|
})
|
||||||
|
export class CreateUpdateTaskDialogComponent implements OnInit {
|
||||||
|
public title = new FormControl('', [Validators.required]);
|
||||||
|
public description = new FormControl('');
|
||||||
|
public dialogRef = inject(MatDialogRef<CreateUpdateTaskDialogComponent>);
|
||||||
|
private _data = inject(MAT_DIALOG_DATA);
|
||||||
|
public statusEnum = Object.values(TaskDtoStatus);
|
||||||
|
public selectedStatus: TaskDtoStatus | undefined;
|
||||||
|
public userList: UserDto[] = [];
|
||||||
|
public selectedUser: UserDto[] = [];
|
||||||
|
public showCreateDialog: boolean = true;
|
||||||
|
public taskTitle: string | undefined;
|
||||||
|
public taskDescription: string | undefined;
|
||||||
|
|
||||||
|
|
||||||
|
constructor(private taskService: TaskControllerService, private userService: UserControllerService) {}
|
||||||
|
|
||||||
|
async ngOnInit(): Promise<void> {
|
||||||
|
this.userList = await firstValueFrom(this.userService.loadAllUsers());
|
||||||
|
if(this._data && this._data.task) {
|
||||||
|
this.showCreateDialog = false;
|
||||||
|
this.selectedStatus = this._data.task.status;
|
||||||
|
this.selectedUser = this.userList.filter(userFromList =>
|
||||||
|
this._data.task.users.some((user: { id: number | undefined; }) => user.id === userFromList.id));
|
||||||
|
this.title.setValue(this._data.task.title);
|
||||||
|
this.description.setValue(this._data.task.description);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async saveTask(): Promise<void> {
|
||||||
|
if(this.title.value) {
|
||||||
|
const task: TaskDto = {
|
||||||
|
title: this.title.value,
|
||||||
|
description: this.description.value as string | undefined,
|
||||||
|
projectId: this._data.project.id,
|
||||||
|
status: this.selectedStatus,
|
||||||
|
users: this.selectedUser,
|
||||||
|
}
|
||||||
|
|
||||||
|
if(this.showCreateDialog) {
|
||||||
|
await firstValueFrom(this.taskService.createTask(this._data.project.id, task));
|
||||||
|
} else {
|
||||||
|
await firstValueFrom(this.taskService.updateTask(this._data.taskId, task));
|
||||||
|
}
|
||||||
|
|
||||||
|
this.dialogRef.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,9 @@
|
|||||||
|
<h2 mat-dialog-title>Delete Task</h2>
|
||||||
|
<mat-dialog-content>
|
||||||
|
Are you sure you want delete the selected task with id {{this.data.taskId}}?
|
||||||
|
</mat-dialog-content>
|
||||||
|
<mat-dialog-actions>
|
||||||
|
<button matButton="elevated" (click)="deleteTask()">Yes</button>
|
||||||
|
<button matButton="elevated" mat-dialog-close>Cancel</button>
|
||||||
|
</mat-dialog-actions>
|
||||||
|
|
||||||
@ -0,0 +1,23 @@
|
|||||||
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { DeleteTaskDialogComponent } from './delete-task-dialog-component';
|
||||||
|
|
||||||
|
describe('DeleteTaskDialogComponent', () => {
|
||||||
|
let component: DeleteTaskDialogComponent;
|
||||||
|
let fixture: ComponentFixture<DeleteTaskDialogComponent>;
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
await TestBed.configureTestingModule({
|
||||||
|
imports: [DeleteTaskDialogComponent]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
|
||||||
|
fixture = TestBed.createComponent(DeleteTaskDialogComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
@ -0,0 +1,27 @@
|
|||||||
|
import { Component, inject } from '@angular/core';
|
||||||
|
import { MatButtonModule } from '@angular/material/button';
|
||||||
|
import { MAT_DIALOG_DATA, MatDialogModule, MatDialogRef } from '@angular/material/dialog';
|
||||||
|
import { firstValueFrom } from 'rxjs';
|
||||||
|
import { TaskControllerService } from '../../../../api/task-controller/task-controller.service.gen';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-delete-task-dialog-component',
|
||||||
|
imports: [MatDialogModule, MatButtonModule],
|
||||||
|
templateUrl: './delete-task-dialog-component.html',
|
||||||
|
styleUrl: './delete-task-dialog-component.scss'
|
||||||
|
})
|
||||||
|
export class DeleteTaskDialogComponent {
|
||||||
|
public data = inject(MAT_DIALOG_DATA);
|
||||||
|
private readonly _dialogRef = inject(MatDialogRef<DeleteTaskDialogComponent>);
|
||||||
|
|
||||||
|
constructor(private taskService: TaskControllerService){}
|
||||||
|
|
||||||
|
public async deleteTask(): Promise<void> {
|
||||||
|
if(this.data.taskId) {
|
||||||
|
await firstValueFrom(this.taskService.deleteTask(this.data.taskId));
|
||||||
|
}
|
||||||
|
|
||||||
|
this._dialogRef.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,25 @@
|
|||||||
|
<div class="container">
|
||||||
|
<section class="section-task-list">
|
||||||
|
<section>
|
||||||
|
<h2>Project Details</h2>
|
||||||
|
<button matMiniFab (click)="openCreateTaskDialog()"><mat-icon>add</mat-icon></button>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section>
|
||||||
|
<form [formGroup]="taskForm">
|
||||||
|
<mat-selection-list #taskList [formControl]="taskControl" name="tasks" [multiple]="false">
|
||||||
|
@for(task of this.tasks; track task) {
|
||||||
|
<mat-list-option (click)="onChange(task.id)" [value]="task.id">{{task.title}}</mat-list-option>
|
||||||
|
}
|
||||||
|
</mat-selection-list>
|
||||||
|
</form>
|
||||||
|
</section>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="section-task-details">
|
||||||
|
@if((this.selectedTask$ | async) !== null) {
|
||||||
|
<app-task-details-component [selectedTask]="this.selectedTask$ | async" [selectedProject]="this.selectedProject" (updateTask)="updateTask($event)"></app-task-details-component>
|
||||||
|
}
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
|
||||||
@ -0,0 +1,12 @@
|
|||||||
|
.container {
|
||||||
|
display: flex;
|
||||||
|
gap: 50px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.section-task-list {
|
||||||
|
flex: 0 0 40%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.section-task-details {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
@ -0,0 +1,23 @@
|
|||||||
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { TaskComponent } from './task-component';
|
||||||
|
|
||||||
|
describe('TaskComponent', () => {
|
||||||
|
let component: TaskComponent;
|
||||||
|
let fixture: ComponentFixture<TaskComponent>;
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
await TestBed.configureTestingModule({
|
||||||
|
imports: [TaskComponent]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
|
||||||
|
fixture = TestBed.createComponent(TaskComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
@ -0,0 +1,95 @@
|
|||||||
|
import { ChangeDetectorRef, Component, EventEmitter, inject, Input, OnInit, Output } from '@angular/core';
|
||||||
|
import { MatDialog } from '@angular/material/dialog';
|
||||||
|
import { MatButtonModule } from '@angular/material/button';
|
||||||
|
import { MatListModule } from '@angular/material/list';
|
||||||
|
import { FormControl, FormGroup, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
||||||
|
import { TaskDetailsComponent } from '../task-details-component/task-details-component';
|
||||||
|
import { ProjectDto, TaskDto } from '../../../../api/model';
|
||||||
|
import { TaskControllerService } from '../../../../api/task-controller/task-controller.service.gen';
|
||||||
|
import { ProjectControllerService } from '../../../../api/project-controller/project-controller.service.gen';
|
||||||
|
import { MatIconModule } from '@angular/material/icon';
|
||||||
|
import { BehaviorSubject, firstValueFrom } from 'rxjs';
|
||||||
|
import { MatGridListModule } from '@angular/material/grid-list';
|
||||||
|
import { CreateUpdateTaskDialogComponent } from '../create-update-task-dialog-component/create-update-task-dialog-component';
|
||||||
|
import { CommonModule } from '@angular/common';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-task-component',
|
||||||
|
imports: [MatButtonModule, MatListModule, FormsModule, ReactiveFormsModule, TaskDetailsComponent, MatIconModule, MatGridListModule, CommonModule],
|
||||||
|
templateUrl: './task-component.html',
|
||||||
|
styleUrl: './task-component.scss'
|
||||||
|
})
|
||||||
|
export class TaskComponent {
|
||||||
|
private readonly _createTaskDialog = inject(MatDialog);
|
||||||
|
public tasks: TaskDto[] | undefined = [];
|
||||||
|
public taskForm: FormGroup;
|
||||||
|
public taskControl = new FormControl();
|
||||||
|
public selectedTaskSubject = new BehaviorSubject<TaskDto | null>(null);
|
||||||
|
public selectedProject: ProjectDto | null | undefined;
|
||||||
|
public selectedTask$ = this.selectedTaskSubject.asObservable();
|
||||||
|
private _changeDetection = inject(ChangeDetectorRef);
|
||||||
|
|
||||||
|
|
||||||
|
@Input() set project(value: ProjectDto | null) {
|
||||||
|
this.tasks = []
|
||||||
|
this.selectedProject = value;
|
||||||
|
this.tasks = value?.tasks;
|
||||||
|
this._changeDetection.detectChanges();
|
||||||
|
this._updateProject();
|
||||||
|
}
|
||||||
|
|
||||||
|
constructor(private taskService: TaskControllerService,
|
||||||
|
private projectService: ProjectControllerService,
|
||||||
|
){
|
||||||
|
this.taskForm = new FormGroup({
|
||||||
|
tasks: this.taskControl,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
public openCreateTaskDialog() {
|
||||||
|
const dialogRef = this._createTaskDialog.open(CreateUpdateTaskDialogComponent, {
|
||||||
|
data: {
|
||||||
|
project: this.selectedProject
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
dialogRef.afterClosed().subscribe(async () => {
|
||||||
|
await this._updateTasks();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public async onChange(taskId: number | undefined) {
|
||||||
|
if(taskId) {
|
||||||
|
const taskDetails = await firstValueFrom(this.taskService.loadTask(taskId));
|
||||||
|
this.selectedTaskSubject.next(taskDetails);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async updateTask(task: TaskDto) {
|
||||||
|
await this._updateTasks();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async _updateTasks() {
|
||||||
|
try {
|
||||||
|
if(this.selectedProject?.id) {
|
||||||
|
const updatedProject = await firstValueFrom(this.projectService.loadProject(this.selectedProject?.id));
|
||||||
|
this.project = { ...updatedProject};
|
||||||
|
if(updatedProject.tasks) {
|
||||||
|
this.tasks = [ ...updatedProject.tasks];
|
||||||
|
this.tasks.forEach((task) => {
|
||||||
|
if(this.selectedTaskSubject.value?.id === task.id) {
|
||||||
|
this.taskControl.setValue(task.id);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this._changeDetection.detectChanges();
|
||||||
|
} catch(error) {
|
||||||
|
console.error("Error loading task: ", error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private _updateProject(): void {
|
||||||
|
this.tasks = this.selectedProject?.tasks ?? [];
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,30 @@
|
|||||||
|
|
||||||
|
<h2>Task Details</h2>
|
||||||
|
<button matMiniFab (click)="openDeleteTaskDialog()" class="margin-right"><mat-icon>delete</mat-icon></button>
|
||||||
|
<button matMiniFab (click)="openEditTaskDialog()"><mat-icon>edit</mat-icon></button>
|
||||||
|
|
||||||
|
<section>
|
||||||
|
@if(this.task && this.task.description) {
|
||||||
|
<h2>Description</h2>
|
||||||
|
{{this.task.description}}
|
||||||
|
}
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section>
|
||||||
|
@if(this.task && this.task.status) {
|
||||||
|
<h2>Status</h2>
|
||||||
|
{{this.task.status}}
|
||||||
|
}
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section>
|
||||||
|
@if(this.task && this.task.users) {
|
||||||
|
<h2>User</h2>
|
||||||
|
@for(user of this.task.users; track user) {
|
||||||
|
<mat-chip class="margin-right">{{user.firstName}} {{user.lastName}}</mat-chip>
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
</section>
|
||||||
|
|
||||||
|
|
||||||
@ -0,0 +1,3 @@
|
|||||||
|
.margin-right {
|
||||||
|
margin-right: 10px;
|
||||||
|
}
|
||||||
@ -0,0 +1,23 @@
|
|||||||
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { TaskDetailsComponent } from './task-details-component';
|
||||||
|
|
||||||
|
describe('TaskDetailsComponent', () => {
|
||||||
|
let component: TaskDetailsComponent;
|
||||||
|
let fixture: ComponentFixture<TaskDetailsComponent>;
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
await TestBed.configureTestingModule({
|
||||||
|
imports: [TaskDetailsComponent]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
|
||||||
|
fixture = TestBed.createComponent(TaskDetailsComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
@ -0,0 +1,85 @@
|
|||||||
|
import { Component, EventEmitter, inject, Input, OnInit, Output } from '@angular/core';
|
||||||
|
import { DeleteTaskDialogComponent } from '../delete-task-dialog-component/delete-task-dialog-component';
|
||||||
|
import { MatDialog } from '@angular/material/dialog';
|
||||||
|
import { MatButtonModule } from '@angular/material/button';
|
||||||
|
import { ProjectDto, TaskDto } from '../../../../api/model';
|
||||||
|
import { CreateUpdateTaskDialogComponent } from '../create-update-task-dialog-component/create-update-task-dialog-component';
|
||||||
|
import { MatChipsModule } from '@angular/material/chips';
|
||||||
|
import { MatIconModule } from '@angular/material/icon';
|
||||||
|
import { TaskControllerService } from '../../../../api/task-controller/task-controller.service.gen';
|
||||||
|
import { firstValueFrom } from 'rxjs';
|
||||||
|
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-task-details-component',
|
||||||
|
imports: [MatButtonModule, MatChipsModule, MatIconModule],
|
||||||
|
templateUrl: './task-details-component.html',
|
||||||
|
styleUrl: './task-details-component.scss'
|
||||||
|
})
|
||||||
|
export class TaskDetailsComponent{
|
||||||
|
|
||||||
|
private readonly _deleteTaskDialog = inject(MatDialog);
|
||||||
|
private readonly _editTaskDialog = inject(MatDialog);
|
||||||
|
public task: TaskDto | undefined | null;
|
||||||
|
private _project: ProjectDto | undefined | null;
|
||||||
|
|
||||||
|
@Input()
|
||||||
|
set selectedTask(value: TaskDto | null) {
|
||||||
|
this.task = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Input()
|
||||||
|
set selectedProject(value: ProjectDto | undefined | null) {
|
||||||
|
this._project = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Output()
|
||||||
|
updateTask = new EventEmitter<TaskDto>();
|
||||||
|
|
||||||
|
constructor(private _taskService: TaskControllerService) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public openDeleteTaskDialog() {
|
||||||
|
const dialogRef = this._deleteTaskDialog.open(DeleteTaskDialogComponent, {
|
||||||
|
data: {
|
||||||
|
taskId: this.task?.id,
|
||||||
|
project: this._project
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
dialogRef.afterClosed().subscribe(async () => {
|
||||||
|
await this._updateTaskDetails();
|
||||||
|
if(this.task) {
|
||||||
|
this.updateTask.emit(this.task);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public openEditTaskDialog() {
|
||||||
|
const dialogRef = this._editTaskDialog.open(CreateUpdateTaskDialogComponent, {
|
||||||
|
data: {
|
||||||
|
taskId: this.task?.id,
|
||||||
|
project: this._project,
|
||||||
|
task: this.task,
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
dialogRef.afterClosed().subscribe(async () => {
|
||||||
|
await this._updateTaskDetails();
|
||||||
|
if(this.task) {
|
||||||
|
this.updateTask.emit(this.task);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private async _updateTaskDetails() {
|
||||||
|
if(this.task && this.task.id) {
|
||||||
|
const updatedTask = await firstValueFrom(this._taskService.loadTask(this.task.id));
|
||||||
|
this.task = updatedTask;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,3 @@
|
|||||||
|
<div class="content">
|
||||||
|
<router-outlet></router-outlet>
|
||||||
|
</div>
|
||||||
@ -0,0 +1,4 @@
|
|||||||
|
.content {
|
||||||
|
flex: 1;
|
||||||
|
padding: 2rem;
|
||||||
|
}
|
||||||
@ -0,0 +1,23 @@
|
|||||||
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { Content } from './content';
|
||||||
|
|
||||||
|
describe('Content', () => {
|
||||||
|
let component: Content;
|
||||||
|
let fixture: ComponentFixture<Content>;
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
await TestBed.configureTestingModule({
|
||||||
|
imports: [Content]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
|
||||||
|
fixture = TestBed.createComponent(Content);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
@ -0,0 +1,12 @@
|
|||||||
|
import { Component } from '@angular/core';
|
||||||
|
import { RouterOutlet } from '@angular/router';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-content',
|
||||||
|
imports: [RouterOutlet],
|
||||||
|
templateUrl: './content.html',
|
||||||
|
styleUrl: './content.scss'
|
||||||
|
})
|
||||||
|
export class Content {
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,3 @@
|
|||||||
|
<mat-toolbar>
|
||||||
|
<a routerLink="/">Project</a>
|
||||||
|
</mat-toolbar>
|
||||||
@ -0,0 +1,23 @@
|
|||||||
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { Header } from './header';
|
||||||
|
|
||||||
|
describe('Header', () => {
|
||||||
|
let component: Header;
|
||||||
|
let fixture: ComponentFixture<Header>;
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
await TestBed.configureTestingModule({
|
||||||
|
imports: [Header]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
|
||||||
|
fixture = TestBed.createComponent(Header);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
13
taskManagement/src/app/components/skeleton/header/header.ts
Normal file
13
taskManagement/src/app/components/skeleton/header/header.ts
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
import { Component } from '@angular/core';
|
||||||
|
import { MatToolbarModule } from '@angular/material/toolbar';
|
||||||
|
import { RouterLink } from '@angular/router';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-header',
|
||||||
|
imports: [MatToolbarModule, RouterLink],
|
||||||
|
templateUrl: './header.html',
|
||||||
|
styleUrl: './header.scss'
|
||||||
|
})
|
||||||
|
export class Header {
|
||||||
|
|
||||||
|
}
|
||||||
14
taskManagement/src/index.html
Normal file
14
taskManagement/src/index.html
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>TaskManagement</title>
|
||||||
|
<base href="/">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<link rel="icon" type="image/x-icon" href="favicon.ico">
|
||||||
|
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<app-root></app-root>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
6
taskManagement/src/main.ts
Normal file
6
taskManagement/src/main.ts
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
import { bootstrapApplication } from '@angular/platform-browser';
|
||||||
|
import { appConfig } from './app/app.config';
|
||||||
|
import { App } from './app/app';
|
||||||
|
|
||||||
|
bootstrapApplication(App, appConfig)
|
||||||
|
.catch((err) => console.error(err));
|
||||||
18
taskManagement/src/styles.scss
Normal file
18
taskManagement/src/styles.scss
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
/* You can add global styles to this file, and also import other style files */
|
||||||
|
@use '@angular/material' as mat;
|
||||||
|
|
||||||
|
@include mat.core();
|
||||||
|
|
||||||
|
html {
|
||||||
|
color-scheme: light;
|
||||||
|
@include mat.theme((
|
||||||
|
color: mat.$azure-palette,
|
||||||
|
typography: Roboto,
|
||||||
|
density: 0
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
background: var(--mat-sys-surface);
|
||||||
|
color: var(--mat-sys-on-surface);
|
||||||
|
}
|
||||||
15
taskManagement/tsconfig.app.json
Normal file
15
taskManagement/tsconfig.app.json
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
/* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
|
||||||
|
/* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
|
||||||
|
{
|
||||||
|
"extends": "./tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"outDir": "./out-tsc/app",
|
||||||
|
"types": []
|
||||||
|
},
|
||||||
|
"include": [
|
||||||
|
"src/**/*.ts"
|
||||||
|
],
|
||||||
|
"exclude": [
|
||||||
|
"src/**/*.spec.ts"
|
||||||
|
]
|
||||||
|
}
|
||||||
34
taskManagement/tsconfig.json
Normal file
34
taskManagement/tsconfig.json
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
/* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
|
||||||
|
/* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
|
||||||
|
{
|
||||||
|
"compileOnSave": false,
|
||||||
|
"compilerOptions": {
|
||||||
|
"strict": true,
|
||||||
|
"noImplicitOverride": true,
|
||||||
|
"noPropertyAccessFromIndexSignature": true,
|
||||||
|
"noImplicitReturns": true,
|
||||||
|
"noFallthroughCasesInSwitch": true,
|
||||||
|
"skipLibCheck": true,
|
||||||
|
"isolatedModules": true,
|
||||||
|
"experimentalDecorators": true,
|
||||||
|
"importHelpers": true,
|
||||||
|
"target": "ES2022",
|
||||||
|
"module": "preserve"
|
||||||
|
},
|
||||||
|
"angularCompilerOptions": {
|
||||||
|
"enableI18nLegacyMessageIdFormat": false,
|
||||||
|
"strictInjectionParameters": true,
|
||||||
|
"strictInputAccessModifiers": true,
|
||||||
|
"typeCheckHostBindings": true,
|
||||||
|
"strictTemplates": true
|
||||||
|
},
|
||||||
|
"files": [],
|
||||||
|
"references": [
|
||||||
|
{
|
||||||
|
"path": "./tsconfig.app.json"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "./tsconfig.spec.json"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
14
taskManagement/tsconfig.spec.json
Normal file
14
taskManagement/tsconfig.spec.json
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
/* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
|
||||||
|
/* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
|
||||||
|
{
|
||||||
|
"extends": "./tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"outDir": "./out-tsc/spec",
|
||||||
|
"types": [
|
||||||
|
"jasmine"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"include": [
|
||||||
|
"src/**/*.ts"
|
||||||
|
]
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user