Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 41741550

Přidáno uživatelem Hung Hoang před téměř 6 roky(ů)

Re #7472 Implemented services for REST API

Zobrazit rozdíly:

server/.gitignore
1
# See http://help.github.com/ignore-files/ for more about ignoring files.
2

  
3
# compiled output
4
/dist
5
/tmp
6
/out-tsc
7
# Only exists if Bazel was run
8
/bazel-out
9

  
10
yarn.lock
11
# dependencies
12
/node_modules
13

  
14
# profiling files
15
chrome-profiler-events.json
16
speed-measure-plugin.json
17

  
18
# IDEs and editors
19
/.idea
20
.project
21
.classpath
22
.c9/
23
target/
24
*.launch
25
.settings/
26
*.sublime-workspace
27

  
28
# IDE - VSCode
29
.vscode/*
30
!.vscode/settings.json
31
!.vscode/tasks.json
32
!.vscode/launch.json
33
!.vscode/extensions.json
34
.history/*
35

  
36
# misc
37
/.sass-cache
38
/connect.lock
39
/coverage
40
/libpeerconnection.log
41
npm-debug.log
42
yarn-error.log
43
testem.log
44
/typings
45

  
46
# System Files
47
.DS_Store
48
Thumbs.db
server/docker-compose.yml
1
version: '3.1'
2

  
3
services:
4

  
5
  app:
6
    image: openjdk:13-jdk-alpine
7
    container_name: yamanager_app
8
    volumes:
9
      - /tmp
10
      - ./target/ymanager-1.0-SNAPSHOT-full-app.jar:/app.jar
11
    entrypoint: java -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005 -Djava.security.egd=file:/dev/./urandom -jar /app.jar
12
    restart: always
13
    ports:
14
      - 9080:8080
15
      - 6005:5005
16
    depends_on:
17
      - db
18
    links:
19
      - db
20

  
21
  db:
22
    image: mariadb
23
    container_name: yamanager_db
24
    restart: always
25
    volumes:
26
      - ./init.sql:/docker-entrypoint-initdb.d/init.sql
27
    environment:
28
      MYSQL_ROOT_PASSWORD: root
29
      MYSQL_USER: user
30
      MYSQL_PASSWORD: passwd
31
      MYSQL_DATABASE: yamanager
32
    ports:
33
      - 3306:3306
server/ymanager.iml
1
<?xml version="1.0" encoding="UTF-8"?>
2
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
3
  <component name="FacetManager">
4
    <facet type="Spring" name="Spring">
5
      <configuration />
6
    </facet>
7
    <facet type="web" name="Web">
8
      <configuration>
9
        <webroots />
10
        <sourceRoots>
11
          <root url="file://$MODULE_DIR$/src/main/java" />
12
          <root url="file://$MODULE_DIR$/src/main/resources" />
13
        </sourceRoots>
14
      </configuration>
15
    </facet>
16
  </component>
17
  <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
18
    <output url="file://$MODULE_DIR$/target/classes" />
19
    <output-test url="file://$MODULE_DIR$/target/test-classes" />
20
    <content url="file://$MODULE_DIR$">
21
      <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
22
      <sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
23
      <sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
24
      <sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
25
      <excludeFolder url="file://$MODULE_DIR$/target" />
26
    </content>
27
    <orderEntry type="inheritedJdk" />
28
    <orderEntry type="sourceFolder" forTests="false" />
29
    <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-web:2.0.5.RELEASE" level="project" />
30
    <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:2.0.5.RELEASE" level="project" />
31
    <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:2.0.5.RELEASE" level="project" />
32
    <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-autoconfigure:2.0.5.RELEASE" level="project" />
33
    <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-logging:2.0.5.RELEASE" level="project" />
34
    <orderEntry type="library" name="Maven: ch.qos.logback:logback-classic:1.2.3" level="project" />
35
    <orderEntry type="library" name="Maven: ch.qos.logback:logback-core:1.2.3" level="project" />
36
    <orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-to-slf4j:2.10.0" level="project" />
37
    <orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-api:2.10.0" level="project" />
38
    <orderEntry type="library" name="Maven: org.slf4j:jul-to-slf4j:1.7.25" level="project" />
39
    <orderEntry type="library" name="Maven: javax.annotation:javax.annotation-api:1.3.2" level="project" />
40
    <orderEntry type="library" scope="RUNTIME" name="Maven: org.yaml:snakeyaml:1.19" level="project" />
41
    <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-json:2.0.5.RELEASE" level="project" />
42
    <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.9.6" level="project" />
43
    <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.9.0" level="project" />
44
    <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.9.6" level="project" />
45
    <orderEntry type="library" name="Maven: com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.9.6" level="project" />
46
    <orderEntry type="library" name="Maven: com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.9.6" level="project" />
47
    <orderEntry type="library" name="Maven: com.fasterxml.jackson.module:jackson-module-parameter-names:2.9.6" level="project" />
48
    <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-tomcat:2.0.5.RELEASE" level="project" />
49
    <orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-core:8.5.34" level="project" />
50
    <orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-el:8.5.34" level="project" />
51
    <orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-websocket:8.5.34" level="project" />
52
    <orderEntry type="library" name="Maven: org.hibernate.validator:hibernate-validator:6.0.12.Final" level="project" />
53
    <orderEntry type="library" name="Maven: javax.validation:validation-api:2.0.1.Final" level="project" />
54
    <orderEntry type="library" name="Maven: org.jboss.logging:jboss-logging:3.3.2.Final" level="project" />
55
    <orderEntry type="library" name="Maven: com.fasterxml:classmate:1.3.4" level="project" />
56
    <orderEntry type="library" name="Maven: org.springframework:spring-web:5.0.9.RELEASE" level="project" />
57
    <orderEntry type="library" name="Maven: org.springframework:spring-beans:5.0.9.RELEASE" level="project" />
58
    <orderEntry type="library" name="Maven: org.springframework:spring-webmvc:5.0.9.RELEASE" level="project" />
59
    <orderEntry type="library" name="Maven: org.springframework:spring-aop:5.0.9.RELEASE" level="project" />
60
    <orderEntry type="library" name="Maven: org.springframework:spring-context:5.0.9.RELEASE" level="project" />
61
    <orderEntry type="library" name="Maven: org.springframework:spring-expression:5.0.9.RELEASE" level="project" />
62
    <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-jdbc:2.0.5.RELEASE" level="project" />
63
    <orderEntry type="library" name="Maven: com.zaxxer:HikariCP:2.7.9" level="project" />
64
    <orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.25" level="project" />
65
    <orderEntry type="library" name="Maven: org.springframework:spring-jdbc:5.0.9.RELEASE" level="project" />
66
    <orderEntry type="library" name="Maven: org.springframework:spring-tx:5.0.9.RELEASE" level="project" />
67
    <orderEntry type="library" name="Maven: org.mariadb.jdbc:mariadb-java-client:2.4.1" level="project" />
68
    <orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-starter-test:2.0.5.RELEASE" level="project" />
69
    <orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-test:2.0.5.RELEASE" level="project" />
70
    <orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-test-autoconfigure:2.0.5.RELEASE" level="project" />
71
    <orderEntry type="library" scope="TEST" name="Maven: com.jayway.jsonpath:json-path:2.4.0" level="project" />
72
    <orderEntry type="library" scope="TEST" name="Maven: net.minidev:json-smart:2.3" level="project" />
73
    <orderEntry type="library" scope="TEST" name="Maven: net.minidev:accessors-smart:1.2" level="project" />
74
    <orderEntry type="library" scope="TEST" name="Maven: org.ow2.asm:asm:5.0.4" level="project" />
75
    <orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.12" level="project" />
76
    <orderEntry type="library" scope="TEST" name="Maven: org.assertj:assertj-core:3.9.1" level="project" />
77
    <orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
78
    <orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-library:1.3" level="project" />
79
    <orderEntry type="library" scope="TEST" name="Maven: org.skyscreamer:jsonassert:1.5.0" level="project" />
80
    <orderEntry type="library" scope="TEST" name="Maven: com.vaadin.external.google:android-json:0.0.20131108.vaadin1" level="project" />
81
    <orderEntry type="library" name="Maven: org.springframework:spring-core:5.0.9.RELEASE" level="project" />
82
    <orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.0.9.RELEASE" level="project" />
83
    <orderEntry type="library" scope="TEST" name="Maven: org.springframework:spring-test:5.0.9.RELEASE" level="project" />
84
    <orderEntry type="library" scope="TEST" name="Maven: org.xmlunit:xmlunit-core:2.5.1" level="project" />
85
    <orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter-api:5.1.1" level="project" />
86
    <orderEntry type="library" scope="TEST" name="Maven: org.apiguardian:apiguardian-api:1.0.0" level="project" />
87
    <orderEntry type="library" scope="TEST" name="Maven: org.opentest4j:opentest4j:1.0.0" level="project" />
88
    <orderEntry type="library" scope="TEST" name="Maven: org.junit.platform:junit-platform-commons:1.1.1" level="project" />
89
    <orderEntry type="library" scope="TEST" name="Maven: org.mockito:mockito-core:2.25.1" level="project" />
90
    <orderEntry type="library" scope="TEST" name="Maven: net.bytebuddy:byte-buddy:1.7.11" level="project" />
91
    <orderEntry type="library" scope="TEST" name="Maven: net.bytebuddy:byte-buddy-agent:1.7.11" level="project" />
92
    <orderEntry type="library" scope="TEST" name="Maven: org.objenesis:objenesis:2.6" level="project" />
93
  </component>
94
</module>
webapp/mock-server.json
1
{
2
  "user":
3
    [
4
      {
5
        "id": 1,
6
        "name": {
7
          "first": "Tomas",
8
          "last": "Novak"
9
        },
10
        "photo": "https://st2.depositphotos.com/9223672/12056/v/950/depositphotos_120568236-stock-illustration-male-face-avatar-logo-template.jpg",
11
        "calendar": [
12
          {
13
            "date": "2019-05-08",
14
            "from": "18:58:28.322548",
15
            "to": "18:58:28.322561",
16
            "type": "SICKDAY"
17
          }
18
        ]
19
      }
20
  ]
21
}
22

  
23

  
webapp/package-lock.json
121 121
        "rxjs": "6.3.3"
122 122
      }
123 123
    },
124
    "@angular/animations": {
125
      "version": "7.2.13",
126
      "resolved": "https://registry.npmjs.org/@angular/animations/-/animations-7.2.13.tgz",
127
      "integrity": "sha512-Z0g0DthJnxTZ0dUc5BlojMq/0XIikhWzTqq0ym8w3G6jqBJD0OJ0jRCIfV0Leqlgzq6Jzvdrx0/JngBiKi5+uA==",
128
      "requires": {
129
        "tslib": "^1.9.0"
130
      }
131
    },
132 124
    "@angular/cli": {
133 125
      "version": "7.3.8",
134 126
      "resolved": "https://registry.npmjs.org/@angular/cli/-/cli-7.3.8.tgz",
......
426 418
      "integrity": "sha512-1bNWJpwH9wB0JybkbjdQp9J4bGmGxJX6BG7Mz3188Wc4J+aNy696Gc6IaJs7tFK8VXAdJrTJ5jGr9Oiu+ATe8w==",
427 419
      "dev": true
428 420
    },
421
    "@angular/material": {
422
      "version": "7.3.7",
423
      "resolved": "https://repo.plus4u.net/repository/npm/@angular/material/-/material-7.3.7.tgz",
424
      "integrity": "sha512-Eq+7frkeNGkLOfEtmkmJgR+AgoWajOipXZWWfCSamNfpCcPof82DwvGOpAmgGni9FuN2XFQdqP5MoaffQzIvUA==",
425
      "requires": {
426
        "tslib": "^1.7.1"
427
      }
428
    },
429 429
    "@angular/platform-browser": {
430 430
      "version": "7.2.13",
431 431
      "resolved": "https://registry.npmjs.org/@angular/platform-browser/-/platform-browser-7.2.13.tgz",
......
1066 1066
      "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz",
1067 1067
      "integrity": "sha512-5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w==",
1068 1068
      "dev": true,
1069
      "optional": true,
1069 1070
      "requires": {
1070 1071
        "delegates": "^1.0.0",
1071 1072
        "readable-stream": "^2.0.6"
......
2261 2262
      "version": "1.1.0",
2262 2263
      "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz",
2263 2264
      "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=",
2264
      "dev": true
2265
      "dev": true,
2266
      "optional": true
2265 2267
    },
2266 2268
    "constants-browserify": {
2267 2269
      "version": "1.0.0",
......
2657 2659
      "version": "1.0.0",
2658 2660
      "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz",
2659 2661
      "integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=",
2660
      "dev": true
2662
      "dev": true,
2663
      "optional": true
2661 2664
    },
2662 2665
    "depd": {
2663 2666
      "version": "1.1.2",
......
3601 3604
        "ansi-regex": {
3602 3605
          "version": "2.1.1",
3603 3606
          "bundled": true,
3604
          "dev": true
3607
          "dev": true,
3608
          "optional": true
3605 3609
        },
3606 3610
        "aproba": {
3607 3611
          "version": "1.2.0",
......
3622 3626
        "balanced-match": {
3623 3627
          "version": "1.0.0",
3624 3628
          "bundled": true,
3625
          "dev": true
3629
          "dev": true,
3630
          "optional": true
3626 3631
        },
3627 3632
        "brace-expansion": {
3628 3633
          "version": "1.1.11",
3629 3634
          "bundled": true,
3630 3635
          "dev": true,
3636
          "optional": true,
3631 3637
          "requires": {
3632 3638
            "balanced-match": "^1.0.0",
3633 3639
            "concat-map": "0.0.1"
......
3642 3648
        "code-point-at": {
3643 3649
          "version": "1.1.0",
3644 3650
          "bundled": true,
3645
          "dev": true
3651
          "dev": true,
3652
          "optional": true
3646 3653
        },
3647 3654
        "concat-map": {
3648 3655
          "version": "0.0.1",
3649 3656
          "bundled": true,
3650
          "dev": true
3657
          "dev": true,
3658
          "optional": true
3651 3659
        },
3652 3660
        "console-control-strings": {
3653 3661
          "version": "1.1.0",
3654 3662
          "bundled": true,
3655
          "dev": true
3663
          "dev": true,
3664
          "optional": true
3656 3665
        },
3657 3666
        "core-util-is": {
3658 3667
          "version": "1.0.2",
......
3769 3778
        "inherits": {
3770 3779
          "version": "2.0.3",
3771 3780
          "bundled": true,
3772
          "dev": true
3781
          "dev": true,
3782
          "optional": true
3773 3783
        },
3774 3784
        "ini": {
3775 3785
          "version": "1.3.5",
......
3781 3791
          "version": "1.0.0",
3782 3792
          "bundled": true,
3783 3793
          "dev": true,
3794
          "optional": true,
3784 3795
          "requires": {
3785 3796
            "number-is-nan": "^1.0.0"
3786 3797
          }
......
3795 3806
          "version": "3.0.4",
3796 3807
          "bundled": true,
3797 3808
          "dev": true,
3809
          "optional": true,
3798 3810
          "requires": {
3799 3811
            "brace-expansion": "^1.1.7"
3800 3812
          }
......
3802 3814
        "minimist": {
3803 3815
          "version": "0.0.8",
3804 3816
          "bundled": true,
3805
          "dev": true
3817
          "dev": true,
3818
          "optional": true
3806 3819
        },
3807 3820
        "minipass": {
3808 3821
          "version": "2.3.5",
3809 3822
          "bundled": true,
3810 3823
          "dev": true,
3824
          "optional": true,
3811 3825
          "requires": {
3812 3826
            "safe-buffer": "^5.1.2",
3813 3827
            "yallist": "^3.0.0"
......
3826 3840
          "version": "0.5.1",
3827 3841
          "bundled": true,
3828 3842
          "dev": true,
3843
          "optional": true,
3829 3844
          "requires": {
3830 3845
            "minimist": "0.0.8"
3831 3846
          }
......
3906 3921
        "number-is-nan": {
3907 3922
          "version": "1.0.1",
3908 3923
          "bundled": true,
3909
          "dev": true
3924
          "dev": true,
3925
          "optional": true
3910 3926
        },
3911 3927
        "object-assign": {
3912 3928
          "version": "4.1.1",
......
3918 3934
          "version": "1.4.0",
3919 3935
          "bundled": true,
3920 3936
          "dev": true,
3937
          "optional": true,
3921 3938
          "requires": {
3922 3939
            "wrappy": "1"
3923 3940
          }
......
4003 4020
        "safe-buffer": {
4004 4021
          "version": "5.1.2",
4005 4022
          "bundled": true,
4006
          "dev": true
4023
          "dev": true,
4024
          "optional": true
4007 4025
        },
4008 4026
        "safer-buffer": {
4009 4027
          "version": "2.1.2",
......
4039 4057
          "version": "1.0.2",
4040 4058
          "bundled": true,
4041 4059
          "dev": true,
4060
          "optional": true,
4042 4061
          "requires": {
4043 4062
            "code-point-at": "^1.0.0",
4044 4063
            "is-fullwidth-code-point": "^1.0.0",
......
4058 4077
          "version": "3.0.1",
4059 4078
          "bundled": true,
4060 4079
          "dev": true,
4080
          "optional": true,
4061 4081
          "requires": {
4062 4082
            "ansi-regex": "^2.0.0"
4063 4083
          }
......
4101 4121
        "wrappy": {
4102 4122
          "version": "1.0.2",
4103 4123
          "bundled": true,
4104
          "dev": true
4124
          "dev": true,
4125
          "optional": true
4105 4126
        },
4106 4127
        "yallist": {
4107 4128
          "version": "3.0.3",
4108 4129
          "bundled": true,
4109
          "dev": true
4130
          "dev": true,
4131
          "optional": true
4110 4132
        }
4111 4133
      }
4112 4134
    },
......
4115 4137
      "resolved": "https://registry.npmjs.org/fstream/-/fstream-1.0.11.tgz",
4116 4138
      "integrity": "sha1-XB+x8RdHcRTwYyoOtLcbPLD9MXE=",
4117 4139
      "dev": true,
4140
      "optional": true,
4118 4141
      "requires": {
4119 4142
        "graceful-fs": "^4.1.2",
4120 4143
        "inherits": "~2.0.0",
......
4127 4150
      "resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz",
4128 4151
      "integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=",
4129 4152
      "dev": true,
4153
      "optional": true,
4130 4154
      "requires": {
4131 4155
        "aproba": "^1.0.3",
4132 4156
        "console-control-strings": "^1.0.0",
......
4164 4188
      "version": "4.0.1",
4165 4189
      "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz",
4166 4190
      "integrity": "sha1-uWjGsKBDhDJJAui/Gl3zJXmkUP4=",
4167
      "dev": true
4191
      "dev": true,
4192
      "optional": true
4168 4193
    },
4169 4194
    "get-stream": {
4170 4195
      "version": "3.0.0",
......
4344 4369
      "version": "2.0.1",
4345 4370
      "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz",
4346 4371
      "integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=",
4347
      "dev": true
4372
      "dev": true,
4373
      "optional": true
4348 4374
    },
4349 4375
    "has-value": {
4350 4376
      "version": "1.0.0",
......
5064 5090
      "version": "0.2.1",
5065 5091
      "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz",
5066 5092
      "integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=",
5067
      "dev": true
5093
      "dev": true,
5094
      "optional": true
5068 5095
    },
5069 5096
    "is-windows": {
5070 5097
      "version": "1.0.2",
......
5692 5719
      "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz",
5693 5720
      "integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=",
5694 5721
      "dev": true,
5722
      "optional": true,
5695 5723
      "requires": {
5696 5724
        "graceful-fs": "^4.1.2",
5697 5725
        "parse-json": "^2.2.0",
......
5704 5732
          "version": "2.3.0",
5705 5733
          "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
5706 5734
          "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=",
5707
          "dev": true
5735
          "dev": true,
5736
          "optional": true
5708 5737
        }
5709 5738
      }
5710 5739
    },
......
5979 6008
      "version": "1.0.1",
5980 6009
      "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz",
5981 6010
      "integrity": "sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0=",
5982
      "dev": true
6011
      "dev": true,
6012
      "optional": true
5983 6013
    },
5984 6014
    "map-visit": {
5985 6015
      "version": "1.0.0",
......
6600 6630
      "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.1.2.tgz",
6601 6631
      "integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==",
6602 6632
      "dev": true,
6633
      "optional": true,
6603 6634
      "requires": {
6604 6635
        "are-we-there-yet": "~1.1.2",
6605 6636
        "console-control-strings": "~1.1.0",
......
7611 7642
      "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz",
7612 7643
      "integrity": "sha1-9f+qXs0pyzHAR0vKfXVra7KePyg=",
7613 7644
      "dev": true,
7645
      "optional": true,
7614 7646
      "requires": {
7615 7647
        "load-json-file": "^1.0.0",
7616 7648
        "normalize-package-data": "^2.3.2",
......
7622 7654
          "resolved": "https://registry.npmjs.org/path-type/-/path-type-1.1.0.tgz",
7623 7655
          "integrity": "sha1-WcRPfuSR2nBNpBXaWkBwuk+P5EE=",
7624 7656
          "dev": true,
7657
          "optional": true,
7625 7658
          "requires": {
7626 7659
            "graceful-fs": "^4.1.2",
7627 7660
            "pify": "^2.0.0",
......
7632 7665
          "version": "2.3.0",
7633 7666
          "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
7634 7667
          "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=",
7635
          "dev": true
7668
          "dev": true,
7669
          "optional": true
7636 7670
        }
7637 7671
      }
7638 7672
    },
......
7641 7675
      "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-1.0.1.tgz",
7642 7676
      "integrity": "sha1-nWPBMnbAZZGNV/ACpX9AobZD+wI=",
7643 7677
      "dev": true,
7678
      "optional": true,
7644 7679
      "requires": {
7645 7680
        "find-up": "^1.0.0",
7646 7681
        "read-pkg": "^1.0.0"
......
7651 7686
          "resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz",
7652 7687
          "integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=",
7653 7688
          "dev": true,
7689
          "optional": true,
7654 7690
          "requires": {
7655 7691
            "path-exists": "^2.0.0",
7656 7692
            "pinkie-promise": "^2.0.0"
......
7661 7697
          "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz",
7662 7698
          "integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=",
7663 7699
          "dev": true,
7700
          "optional": true,
7664 7701
          "requires": {
7665 7702
            "pinkie-promise": "^2.0.0"
7666 7703
          }
......
8953 8990
      "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz",
8954 8991
      "integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=",
8955 8992
      "dev": true,
8993
      "optional": true,
8956 8994
      "requires": {
8957 8995
        "is-utf8": "^0.2.0"
8958 8996
      }
......
10289 10327
      "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz",
10290 10328
      "integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==",
10291 10329
      "dev": true,
10330
      "optional": true,
10292 10331
      "requires": {
10293 10332
        "string-width": "^1.0.2 || 2"
10294 10333
      }
webapp/src/app/app.module.ts
9 9
import { HeaderComponent } from './header/header.component';
10 10
import { MatDialogModule } from '@angular/material';
11 11
import {ProfileSettingsModule} from './profile-settings/profile-settings.module';
12
import {HttpClientModule} from '@angular/common/http';
12 13

  
13 14
@NgModule({
14 15
  declarations: [
......
19 20
  ],
20 21
  imports: [
21 22
    BrowserModule,
23
    HttpClientModule,
22 24
    AppRoutingModule,
23 25
    DashboardModule,
24 26
    MatDialogModule,
webapp/src/app/employees-list/employees-list.component.html
4 4
      <span class="material-icons">add</span>
5 5
      <span class="material-icons">edit</span>
6 6
    </h3>
7
    <div *ngIf="employeesBasicInformation">
8
      {{employeesBasicInformation[0].name.first}}
9
      {{employeesBasicInformation[0].calendar[0].date}}
10
      {{employeesBasicInformation[0].calendar[0].from}}
11
      {{employeesBasicInformation[0].calendar[0].to}}
12
<!--      {{employeesBasicInformation[0].calendar[1].date}}-->
13
    </div>
14
    <div *ngIf="employeeProfile">
15
      {{employeeProfile.photo}}
16
      {{employeeProfile.name.last}}
17
    </div>
18
    <div *ngIf="requests">
19
<!--      {{requests.vacation[0].user.name.first}}-->
20
<!--      {{requests.vacation[0].date}}-->
21
      {{requests.vacation[0].from}}
22
<!--      {{requests.authorization[0].date}}-->
23
    </div>
24
    <div *ngIf="calendars">
25
      {{calendars[0].status}}
26
      {{calendars[0].to}}
27
    </div>
7 28

  
29
    <div *ngIf="settings">
30
      {{settings.sickDay.unit}}
31
    </div>
32
    <button (click)="doSomethingFancy()">SUPER BUTTON ZKUS ME</button>
8 33
  </div>
9 34
  <hr>
10 35
</div>
webapp/src/app/employees-list/employees-list.component.ts
1
import { Component, OnInit } from '@angular/core';
1
import {Component, OnInit} from '@angular/core';
2
import {UserBasicInformation} from '../models/user-basic-information.model';
3
import {UserProfile} from '../models/user-profile.model';
4
import {UsersService} from '../services/users.service';
5
import {UserService} from '../services/user.service';
6
import {Requests} from '../models/requests.model';
7
import {Calendar} from '../models/calendar.model';
8
import {SettingsService} from '../services/settings.service';
9
import {Settings} from '../models/settings.model';
10
import {PostRequest, PostSettings} from '../models/post-requests.model';
11
import {RequestStatus, TimeUnit, UserType} from '../enums/common.enum';
2 12

  
3 13
@Component({
4 14
  selector: 'app-employees-list',
......
7 17
})
8 18
export class EmployeesListComponent implements OnInit {
9 19

  
10
  constructor() { }
20
  employeesBasicInformation: UserBasicInformation[];
21
  employeeProfile: UserProfile;
22
  requests: Requests;
23
  calendars: Calendar[];
24
  settings: Settings;
25

  
26
  doSomethingFancy(): void {
27
    console.log('klikam');
28
    this.settingsService.postDefaultSettingsWithResponse(this.settings)
29
      .subscribe(resp => console.log(resp));
30

  
31
    this.userService.postCalendarWithResponse(this.calendars)
32
      .subscribe(resp => console.log(resp));
33

  
34
    const request: PostRequest = {
35
      id: 10,
36
      status: RequestStatus.ACCEPTED,
37
    };
38
    this.userService.postAuthorizationRequestWithResponse(request)
39
      .subscribe(resp => console.log(resp));
40

  
41
    const settings: PostSettings = {
42
      role: UserType.EMPLOYEE,
43
      sickday: {
44
        unit: TimeUnit.DAY,
45
        value: 10,
46
      },
47
      vacation: {
48
        unit: TimeUnit.DAY,
49
        value: 10,
50
      },
51
    };
52

  
53
    this.userService.postUserSettingsWithResponse(1, settings)
54
      .subscribe(resp => console.log(resp));
55
  }
56

  
57
  constructor(private usersService: UsersService,
58
              private userService: UserService,
59
              private settingsService: SettingsService) {
60
  }
11 61

  
12 62
  ngOnInit() {
63
    this.usersService.getAuthorizedUsers()
64
      .subscribe((data: UserBasicInformation[]) => this.employeesBasicInformation = { ...data});
65

  
66
    this.userService.getEmployeeProfile(1)
67
      .subscribe((data: UserProfile) => this.employeeProfile = { ...data});
68

  
69
    this.usersService.getAuthorizationRequests()
70
      .subscribe((data: Requests) => this.requests = { ...data});
71

  
72
    this.userService.getMonthlyCalendar(1)
73
      .subscribe((data: Calendar[]) => this.calendars = { ...data});
74

  
75
    this.settingsService.getDefaultSettings()
76
      .subscribe((data: Settings) => this.settings = { ...data});
13 77
  }
14 78

  
15 79
}
webapp/src/app/enums/common.enum.ts
1
export enum RequestTypes {
2
  VACATION = 'VACATION',
3
  AUTHORIZATION = 'AUTHORIZATION',
4
}
5

  
6
export enum RequestStatus {
7
  ACCEPTED = 'ACCEPTED',
8
  PENDING = 'PENDING',
9
  REJECTED = 'REJECTED',
10
}
11

  
12
export enum VacationType {
13
  VACATION = 'VACATION',
14
  SICKDAY = 'SICKDAY',
15
}
16

  
17
export enum TimeUnit {
18
  WEEKLY = 'WEEK',
19
  MONTHLY = 'MONTH',
20
  DAY = 'DAY',
21
  HOUR = 'HOUR',
22
}
23

  
24
export enum UserType {
25
  EMPLOYEE = 'EMPLOYEE',
26
  EMPLOYER = 'EMPLOYER',
27
}
webapp/src/app/menu.service.ts
1
import { Injectable } from '@angular/core';
2
import { MenuItem } from './menu/menuItem';
3
import { Observable, of } from 'rxjs';
4
import { MENU_ITEMS } from './mock-menu-items';
5

  
6
@Injectable({
7
  providedIn: 'root'
8
})
9
export class MenuService {
10

  
11
  getMenuItems(): Observable<MenuItem[]> {
12
    return of(MENU_ITEMS);
13
  }
14

  
15
  constructor() { }
16
}
webapp/src/app/menu/menu-item.ts
1
export class MenuItem {
2
  name: string;
3
  routePath: string;
4
}
webapp/src/app/menu/menu.component.ts
1 1
import { Component, OnInit } from '@angular/core';
2
import { MenuService } from '../menu.service';
3
import { MenuItem } from './menuItem';
2
import { MenuService } from '../services/menu.service';
3
import { MenuItem } from './menu-item';
4 4

  
5 5
@Component({
6 6
  selector: 'app-menu',
webapp/src/app/menu/menuItem.ts
1
export class MenuItem {
2
  name: string;
3
  routePath: string;
4
}
webapp/src/app/mock-menu-items.ts
1
import { MenuItem } from './menu/menuItem';
1
import { MenuItem } from './menu/menu-item';
2 2

  
3 3
export const MENU_ITEMS: MenuItem[] = [
4 4
  {name: 'Dashboard', routePath: 'dashboard'},
webapp/src/app/models/calendar.model.ts
1
import {Time} from '@angular/common';
2
import {RequestStatus, VacationType} from '../enums/common.enum';
3

  
4
export interface Calendar {
5
  date: Date;
6
  from: Time;
7
  to: Time;
8
  type: VacationType;
9
  status: RequestStatus;
10
}
webapp/src/app/models/post-requests.model.ts
1
import {RequestStatus, TimeUnit, UserType} from '../enums/common.enum';
2

  
3
export interface PostRequest {
4
  id: number;
5
  status: RequestStatus;
6
}
7

  
8
export interface PostSettings {
9
  role: UserType;
10
  vacation: {
11
    value: number;
12
    unit: TimeUnit;
13
  };
14
  sickday: {
15
    value: number;
16
    unit: TimeUnit;
17
  };
18
}
webapp/src/app/models/requests.model.ts
1
import {Time} from '@angular/common';
2
import {RequestStatus, VacationType} from '../enums/common.enum';
3

  
4
export interface Requests {
5
  vacation: [
6
    {
7
      id: number;
8
      user: {
9
        name: {
10
          first: string;
11
          last: string;
12
        };
13
      };
14
      date: Date;
15
      from: Time;
16
      to: Time;
17
      type: VacationType;
18
      status: RequestStatus;
19
    }
20
  ];
21
  authorization: [
22
    {
23
      id: number;
24
      user: {
25
        name: {
26
          first: string;
27
          last: string;
28
        };
29
      };
30
      date: Date;
31
    }
32
  ];
33
}
webapp/src/app/models/settings.model.ts
1
export interface Settings {
2
  sickDay: {
3
    value: number;
4
    unit: string;
5
  };
6
  notification: Date;
7
}
webapp/src/app/models/user-basic-information.model.ts
1
import {VacationType} from '../enums/common.enum';
2

  
3
export interface UserBasicInformation {
4
  id: number;
5
  name: {
6
    first: string;
7
    last: string;
8
  };
9
  photo: string;
10
  calendar: [
11
    {
12
      date: Date,
13
      from: Date,
14
      to: Date,
15
      type: VacationType;
16
    }
17
  ];
18
}
webapp/src/app/models/user-profile.model.ts
1
import {TimeUnit} from '../enums/common.enum';
2

  
3
export interface UserProfile {
4
  id: number;
5
  name: {
6
    first: string;
7
    last: string;
8
  };
9
  photo: string;
10
  settings: {
11
    notification: Date;
12
  };
13
  vacation: {
14
    value: number;
15
    unit: TimeUnit;
16
  };
17
  sickDay: {
18
    value: number;
19
    unit: TimeUnit;
20
  };
21
}
22

  
webapp/src/app/services/basic.service.ts
1
import { Injectable } from '@angular/core';
2
import {HttpClient, HttpErrorResponse, HttpHeaders} from '@angular/common/http';
3
import {throwError} from 'rxjs';
4

  
5
@Injectable({
6
  providedIn: 'root'
7
})
8
export class BasicService {
9
  protected baseUrl = 'http://localhost:9080';
10
  protected withResponse = {
11
    headers: new HttpHeaders({
12
      observe: 'response',
13
    })
14
  };
15

  
16
  protected handleError(error: HttpErrorResponse) {
17
    if (error.error instanceof ErrorEvent) {
18
      console.error('An error occurred:', error.error.message);
19
    } else {
20
      console.error(
21
        `Backend returned code ${error.status}, ` +
22
        `body was: ${error.error}`);
23
    }
24
    return throwError(
25
      'Something bad happened; please try again later.');
26
  }
27

  
28
  constructor(protected http: HttpClient) { }
29
}
webapp/src/app/services/menu.service.ts
1
import { Injectable } from '@angular/core';
2
import { MenuItem } from '../menu/menu-item';
3
import { Observable, of } from 'rxjs';
4
import { MENU_ITEMS } from '../mock-menu-items';
5

  
6
@Injectable({
7
  providedIn: 'root'
8
})
9
export class MenuService {
10

  
11
  getMenuItems(): Observable<MenuItem[]> {
12
    return of(MENU_ITEMS);
13
  }
14

  
15
  constructor() { }
16
}
webapp/src/app/services/settings.service.ts
1
import { Injectable } from '@angular/core';
2
import { HttpClient } from '@angular/common/http';
3
import { catchError } from 'rxjs/operators';
4

  
5
import { BasicService } from './basic.service';
6
import { Settings } from '../models/settings.model';
7

  
8
@Injectable({
9
  providedIn: 'root'
10
})
11
export class SettingsService extends BasicService {
12
  defaultSettingsUrl = this.baseUrl + '/settings/default';
13

  
14
  getDefaultSettings() {
15
    return this.http.get<Settings>(this.defaultSettingsUrl)
16
      .pipe(
17
        catchError(err => this.handleError(err))
18
      );
19
  }
20

  
21
  postDefaultSettingsWithResponse(settings: Settings) {
22
    return this.postDefaultSettingsWithOptions(settings, {observe: 'response'});
23
  }
24

  
25
  postDefaultSettings(settings: Settings) {
26
    return this.postDefaultSettingsWithOptions(settings, {});
27
  }
28

  
29
  private postDefaultSettingsWithOptions(settings: Settings, options: any) {
30
    return this.http.post<Settings>(this.defaultSettingsUrl, settings, options)
31
      .pipe(
32
        catchError(err => this.handleError(err))
33
      );
34
  }
35

  
36
  constructor(protected http: HttpClient) {
37
    super(http);
38
  }
39
}
webapp/src/app/services/user.service.ts
1
import { Injectable } from '@angular/core';
2
import { HttpClient } from '@angular/common/http';
3

  
4
import { UserProfile } from '../models/user-profile.model';
5
import { Calendar } from '../models/calendar.model';
6
import { BasicService } from './basic.service';
7
import { catchError } from 'rxjs/operators';
8
import {RequestTypes, TimeUnit} from '../enums/common.enum';
9
import {PostRequest, PostSettings} from '../models/post-requests.model';
10

  
11
@Injectable({
12
  providedIn: 'root'
13
})
14
export class UserService extends BasicService { // dost podobny k usersService, mozna zmenit v rest api
15
  private calendarUrl = this.baseUrl + '/user/calendar';
16
  private postRequestUrl = this.baseUrl + '/user/requests?type=';
17
  private userUrl = this.baseUrl + '/user/';
18

  
19
  getEmployeeProfile(id: number) { // najit jinej zpusob formatovani stringu, prasarna
20
    return this.http.get<UserProfile>('http://localhost:9080/user/' + id + '/profile');
21
  }
22

  
23
  getMonthlyCalendar(value: number) {
24
    return this.getCalendar(TimeUnit.MONTHLY, value);
25
  }
26

  
27
  getWeeklyCalendar(value: number) {
28
    return this.getCalendar(TimeUnit.WEEKLY, value);
29
  }
30

  
31
  private getCalendar(viewType: string, value: number) {
32
    return this.http.get<Calendar[]>(this.calendarUrl + '?viewType=' + viewType + '&value=' + value)
33
      .pipe(
34
        catchError(err => this.handleError(err))
35
      );
36
  }
37

  
38
  postCalendar(calendar: Calendar[]) {
39
    return this.postCalendarWithOptions(calendar, {});
40
  }
41

  
42
  postCalendarWithResponse(calendar: Calendar[]) {
43
    return this.postCalendarWithOptions(calendar, {observe: 'response'});
44
  }
45

  
46
  private postCalendarWithOptions(calendar: Calendar[], options: any) {
47
    return this.http.post<Calendar[]>(this.calendarUrl, calendar, options)
48
      .pipe(
49
        catchError(err => this.handleError(err))
50
      );
51
  }
52

  
53
  postVacationRequest(request: PostRequest) {
54
    return this.postRequestWithTypeAndOptions(request, RequestTypes.VACATION, {});
55
  }
56

  
57
  postVacationRequestWithResponse(request: PostRequest) {
58
    return this.postRequestWithTypeAndOptions(request, RequestTypes.VACATION, {observe: 'response'});
59
  }
60

  
61
  postAuthorizationRequest(request: PostRequest) {
62
    return this.postRequestWithTypeAndOptions(request, RequestTypes.AUTHORIZATION, {});
63
  }
64

  
65
  postAuthorizationRequestWithResponse(request: PostRequest) {
66
    return this.postRequestWithTypeAndOptions(request, RequestTypes.AUTHORIZATION, {observe: 'response'});
67
  }
68

  
69
  private postRequestWithTypeAndOptions(request: PostRequest, type: string, options: any) {
70
    return this.http.post<PostRequest>(this.postRequestUrl + type, request, options)
71
      .pipe(
72
        catchError(err => this.handleError(err))
73
      );
74
  }
75

  
76
  postUserSettings(id: number, settings: PostSettings) {
77
    return this.postUserSettingsWithOptions(id, settings, {});
78
  }
79

  
80
  postUserSettingsWithResponse(id: number, settings: PostSettings) {
81
    return this.postUserSettingsWithOptions(id, settings, {observe: 'response'});
82
  }
83

  
84
  private postUserSettingsWithOptions(id: number, settings: PostSettings, options: any) {
85
    return this.http.post<PostSettings>(this.userUrl + id + '/settings', settings, options)
86
      .pipe(
87
        catchError(err => this.handleError(err))
88
      );
89
  }
90

  
91
  constructor(protected http: HttpClient) {
92
    super(http);
93
  }
94
}
webapp/src/app/services/users.service.ts
1
import { Injectable } from '@angular/core';
2
import { HttpClient } from '@angular/common/http';
3
import { BasicService } from './basic.service';
4
import { catchError } from 'rxjs/operators';
5

  
6
import { UserBasicInformation } from '../models/user-basic-information.model';
7
import { Requests } from '../models/requests.model';
8

  
9
@Injectable({
10
  providedIn: 'root'
11
})
12
export class UsersService extends BasicService {
13
  private usersUrl = this.baseUrl + '/users?status=';
14
  private requestsUrl = this.baseUrl + '/users/requests?type=';
15

  
16
  getAuthorizedUsers() {
17
    return this.getUsersWithStatus('AUTHORIZED');
18
  }
19

  
20
  getPendingUsers() {
21
    return this.getUsersWithStatus('PENDING');
22
  }
23

  
24
  getRejectedUsers() {
25
    return this.getUsersWithStatus('REJECTED');
26
  }
27

  
28
  private getUsersWithStatus(status: string) {
29
    return this.http.get<UserBasicInformation[]>(this.usersUrl + status)
30
      .pipe(
31
        catchError(err => this.handleError(err))
32
      );
33
  }
34

  
35
  getVacationRequests() {
36
    return this.getRequestsWithType('VACATION');
37
  }
38

  
39
  getAuthorizationRequests() {
40
    return this.getRequestsWithType('AUTHORIZATION');
41
  }
42

  
43
  private getRequestsWithType(type: string) {
44
    return this.http.get<Requests>(this.requestsUrl + type)
45
      .pipe(
46
        catchError(err => this.handleError(err))
47
      );
48
  }
49

  
50
  constructor(protected http: HttpClient) {
51
    super(http);
52
  }
53

  
54
}

Také k dispozici: Unified diff