Browse Source

Merge branch 'home' of ElliottStansbury/JhipsterGroupProject-Client into home

ElliottStansbury 5 years ago
parent
commit
09f8c108d3
100 changed files with 4726 additions and 200 deletions
  1. 36
    0
      .jhipster/AccountDetails.json
  2. 30
    0
      .jhipster/Album.json
  3. 40
    0
      .jhipster/Comment.json
  4. 32
    0
      .jhipster/Friend.json
  5. 38
    0
      .jhipster/Photo.json
  6. 38
    0
      .jhipster/Post.json
  7. 32
    0
      .jhipster/Profile.json
  8. 30
    0
      .jhipster/Video.json
  9. 2
    2
      .yo-rc.json
  10. 95
    0
      jdl.jh
  11. 0
    0
      jhipster-jdl-3.jh
  12. 1
    1
      src/main/java/rocks/zipcode/io/FaeBooApp.java
  13. 129
    0
      src/main/java/rocks/zipcode/io/domain/AccountDetails.java
  14. 114
    0
      src/main/java/rocks/zipcode/io/domain/Album.java
  15. 148
    0
      src/main/java/rocks/zipcode/io/domain/Comment.java
  16. 114
    0
      src/main/java/rocks/zipcode/io/domain/Friend.java
  17. 146
    0
      src/main/java/rocks/zipcode/io/domain/Photo.java
  18. 148
    0
      src/main/java/rocks/zipcode/io/domain/Post.java
  19. 112
    0
      src/main/java/rocks/zipcode/io/domain/Profile.java
  20. 114
    0
      src/main/java/rocks/zipcode/io/domain/Video.java
  21. 15
    0
      src/main/java/rocks/zipcode/io/repository/AccountDetailsRepository.java
  22. 19
    0
      src/main/java/rocks/zipcode/io/repository/AlbumRepository.java
  23. 19
    0
      src/main/java/rocks/zipcode/io/repository/CommentRepository.java
  24. 22
    0
      src/main/java/rocks/zipcode/io/repository/FriendRepository.java
  25. 30
    0
      src/main/java/rocks/zipcode/io/repository/PhotoRepository.java
  26. 19
    0
      src/main/java/rocks/zipcode/io/repository/PostRepository.java
  27. 15
    0
      src/main/java/rocks/zipcode/io/repository/ProfileRepository.java
  28. 4
    0
      src/main/java/rocks/zipcode/io/repository/UserRepository.java
  29. 15
    0
      src/main/java/rocks/zipcode/io/repository/VideoRepository.java
  30. 31
    1
      src/main/java/rocks/zipcode/io/service/UserService.java
  31. 119
    0
      src/main/java/rocks/zipcode/io/web/rest/AccountDetailsResource.java
  32. 0
    189
      src/main/java/rocks/zipcode/io/web/rest/AccountResource.java
  33. 119
    0
      src/main/java/rocks/zipcode/io/web/rest/AlbumResource.java
  34. 119
    0
      src/main/java/rocks/zipcode/io/web/rest/CommentResource.java
  35. 119
    0
      src/main/java/rocks/zipcode/io/web/rest/FriendResource.java
  36. 120
    0
      src/main/java/rocks/zipcode/io/web/rest/PhotoResource.java
  37. 124
    0
      src/main/java/rocks/zipcode/io/web/rest/PostResource.java
  38. 119
    0
      src/main/java/rocks/zipcode/io/web/rest/ProfileResource.java
  39. 3
    0
      src/main/java/rocks/zipcode/io/web/rest/UserResource.java
  40. 119
    0
      src/main/java/rocks/zipcode/io/web/rest/VideoResource.java
  41. 1
    0
      src/main/resources/.h2.server.properties
  42. 9
    4
      src/main/resources/config/application-dev.yml
  43. 43
    0
      src/main/resources/config/liquibase/changelog/20190102220056_added_entity_AccountDetails.xml
  44. 18
    0
      src/main/resources/config/liquibase/changelog/20190102220056_added_entity_constraints_AccountDetails.xml
  45. 39
    0
      src/main/resources/config/liquibase/changelog/20190102220057_added_entity_Profile.xml
  46. 18
    0
      src/main/resources/config/liquibase/changelog/20190102220057_added_entity_constraints_Profile.xml
  47. 41
    0
      src/main/resources/config/liquibase/changelog/20190102220058_added_entity_Friend.xml
  48. 24
    0
      src/main/resources/config/liquibase/changelog/20190102220058_added_entity_constraints_Friend.xml
  49. 41
    0
      src/main/resources/config/liquibase/changelog/20190102220059_added_entity_Album.xml
  50. 18
    0
      src/main/resources/config/liquibase/changelog/20190102220059_added_entity_constraints_Album.xml
  51. 52
    0
      src/main/resources/config/liquibase/changelog/20190102220100_added_entity_Photo.xml
  52. 29
    0
      src/main/resources/config/liquibase/changelog/20190102220100_added_entity_constraints_Photo.xml
  53. 41
    0
      src/main/resources/config/liquibase/changelog/20190102220101_added_entity_Video.xml
  54. 18
    0
      src/main/resources/config/liquibase/changelog/20190102220101_added_entity_constraints_Video.xml
  55. 49
    0
      src/main/resources/config/liquibase/changelog/20190102220102_added_entity_Post.xml
  56. 18
    0
      src/main/resources/config/liquibase/changelog/20190102220102_added_entity_constraints_Post.xml
  57. 49
    0
      src/main/resources/config/liquibase/changelog/20190102220103_added_entity_Comment.xml
  58. 24
    0
      src/main/resources/config/liquibase/changelog/20190102220103_added_entity_constraints_Comment.xml
  59. 16
    0
      src/main/resources/config/liquibase/master.xml
  60. 79
    0
      src/main/webapp/app/FaeBoo/Profile-head/profile-head.component.html
  61. 57
    0
      src/main/webapp/app/FaeBoo/Profile-head/profile-head.component.ts
  62. 160
    0
      src/main/webapp/app/FaeBoo/Profile-head/profile-head.css
  63. 1
    0
      src/main/webapp/app/FaeBoo/Profile-temp/profile-temp.component.html
  64. 9
    0
      src/main/webapp/app/FaeBoo/Profile-temp/profile-temp.component.ts
  65. 14
    0
      src/main/webapp/app/FaeBoo/Profile-temp/profile-temp.module.ts
  66. 12
    0
      src/main/webapp/app/FaeBoo/Profile-temp/profile-temp.route.ts
  67. 0
    0
      src/main/webapp/app/FaeBoo/Profile-temp/profile-temp.scss
  68. 39
    0
      src/main/webapp/app/FaeBoo/Services/post.service.ts
  69. 10
    1
      src/main/webapp/app/account/account.route.ts
  70. 1
    1
      src/main/webapp/app/account/register/register.component.html
  71. 1
    0
      src/main/webapp/app/account/register/register.component.ts
  72. 14
    1
      src/main/webapp/app/app.module.ts
  73. 19
    0
      src/main/webapp/app/entities/account-details/account-details-delete-dialog.component.html
  74. 72
    0
      src/main/webapp/app/entities/account-details/account-details-delete-dialog.component.ts
  75. 39
    0
      src/main/webapp/app/entities/account-details/account-details-detail.component.html
  76. 24
    0
      src/main/webapp/app/entities/account-details/account-details-detail.component.ts
  77. 46
    0
      src/main/webapp/app/entities/account-details/account-details-update.component.html
  78. 74
    0
      src/main/webapp/app/entities/account-details/account-details-update.component.ts
  79. 62
    0
      src/main/webapp/app/entities/account-details/account-details.component.html
  80. 58
    0
      src/main/webapp/app/entities/account-details/account-details.component.ts
  81. 35
    0
      src/main/webapp/app/entities/account-details/account-details.module.ts
  82. 93
    0
      src/main/webapp/app/entities/account-details/account-details.route.ts
  83. 38
    0
      src/main/webapp/app/entities/account-details/account-details.service.ts
  84. 6
    0
      src/main/webapp/app/entities/account-details/index.ts
  85. 19
    0
      src/main/webapp/app/entities/album/album-delete-dialog.component.html
  86. 65
    0
      src/main/webapp/app/entities/album/album-delete-dialog.component.ts
  87. 35
    0
      src/main/webapp/app/entities/album/album-detail.component.html
  88. 24
    0
      src/main/webapp/app/entities/album/album-detail.component.ts
  89. 41
    0
      src/main/webapp/app/entities/album/album-update.component.html
  90. 74
    0
      src/main/webapp/app/entities/album/album-update.component.ts
  91. 60
    0
      src/main/webapp/app/entities/album/album.component.html
  92. 58
    0
      src/main/webapp/app/entities/album/album.component.ts
  93. 24
    0
      src/main/webapp/app/entities/album/album.module.ts
  94. 93
    0
      src/main/webapp/app/entities/album/album.route.ts
  95. 38
    0
      src/main/webapp/app/entities/album/album.service.ts
  96. 6
    0
      src/main/webapp/app/entities/album/index.ts
  97. 19
    0
      src/main/webapp/app/entities/comment/comment-delete-dialog.component.html
  98. 65
    0
      src/main/webapp/app/entities/comment/comment-delete-dialog.component.ts
  99. 45
    0
      src/main/webapp/app/entities/comment/comment-detail.component.html
  100. 0
    0
      src/main/webapp/app/entities/comment/comment-detail.component.ts

+ 36
- 0
.jhipster/AccountDetails.json View File

1
+{
2
+    "name": "AccountDetails",
3
+    "fields": [
4
+        {
5
+            "fieldName": "securityQuestion",
6
+            "fieldType": "String"
7
+        },
8
+        {
9
+            "fieldName": "securityAnswer",
10
+            "fieldType": "String"
11
+        },
12
+        {
13
+            "fieldName": "phoneNumber",
14
+            "fieldType": "String"
15
+        }
16
+    ],
17
+    "relationships": [
18
+        {
19
+            "relationshipType": "one-to-one",
20
+            "relationshipName": "userAccount",
21
+            "otherEntityName": "user",
22
+            "otherEntityField": "email",
23
+            "ownerSide": true,
24
+            "otherEntityRelationshipName": "accountDetails"
25
+        }
26
+    ],
27
+    "changelogDate": "20190102220056",
28
+    "entityTableName": "account_details",
29
+    "dto": "no",
30
+    "pagination": "no",
31
+    "service": "no",
32
+    "jpaMetamodelFiltering": false,
33
+    "fluentMethods": true,
34
+    "clientRootFolder": "",
35
+    "applications": "*"
36
+}

+ 30
- 0
.jhipster/Album.json View File

1
+{
2
+    "name": "Album",
3
+    "fields": [
4
+        {
5
+            "fieldName": "name",
6
+            "fieldType": "String"
7
+        },
8
+        {
9
+            "fieldName": "description",
10
+            "fieldType": "String"
11
+        }
12
+    ],
13
+    "relationships": [
14
+        {
15
+            "relationshipType": "many-to-one",
16
+            "relationshipName": "owner",
17
+            "otherEntityName": "user",
18
+            "otherEntityField": "email"
19
+        }
20
+    ],
21
+    "changelogDate": "20190102220059",
22
+    "entityTableName": "album",
23
+    "dto": "no",
24
+    "pagination": "no",
25
+    "service": "no",
26
+    "jpaMetamodelFiltering": false,
27
+    "fluentMethods": true,
28
+    "clientRootFolder": "",
29
+    "applications": "*"
30
+}

+ 40
- 0
.jhipster/Comment.json View File

1
+{
2
+    "name": "Comment",
3
+    "fields": [
4
+        {
5
+            "fieldName": "content",
6
+            "fieldType": "String"
7
+        },
8
+        {
9
+            "fieldName": "likes",
10
+            "fieldType": "Long"
11
+        },
12
+        {
13
+            "fieldName": "dislikes",
14
+            "fieldType": "Long"
15
+        }
16
+    ],
17
+    "relationships": [
18
+        {
19
+            "relationshipType": "many-to-one",
20
+            "relationshipName": "commenter",
21
+            "otherEntityName": "user",
22
+            "otherEntityField": "email"
23
+        },
24
+        {
25
+            "relationshipType": "many-to-one",
26
+            "relationshipName": "post",
27
+            "otherEntityName": "post",
28
+            "otherEntityField": "id"
29
+        }
30
+    ],
31
+    "changelogDate": "20190102220103",
32
+    "entityTableName": "comment",
33
+    "dto": "no",
34
+    "pagination": "no",
35
+    "service": "no",
36
+    "jpaMetamodelFiltering": false,
37
+    "fluentMethods": true,
38
+    "clientRootFolder": "",
39
+    "applications": "*"
40
+}

+ 32
- 0
.jhipster/Friend.json View File

1
+{
2
+    "name": "Friend",
3
+    "fields": [
4
+        {
5
+            "fieldName": "topFriend",
6
+            "fieldType": "Boolean"
7
+        }
8
+    ],
9
+    "relationships": [
10
+        {
11
+            "relationshipType": "many-to-one",
12
+            "relationshipName": "user",
13
+            "otherEntityName": "user",
14
+            "otherEntityField": "email"
15
+        },
16
+        {
17
+            "relationshipType": "many-to-one",
18
+            "relationshipName": "friend",
19
+            "otherEntityName": "user",
20
+            "otherEntityField": "email"
21
+        }
22
+    ],
23
+    "changelogDate": "20190102220058",
24
+    "entityTableName": "friend",
25
+    "dto": "no",
26
+    "pagination": "no",
27
+    "service": "no",
28
+    "jpaMetamodelFiltering": false,
29
+    "fluentMethods": true,
30
+    "clientRootFolder": "",
31
+    "applications": "*"
32
+}

+ 38
- 0
.jhipster/Photo.json View File

1
+{
2
+    "name": "Photo",
3
+    "fields": [
4
+        {
5
+            "fieldName": "imageURL",
6
+            "fieldType": "String"
7
+        },
8
+        {
9
+            "fieldName": "size",
10
+            "fieldType": "Long"
11
+        }
12
+    ],
13
+    "relationships": [
14
+        {
15
+            "relationshipType": "many-to-one",
16
+            "relationshipName": "post",
17
+            "otherEntityName": "post",
18
+            "otherEntityField": "id"
19
+        },
20
+        {
21
+            "relationshipType": "many-to-many",
22
+            "otherEntityRelationshipName": "",
23
+            "relationshipName": "album",
24
+            "otherEntityName": "album",
25
+            "otherEntityField": "name",
26
+            "ownerSide": true
27
+        }
28
+    ],
29
+    "changelogDate": "20190102220100",
30
+    "entityTableName": "photo",
31
+    "dto": "no",
32
+    "pagination": "no",
33
+    "service": "no",
34
+    "jpaMetamodelFiltering": false,
35
+    "fluentMethods": true,
36
+    "clientRootFolder": "",
37
+    "applications": "*"
38
+}

+ 38
- 0
.jhipster/Post.json View File

1
+{
2
+    "name": "Post",
3
+    "fields": [
4
+        {
5
+            "fieldName": "numberOfComments",
6
+            "fieldType": "Long"
7
+        },
8
+        {
9
+            "fieldName": "content",
10
+            "fieldType": "String"
11
+        },
12
+        {
13
+            "fieldName": "likes",
14
+            "fieldType": "Long"
15
+        },
16
+        {
17
+            "fieldName": "dislikes",
18
+            "fieldType": "Long"
19
+        }
20
+    ],
21
+    "relationships": [
22
+        {
23
+            "relationshipType": "many-to-one",
24
+            "relationshipName": "owner",
25
+            "otherEntityName": "user",
26
+            "otherEntityField": "email"
27
+        }
28
+    ],
29
+    "changelogDate": "20190102220102",
30
+    "entityTableName": "post",
31
+    "dto": "no",
32
+    "pagination": "no",
33
+    "service": "no",
34
+    "jpaMetamodelFiltering": false,
35
+    "fluentMethods": true,
36
+    "clientRootFolder": "",
37
+    "applications": "*"
38
+}

+ 32
- 0
.jhipster/Profile.json View File

1
+{
2
+    "name": "Profile",
3
+    "fields": [
4
+        {
5
+            "fieldName": "bio",
6
+            "fieldType": "String"
7
+        },
8
+        {
9
+            "fieldName": "accessible",
10
+            "fieldType": "Boolean"
11
+        }
12
+    ],
13
+    "relationships": [
14
+        {
15
+            "relationshipType": "one-to-one",
16
+            "relationshipName": "userProfile",
17
+            "otherEntityName": "user",
18
+            "otherEntityField": "email",
19
+            "ownerSide": true,
20
+            "otherEntityRelationshipName": "profile"
21
+        }
22
+    ],
23
+    "changelogDate": "20190102220057",
24
+    "entityTableName": "profile",
25
+    "dto": "no",
26
+    "pagination": "no",
27
+    "service": "no",
28
+    "jpaMetamodelFiltering": false,
29
+    "fluentMethods": true,
30
+    "clientRootFolder": "",
31
+    "applications": "*"
32
+}

+ 30
- 0
.jhipster/Video.json View File

1
+{
2
+    "name": "Video",
3
+    "fields": [
4
+        {
5
+            "fieldName": "videoURL",
6
+            "fieldType": "String"
7
+        },
8
+        {
9
+            "fieldName": "size",
10
+            "fieldType": "Long"
11
+        }
12
+    ],
13
+    "relationships": [
14
+        {
15
+            "relationshipType": "many-to-one",
16
+            "relationshipName": "post",
17
+            "otherEntityName": "post",
18
+            "otherEntityField": "id"
19
+        }
20
+    ],
21
+    "changelogDate": "20190102220101",
22
+    "entityTableName": "video",
23
+    "dto": "no",
24
+    "pagination": "no",
25
+    "service": "no",
26
+    "jpaMetamodelFiltering": false,
27
+    "fluentMethods": true,
28
+    "clientRootFolder": "",
29
+    "applications": "*"
30
+}

+ 2
- 2
.yo-rc.json View File

13
     "authenticationType": "jwt",
13
     "authenticationType": "jwt",
14
     "cacheProvider": "hazelcast",
14
     "cacheProvider": "hazelcast",
15
     "enableHibernateCache": true,
15
     "enableHibernateCache": true,
16
-    "websocket": false,
16
+    "websocket": "spring-websocket",
17
     "databaseType": "sql",
17
     "databaseType": "sql",
18
     "devDatabaseType": "h2Memory",
18
     "devDatabaseType": "h2Memory",
19
     "prodDatabaseType": "postgresql",
19
     "prodDatabaseType": "postgresql",
35
       "en"
35
       "en"
36
     ]
36
     ]
37
   }
37
   }
38
-}
38
+}

+ 95
- 0
jdl.jh View File

1
+entity AccountDetails{
2
+    securityQuestion String,
3
+    securityAnswer String,
4
+    phoneNumber String
5
+}
6
+
7
+entity Profile{
8
+    bio String,
9
+    accessible Boolean
10
+}
11
+
12
+entity Friend{
13
+    topFriend Boolean
14
+}
15
+
16
+entity Album{
17
+    name String,
18
+    description String,
19
+}
20
+
21
+entity Photo {
22
+ 	imageURL String,
23
+    size Long
24
+}
25
+
26
+entity Video {
27
+    videoURL String,
28
+    size Long,
29
+}
30
+
31
+entity Post {
32
+    numberOfComments Long,
33
+    content String,
34
+  	likes Long,
35
+    dislikes Long
36
+}
37
+
38
+entity Comment {
39
+    content String,
40
+    likes Long,
41
+    dislikes Long
42
+}
43
+
44
+relationship ManyToOne {
45
+	Comment{commenter(email)} to User
46
+}
47
+
48
+relationship ManyToOne {
49
+	Comment{post} to Post
50
+}
51
+
52
+relationship ManyToOne {
53
+	Post{owner(email)} to User
54
+}
55
+
56
+relationship ManyToOne {
57
+	Photo{post} to Post
58
+}
59
+
60
+relationship ManyToOne {
61
+	Video{post} to Post
62
+}
63
+
64
+relationship ManyToOne {
65
+	Album{owner(email)} to User
66
+}
67
+
68
+relationship ManyToMany {
69
+	Photo{album(name)} to Album
70
+}
71
+
72
+relationship OneToOne {
73
+	AccountDetails{userAccount(email)} to User
74
+}
75
+
76
+relationship OneToOne {
77
+	Profile{userProfile(email)} to User
78
+}
79
+
80
+relationship ManyToOne{
81
+	Friend{user(email)} to User
82
+}
83
+
84
+relationship ManyToOne{
85
+	Friend{friend(email)} to User
86
+}
87
+
88
+
89
+
90
+
91
+
92
+
93
+
94
+
95
+

+ 0
- 0
jhipster-jdl-3.jh View File


+ 1
- 1
src/main/java/rocks/zipcode/io/FaeBooApp.java View File

35
     }
35
     }
36
 
36
 
37
     /**
37
     /**
38
-     * Initializes FaeBoo.
38
+     * Initializes FaeBoo.np
39
      * <p>
39
      * <p>
40
      * Spring profiles can be configured with a program argument --spring.profiles.active=your-active-profile
40
      * Spring profiles can be configured with a program argument --spring.profiles.active=your-active-profile
41
      * <p>
41
      * <p>

+ 129
- 0
src/main/java/rocks/zipcode/io/domain/AccountDetails.java View File

1
+package rocks.zipcode.io.domain;
2
+
3
+import org.hibernate.annotations.Cache;
4
+import org.hibernate.annotations.CacheConcurrencyStrategy;
5
+
6
+import javax.persistence.*;
7
+
8
+import java.io.Serializable;
9
+import java.util.Objects;
10
+
11
+/**
12
+ * A AccountDetails.
13
+ */
14
+@Entity
15
+@Table(name = "account_details")
16
+@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
17
+public class AccountDetails implements Serializable {
18
+
19
+    private static final long serialVersionUID = 1L;
20
+
21
+    @Id
22
+    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sequenceGenerator")
23
+    @SequenceGenerator(name = "sequenceGenerator")
24
+    private Long id;
25
+
26
+    @Column(name = "security_question")
27
+    private String securityQuestion;
28
+
29
+    @Column(name = "security_answer")
30
+    private String securityAnswer;
31
+
32
+    @Column(name = "phone_number")
33
+    private String phoneNumber;
34
+
35
+    @OneToOne    @JoinColumn(unique = true)
36
+    private User userAccount;
37
+
38
+    // jhipster-needle-entity-add-field - JHipster will add fields here, do not remove
39
+    public Long getId() {
40
+        return id;
41
+    }
42
+
43
+    public void setId(Long id) {
44
+        this.id = id;
45
+    }
46
+
47
+    public String getSecurityQuestion() {
48
+        return securityQuestion;
49
+    }
50
+
51
+    public AccountDetails securityQuestion(String securityQuestion) {
52
+        this.securityQuestion = securityQuestion;
53
+        return this;
54
+    }
55
+
56
+    public void setSecurityQuestion(String securityQuestion) {
57
+        this.securityQuestion = securityQuestion;
58
+    }
59
+
60
+    public String getSecurityAnswer() {
61
+        return securityAnswer;
62
+    }
63
+
64
+    public AccountDetails securityAnswer(String securityAnswer) {
65
+        this.securityAnswer = securityAnswer;
66
+        return this;
67
+    }
68
+
69
+    public void setSecurityAnswer(String securityAnswer) {
70
+        this.securityAnswer = securityAnswer;
71
+    }
72
+
73
+    public String getPhoneNumber() {
74
+        return phoneNumber;
75
+    }
76
+
77
+    public AccountDetails phoneNumber(String phoneNumber) {
78
+        this.phoneNumber = phoneNumber;
79
+        return this;
80
+    }
81
+
82
+    public void setPhoneNumber(String phoneNumber) {
83
+        this.phoneNumber = phoneNumber;
84
+    }
85
+
86
+    public User getUserAccount() {
87
+        return userAccount;
88
+    }
89
+
90
+    public AccountDetails userAccount(User user) {
91
+        this.userAccount = user;
92
+        return this;
93
+    }
94
+
95
+    public void setUserAccount(User user) {
96
+        this.userAccount = user;
97
+    }
98
+    // jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here, do not remove
99
+
100
+    @Override
101
+    public boolean equals(Object o) {
102
+        if (this == o) {
103
+            return true;
104
+        }
105
+        if (o == null || getClass() != o.getClass()) {
106
+            return false;
107
+        }
108
+        AccountDetails accountDetails = (AccountDetails) o;
109
+        if (accountDetails.getId() == null || getId() == null) {
110
+            return false;
111
+        }
112
+        return Objects.equals(getId(), accountDetails.getId());
113
+    }
114
+
115
+    @Override
116
+    public int hashCode() {
117
+        return Objects.hashCode(getId());
118
+    }
119
+
120
+    @Override
121
+    public String toString() {
122
+        return "AccountDetails{" +
123
+            "id=" + getId() +
124
+            ", securityQuestion='" + getSecurityQuestion() + "'" +
125
+            ", securityAnswer='" + getSecurityAnswer() + "'" +
126
+            ", phoneNumber='" + getPhoneNumber() + "'" +
127
+            "}";
128
+    }
129
+}

+ 114
- 0
src/main/java/rocks/zipcode/io/domain/Album.java View File

1
+package rocks.zipcode.io.domain;
2
+
3
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
4
+import org.hibernate.annotations.Cache;
5
+import org.hibernate.annotations.CacheConcurrencyStrategy;
6
+
7
+import javax.persistence.*;
8
+
9
+import java.io.Serializable;
10
+import java.util.Objects;
11
+
12
+/**
13
+ * A Album.
14
+ */
15
+@Entity
16
+@Table(name = "album")
17
+@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
18
+public class Album implements Serializable {
19
+
20
+    private static final long serialVersionUID = 1L;
21
+
22
+    @Id
23
+    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sequenceGenerator")
24
+    @SequenceGenerator(name = "sequenceGenerator")
25
+    private Long id;
26
+
27
+    @Column(name = "name")
28
+    private String name;
29
+
30
+    @Column(name = "description")
31
+    private String description;
32
+
33
+    @ManyToOne
34
+    @JsonIgnoreProperties("")
35
+    private User owner;
36
+
37
+    // jhipster-needle-entity-add-field - JHipster will add fields here, do not remove
38
+    public Long getId() {
39
+        return id;
40
+    }
41
+
42
+    public void setId(Long id) {
43
+        this.id = id;
44
+    }
45
+
46
+    public String getName() {
47
+        return name;
48
+    }
49
+
50
+    public Album name(String name) {
51
+        this.name = name;
52
+        return this;
53
+    }
54
+
55
+    public void setName(String name) {
56
+        this.name = name;
57
+    }
58
+
59
+    public String getDescription() {
60
+        return description;
61
+    }
62
+
63
+    public Album description(String description) {
64
+        this.description = description;
65
+        return this;
66
+    }
67
+
68
+    public void setDescription(String description) {
69
+        this.description = description;
70
+    }
71
+
72
+    public User getOwner() {
73
+        return owner;
74
+    }
75
+
76
+    public Album owner(User user) {
77
+        this.owner = user;
78
+        return this;
79
+    }
80
+
81
+    public void setOwner(User user) {
82
+        this.owner = user;
83
+    }
84
+    // jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here, do not remove
85
+
86
+    @Override
87
+    public boolean equals(Object o) {
88
+        if (this == o) {
89
+            return true;
90
+        }
91
+        if (o == null || getClass() != o.getClass()) {
92
+            return false;
93
+        }
94
+        Album album = (Album) o;
95
+        if (album.getId() == null || getId() == null) {
96
+            return false;
97
+        }
98
+        return Objects.equals(getId(), album.getId());
99
+    }
100
+
101
+    @Override
102
+    public int hashCode() {
103
+        return Objects.hashCode(getId());
104
+    }
105
+
106
+    @Override
107
+    public String toString() {
108
+        return "Album{" +
109
+            "id=" + getId() +
110
+            ", name='" + getName() + "'" +
111
+            ", description='" + getDescription() + "'" +
112
+            "}";
113
+    }
114
+}

+ 148
- 0
src/main/java/rocks/zipcode/io/domain/Comment.java View File

1
+package rocks.zipcode.io.domain;
2
+
3
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
4
+import org.hibernate.annotations.Cache;
5
+import org.hibernate.annotations.CacheConcurrencyStrategy;
6
+
7
+import javax.persistence.*;
8
+
9
+import java.io.Serializable;
10
+import java.util.Objects;
11
+
12
+/**
13
+ * A Comment.
14
+ */
15
+@Entity
16
+@Table(name = "comment")
17
+@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
18
+public class Comment implements Serializable {
19
+
20
+    private static final long serialVersionUID = 1L;
21
+
22
+    @Id
23
+    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sequenceGenerator")
24
+    @SequenceGenerator(name = "sequenceGenerator")
25
+    private Long id;
26
+
27
+    @Column(name = "content")
28
+    private String content;
29
+
30
+    @Column(name = "likes")
31
+    private Long likes;
32
+
33
+    @Column(name = "dislikes")
34
+    private Long dislikes;
35
+
36
+    @ManyToOne
37
+    @JsonIgnoreProperties("")
38
+    private User commenter;
39
+
40
+    @ManyToOne
41
+    @JsonIgnoreProperties("")
42
+    private Post post;
43
+
44
+    // jhipster-needle-entity-add-field - JHipster will add fields here, do not remove
45
+    public Long getId() {
46
+        return id;
47
+    }
48
+
49
+    public void setId(Long id) {
50
+        this.id = id;
51
+    }
52
+
53
+    public String getContent() {
54
+        return content;
55
+    }
56
+
57
+    public Comment content(String content) {
58
+        this.content = content;
59
+        return this;
60
+    }
61
+
62
+    public void setContent(String content) {
63
+        this.content = content;
64
+    }
65
+
66
+    public Long getLikes() {
67
+        return likes;
68
+    }
69
+
70
+    public Comment likes(Long likes) {
71
+        this.likes = likes;
72
+        return this;
73
+    }
74
+
75
+    public void setLikes(Long likes) {
76
+        this.likes = likes;
77
+    }
78
+
79
+    public Long getDislikes() {
80
+        return dislikes;
81
+    }
82
+
83
+    public Comment dislikes(Long dislikes) {
84
+        this.dislikes = dislikes;
85
+        return this;
86
+    }
87
+
88
+    public void setDislikes(Long dislikes) {
89
+        this.dislikes = dislikes;
90
+    }
91
+
92
+    public User getCommenter() {
93
+        return commenter;
94
+    }
95
+
96
+    public Comment commenter(User user) {
97
+        this.commenter = user;
98
+        return this;
99
+    }
100
+
101
+    public void setCommenter(User user) {
102
+        this.commenter = user;
103
+    }
104
+
105
+    public Post getPost() {
106
+        return post;
107
+    }
108
+
109
+    public Comment post(Post post) {
110
+        this.post = post;
111
+        return this;
112
+    }
113
+
114
+    public void setPost(Post post) {
115
+        this.post = post;
116
+    }
117
+    // jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here, do not remove
118
+
119
+    @Override
120
+    public boolean equals(Object o) {
121
+        if (this == o) {
122
+            return true;
123
+        }
124
+        if (o == null || getClass() != o.getClass()) {
125
+            return false;
126
+        }
127
+        Comment comment = (Comment) o;
128
+        if (comment.getId() == null || getId() == null) {
129
+            return false;
130
+        }
131
+        return Objects.equals(getId(), comment.getId());
132
+    }
133
+
134
+    @Override
135
+    public int hashCode() {
136
+        return Objects.hashCode(getId());
137
+    }
138
+
139
+    @Override
140
+    public String toString() {
141
+        return "Comment{" +
142
+            "id=" + getId() +
143
+            ", content='" + getContent() + "'" +
144
+            ", likes=" + getLikes() +
145
+            ", dislikes=" + getDislikes() +
146
+            "}";
147
+    }
148
+}

+ 114
- 0
src/main/java/rocks/zipcode/io/domain/Friend.java View File

1
+package rocks.zipcode.io.domain;
2
+
3
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
4
+import org.hibernate.annotations.Cache;
5
+import org.hibernate.annotations.CacheConcurrencyStrategy;
6
+
7
+import javax.persistence.*;
8
+
9
+import java.io.Serializable;
10
+import java.util.Objects;
11
+
12
+/**
13
+ * A Friend.
14
+ */
15
+@Entity
16
+@Table(name = "friend")
17
+@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
18
+public class Friend implements Serializable {
19
+
20
+    private static final long serialVersionUID = 1L;
21
+
22
+    @Id
23
+    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sequenceGenerator")
24
+    @SequenceGenerator(name = "sequenceGenerator")
25
+    private Long id;
26
+
27
+    @Column(name = "top_friend")
28
+    private Boolean topFriend;
29
+
30
+    @ManyToOne
31
+    @JsonIgnoreProperties("")
32
+    private User user;
33
+
34
+    @ManyToOne
35
+    @JsonIgnoreProperties("")
36
+    private User friend;
37
+
38
+    // jhipster-needle-entity-add-field - JHipster will add fields here, do not remove
39
+    public Long getId() {
40
+        return id;
41
+    }
42
+
43
+    public void setId(Long id) {
44
+        this.id = id;
45
+    }
46
+
47
+    public Boolean isTopFriend() {
48
+        return topFriend;
49
+    }
50
+
51
+    public Friend topFriend(Boolean topFriend) {
52
+        this.topFriend = topFriend;
53
+        return this;
54
+    }
55
+
56
+    public void setTopFriend(Boolean topFriend) {
57
+        this.topFriend = topFriend;
58
+    }
59
+
60
+    public User getUser() {
61
+        return user;
62
+    }
63
+
64
+    public Friend user(User user) {
65
+        this.user = user;
66
+        return this;
67
+    }
68
+
69
+    public void setUser(User user) {
70
+        this.user = user;
71
+    }
72
+
73
+    public User getFriend() {
74
+        return friend;
75
+    }
76
+
77
+    public Friend friend(User user) {
78
+        this.friend = user;
79
+        return this;
80
+    }
81
+
82
+    public void setFriend(User user) {
83
+        this.friend = user;
84
+    }
85
+    // jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here, do not remove
86
+
87
+    @Override
88
+    public boolean equals(Object o) {
89
+        if (this == o) {
90
+            return true;
91
+        }
92
+        if (o == null || getClass() != o.getClass()) {
93
+            return false;
94
+        }
95
+        Friend friend = (Friend) o;
96
+        if (friend.getId() == null || getId() == null) {
97
+            return false;
98
+        }
99
+        return Objects.equals(getId(), friend.getId());
100
+    }
101
+
102
+    @Override
103
+    public int hashCode() {
104
+        return Objects.hashCode(getId());
105
+    }
106
+
107
+    @Override
108
+    public String toString() {
109
+        return "Friend{" +
110
+            "id=" + getId() +
111
+            ", topFriend='" + isTopFriend() + "'" +
112
+            "}";
113
+    }
114
+}

+ 146
- 0
src/main/java/rocks/zipcode/io/domain/Photo.java View File

1
+package rocks.zipcode.io.domain;
2
+
3
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
4
+import org.hibernate.annotations.Cache;
5
+import org.hibernate.annotations.CacheConcurrencyStrategy;
6
+
7
+import javax.persistence.*;
8
+
9
+import java.io.Serializable;
10
+import java.util.HashSet;
11
+import java.util.Set;
12
+import java.util.Objects;
13
+
14
+/**
15
+ * A Photo.
16
+ */
17
+@Entity
18
+@Table(name = "photo")
19
+@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
20
+public class Photo implements Serializable {
21
+
22
+    private static final long serialVersionUID = 1L;
23
+
24
+    @Id
25
+    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sequenceGenerator")
26
+    @SequenceGenerator(name = "sequenceGenerator")
27
+    private Long id;
28
+
29
+    @Column(name = "image_url")
30
+    private String imageURL;
31
+
32
+    @Column(name = "jhi_size")
33
+    private Long size;
34
+
35
+    @ManyToOne
36
+    @JsonIgnoreProperties("")
37
+    private Post post;
38
+
39
+    @ManyToMany
40
+    @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
41
+    @JoinTable(name = "photo_album",
42
+               joinColumns = @JoinColumn(name = "photos_id", referencedColumnName = "id"),
43
+               inverseJoinColumns = @JoinColumn(name = "albums_id", referencedColumnName = "id"))
44
+    private Set<Album> albums = new HashSet<>();
45
+
46
+    // jhipster-needle-entity-add-field - JHipster will add fields here, do not remove
47
+    public Long getId() {
48
+        return id;
49
+    }
50
+
51
+    public void setId(Long id) {
52
+        this.id = id;
53
+    }
54
+
55
+    public String getImageURL() {
56
+        return imageURL;
57
+    }
58
+
59
+    public Photo imageURL(String imageURL) {
60
+        this.imageURL = imageURL;
61
+        return this;
62
+    }
63
+
64
+    public void setImageURL(String imageURL) {
65
+        this.imageURL = imageURL;
66
+    }
67
+
68
+    public Long getSize() {
69
+        return size;
70
+    }
71
+
72
+    public Photo size(Long size) {
73
+        this.size = size;
74
+        return this;
75
+    }
76
+
77
+    public void setSize(Long size) {
78
+        this.size = size;
79
+    }
80
+
81
+    public Post getPost() {
82
+        return post;
83
+    }
84
+
85
+    public Photo post(Post post) {
86
+        this.post = post;
87
+        return this;
88
+    }
89
+
90
+    public void setPost(Post post) {
91
+        this.post = post;
92
+    }
93
+
94
+    public Set<Album> getAlbums() {
95
+        return albums;
96
+    }
97
+
98
+    public Photo albums(Set<Album> albums) {
99
+        this.albums = albums;
100
+        return this;
101
+    }
102
+
103
+    public Photo addAlbum(Album album) {
104
+        this.albums.add(album);
105
+        return this;
106
+    }
107
+
108
+    public Photo removeAlbum(Album album) {
109
+        this.albums.remove(album);
110
+        return this;
111
+    }
112
+
113
+    public void setAlbums(Set<Album> albums) {
114
+        this.albums = albums;
115
+    }
116
+    // jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here, do not remove
117
+
118
+    @Override
119
+    public boolean equals(Object o) {
120
+        if (this == o) {
121
+            return true;
122
+        }
123
+        if (o == null || getClass() != o.getClass()) {
124
+            return false;
125
+        }
126
+        Photo photo = (Photo) o;
127
+        if (photo.getId() == null || getId() == null) {
128
+            return false;
129
+        }
130
+        return Objects.equals(getId(), photo.getId());
131
+    }
132
+
133
+    @Override
134
+    public int hashCode() {
135
+        return Objects.hashCode(getId());
136
+    }
137
+
138
+    @Override
139
+    public String toString() {
140
+        return "Photo{" +
141
+            "id=" + getId() +
142
+            ", imageURL='" + getImageURL() + "'" +
143
+            ", size=" + getSize() +
144
+            "}";
145
+    }
146
+}

+ 148
- 0
src/main/java/rocks/zipcode/io/domain/Post.java View File

1
+package rocks.zipcode.io.domain;
2
+
3
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
4
+import org.hibernate.annotations.Cache;
5
+import org.hibernate.annotations.CacheConcurrencyStrategy;
6
+
7
+import javax.persistence.*;
8
+
9
+import java.io.Serializable;
10
+import java.util.Objects;
11
+
12
+/**
13
+ * A Post.
14
+ */
15
+@Entity
16
+@Table(name = "post")
17
+@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
18
+public class Post implements Serializable {
19
+
20
+    private static final long serialVersionUID = 1L;
21
+
22
+    @Id
23
+    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sequenceGenerator")
24
+    @SequenceGenerator(name = "sequenceGenerator")
25
+    private Long id;
26
+
27
+    @Column(name = "number_of_comments")
28
+    private Long numberOfComments;
29
+
30
+    @Column(name = "content")
31
+    private String content;
32
+
33
+    @Column(name = "likes")
34
+    private Long likes;
35
+
36
+    @Column(name = "dislikes")
37
+    private Long dislikes;
38
+
39
+    @ManyToOne
40
+    @JsonIgnoreProperties("")
41
+    private User owner;
42
+
43
+    // jhipster-needle-entity-add-field - JHipster will add fields here, do not remove
44
+    public Long getId() {
45
+        return id;
46
+    }
47
+
48
+    public void setId(Long id) {
49
+        this.id = id;
50
+    }
51
+
52
+    public Long getNumberOfComments() {
53
+        return numberOfComments;
54
+    }
55
+
56
+    public Post numberOfComments(Long numberOfComments) {
57
+        this.numberOfComments = numberOfComments;
58
+        return this;
59
+    }
60
+
61
+    public void setNumberOfComments(Long numberOfComments) {
62
+        this.numberOfComments = numberOfComments;
63
+    }
64
+
65
+    public String getContent() {
66
+        return content;
67
+    }
68
+
69
+    public Post content(String content) {
70
+        this.content = content;
71
+        return this;
72
+    }
73
+
74
+    public void setContent(String content) {
75
+        this.content = content;
76
+    }
77
+
78
+    public Long getLikes() {
79
+        return likes;
80
+    }
81
+
82
+    public Post likes(Long likes) {
83
+        this.likes = likes;
84
+        return this;
85
+    }
86
+
87
+    public void setLikes(Long likes) {
88
+        this.likes = likes;
89
+    }
90
+
91
+    public Long getDislikes() {
92
+        return dislikes;
93
+    }
94
+
95
+    public Post dislikes(Long dislikes) {
96
+        this.dislikes = dislikes;
97
+        return this;
98
+    }
99
+
100
+    public void setDislikes(Long dislikes) {
101
+        this.dislikes = dislikes;
102
+    }
103
+
104
+    public User getOwner() {
105
+        return owner;
106
+    }
107
+
108
+    public Post owner(User user) {
109
+        this.owner = user;
110
+        return this;
111
+    }
112
+
113
+    public void setOwner(User user) {
114
+        this.owner = user;
115
+    }
116
+    // jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here, do not remove
117
+
118
+    @Override
119
+    public boolean equals(Object o) {
120
+        if (this == o) {
121
+            return true;
122
+        }
123
+        if (o == null || getClass() != o.getClass()) {
124
+            return false;
125
+        }
126
+        Post post = (Post) o;
127
+        if (post.getId() == null || getId() == null) {
128
+            return false;
129
+        }
130
+        return Objects.equals(getId(), post.getId());
131
+    }
132
+
133
+    @Override
134
+    public int hashCode() {
135
+        return Objects.hashCode(getId());
136
+    }
137
+
138
+    @Override
139
+    public String toString() {
140
+        return "Post{" +
141
+            "id=" + getId() +
142
+            ", numberOfComments=" + getNumberOfComments() +
143
+            ", content='" + getContent() + "'" +
144
+            ", likes=" + getLikes() +
145
+            ", dislikes=" + getDislikes() +
146
+            "}";
147
+    }
148
+}

+ 112
- 0
src/main/java/rocks/zipcode/io/domain/Profile.java View File

1
+package rocks.zipcode.io.domain;
2
+
3
+import org.hibernate.annotations.Cache;
4
+import org.hibernate.annotations.CacheConcurrencyStrategy;
5
+
6
+import javax.persistence.*;
7
+
8
+import java.io.Serializable;
9
+import java.util.Objects;
10
+
11
+/**
12
+ * A Profile.
13
+ */
14
+@Entity
15
+@Table(name = "profile")
16
+@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
17
+public class Profile implements Serializable {
18
+
19
+    private static final long serialVersionUID = 1L;
20
+
21
+    @Id
22
+    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sequenceGenerator")
23
+    @SequenceGenerator(name = "sequenceGenerator")
24
+    private Long id;
25
+
26
+    @Column(name = "bio")
27
+    private String bio;
28
+
29
+    @Column(name = "jhi_accessible")
30
+    private Boolean accessible;
31
+
32
+    @OneToOne    @JoinColumn(unique = true)
33
+    private User userProfile;
34
+
35
+    // jhipster-needle-entity-add-field - JHipster will add fields here, do not remove
36
+    public Long getId() {
37
+        return id;
38
+    }
39
+
40
+    public void setId(Long id) {
41
+        this.id = id;
42
+    }
43
+
44
+    public String getBio() {
45
+        return bio;
46
+    }
47
+
48
+    public Profile bio(String bio) {
49
+        this.bio = bio;
50
+        return this;
51
+    }
52
+
53
+    public void setBio(String bio) {
54
+        this.bio = bio;
55
+    }
56
+
57
+    public Boolean isAccessible() {
58
+        return accessible;
59
+    }
60
+
61
+    public Profile accessible(Boolean accessible) {
62
+        this.accessible = accessible;
63
+        return this;
64
+    }
65
+
66
+    public void setAccessible(Boolean accessible) {
67
+        this.accessible = accessible;
68
+    }
69
+
70
+    public User getUserProfile() {
71
+        return userProfile;
72
+    }
73
+
74
+    public Profile userProfile(User user) {
75
+        this.userProfile = user;
76
+        return this;
77
+    }
78
+
79
+    public void setUserProfile(User user) {
80
+        this.userProfile = user;
81
+    }
82
+    // jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here, do not remove
83
+
84
+    @Override
85
+    public boolean equals(Object o) {
86
+        if (this == o) {
87
+            return true;
88
+        }
89
+        if (o == null || getClass() != o.getClass()) {
90
+            return false;
91
+        }
92
+        Profile profile = (Profile) o;
93
+        if (profile.getId() == null || getId() == null) {
94
+            return false;
95
+        }
96
+        return Objects.equals(getId(), profile.getId());
97
+    }
98
+
99
+    @Override
100
+    public int hashCode() {
101
+        return Objects.hashCode(getId());
102
+    }
103
+
104
+    @Override
105
+    public String toString() {
106
+        return "Profile{" +
107
+            "id=" + getId() +
108
+            ", bio='" + getBio() + "'" +
109
+            ", accessible='" + isAccessible() + "'" +
110
+            "}";
111
+    }
112
+}

+ 114
- 0
src/main/java/rocks/zipcode/io/domain/Video.java View File

1
+package rocks.zipcode.io.domain;
2
+
3
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
4
+import org.hibernate.annotations.Cache;
5
+import org.hibernate.annotations.CacheConcurrencyStrategy;
6
+
7
+import javax.persistence.*;
8
+
9
+import java.io.Serializable;
10
+import java.util.Objects;
11
+
12
+/**
13
+ * A Video.
14
+ */
15
+@Entity
16
+@Table(name = "video")
17
+@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
18
+public class Video implements Serializable {
19
+
20
+    private static final long serialVersionUID = 1L;
21
+
22
+    @Id
23
+    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sequenceGenerator")
24
+    @SequenceGenerator(name = "sequenceGenerator")
25
+    private Long id;
26
+
27
+    @Column(name = "video_url")
28
+    private String videoURL;
29
+
30
+    @Column(name = "jhi_size")
31
+    private Long size;
32
+
33
+    @ManyToOne
34
+    @JsonIgnoreProperties("")
35
+    private Post post;
36
+
37
+    // jhipster-needle-entity-add-field - JHipster will add fields here, do not remove
38
+    public Long getId() {
39
+        return id;
40
+    }
41
+
42
+    public void setId(Long id) {
43
+        this.id = id;
44
+    }
45
+
46
+    public String getVideoURL() {
47
+        return videoURL;
48
+    }
49
+
50
+    public Video videoURL(String videoURL) {
51
+        this.videoURL = videoURL;
52
+        return this;
53
+    }
54
+
55
+    public void setVideoURL(String videoURL) {
56
+        this.videoURL = videoURL;
57
+    }
58
+
59
+    public Long getSize() {
60
+        return size;
61
+    }
62
+
63
+    public Video size(Long size) {
64
+        this.size = size;
65
+        return this;
66
+    }
67
+
68
+    public void setSize(Long size) {
69
+        this.size = size;
70
+    }
71
+
72
+    public Post getPost() {
73
+        return post;
74
+    }
75
+
76
+    public Video post(Post post) {
77
+        this.post = post;
78
+        return this;
79
+    }
80
+
81
+    public void setPost(Post post) {
82
+        this.post = post;
83
+    }
84
+    // jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here, do not remove
85
+
86
+    @Override
87
+    public boolean equals(Object o) {
88
+        if (this == o) {
89
+            return true;
90
+        }
91
+        if (o == null || getClass() != o.getClass()) {
92
+            return false;
93
+        }
94
+        Video video = (Video) o;
95
+        if (video.getId() == null || getId() == null) {
96
+            return false;
97
+        }
98
+        return Objects.equals(getId(), video.getId());
99
+    }
100
+
101
+    @Override
102
+    public int hashCode() {
103
+        return Objects.hashCode(getId());
104
+    }
105
+
106
+    @Override
107
+    public String toString() {
108
+        return "Video{" +
109
+            "id=" + getId() +
110
+            ", videoURL='" + getVideoURL() + "'" +
111
+            ", size=" + getSize() +
112
+            "}";
113
+    }
114
+}

+ 15
- 0
src/main/java/rocks/zipcode/io/repository/AccountDetailsRepository.java View File

1
+package rocks.zipcode.io.repository;
2
+
3
+import rocks.zipcode.io.domain.AccountDetails;
4
+import org.springframework.data.jpa.repository.*;
5
+import org.springframework.stereotype.Repository;
6
+
7
+
8
+/**
9
+ * Spring Data  repository for the AccountDetails entity.
10
+ */
11
+@SuppressWarnings("unused")
12
+@Repository
13
+public interface AccountDetailsRepository extends JpaRepository<AccountDetails, Long> {
14
+
15
+}

+ 19
- 0
src/main/java/rocks/zipcode/io/repository/AlbumRepository.java View File

1
+package rocks.zipcode.io.repository;
2
+
3
+import rocks.zipcode.io.domain.Album;
4
+import org.springframework.data.jpa.repository.*;
5
+import org.springframework.stereotype.Repository;
6
+
7
+import java.util.List;
8
+
9
+/**
10
+ * Spring Data  repository for the Album entity.
11
+ */
12
+@SuppressWarnings("unused")
13
+@Repository
14
+public interface AlbumRepository extends JpaRepository<Album, Long> {
15
+
16
+    @Query("select album from Album album where album.owner.login = ?#{principal.username}")
17
+    List<Album> findByOwnerIsCurrentUser();
18
+
19
+}

+ 19
- 0
src/main/java/rocks/zipcode/io/repository/CommentRepository.java View File

1
+package rocks.zipcode.io.repository;
2
+
3
+import rocks.zipcode.io.domain.Comment;
4
+import org.springframework.data.jpa.repository.*;
5
+import org.springframework.stereotype.Repository;
6
+
7
+import java.util.List;
8
+
9
+/**
10
+ * Spring Data  repository for the Comment entity.
11
+ */
12
+@SuppressWarnings("unused")
13
+@Repository
14
+public interface CommentRepository extends JpaRepository<Comment, Long> {
15
+
16
+    @Query("select comment from Comment comment where comment.commenter.login = ?#{principal.username}")
17
+    List<Comment> findByCommenterIsCurrentUser();
18
+
19
+}

+ 22
- 0
src/main/java/rocks/zipcode/io/repository/FriendRepository.java View File

1
+package rocks.zipcode.io.repository;
2
+
3
+import rocks.zipcode.io.domain.Friend;
4
+import org.springframework.data.jpa.repository.*;
5
+import org.springframework.stereotype.Repository;
6
+
7
+import java.util.List;
8
+
9
+/**
10
+ * Spring Data  repository for the Friend entity.
11
+ */
12
+@SuppressWarnings("unused")
13
+@Repository
14
+public interface FriendRepository extends JpaRepository<Friend, Long> {
15
+
16
+    @Query("select friend from Friend friend where friend.user.login = ?#{principal.username}")
17
+    List<Friend> findByUserIsCurrentUser();
18
+
19
+    @Query("select friend from Friend friend where friend.friend.login = ?#{principal.username}")
20
+    List<Friend> findByFriendIsCurrentUser();
21
+
22
+}

+ 30
- 0
src/main/java/rocks/zipcode/io/repository/PhotoRepository.java View File

1
+package rocks.zipcode.io.repository;
2
+
3
+import rocks.zipcode.io.domain.Photo;
4
+import org.springframework.data.domain.Page;
5
+import org.springframework.data.domain.Pageable;
6
+import org.springframework.data.jpa.repository.*;
7
+import org.springframework.data.repository.query.Param;
8
+import org.springframework.stereotype.Repository;
9
+
10
+import java.util.List;
11
+import java.util.Optional;
12
+
13
+/**
14
+ * Spring Data  repository for the Photo entity.
15
+ */
16
+@SuppressWarnings("unused")
17
+@Repository
18
+public interface PhotoRepository extends JpaRepository<Photo, Long> {
19
+
20
+    @Query(value = "select distinct photo from Photo photo left join fetch photo.albums",
21
+        countQuery = "select count(distinct photo) from Photo photo")
22
+    Page<Photo> findAllWithEagerRelationships(Pageable pageable);
23
+
24
+    @Query(value = "select distinct photo from Photo photo left join fetch photo.albums")
25
+    List<Photo> findAllWithEagerRelationships();
26
+
27
+    @Query("select photo from Photo photo left join fetch photo.albums where photo.id =:id")
28
+    Optional<Photo> findOneWithEagerRelationships(@Param("id") Long id);
29
+
30
+}

+ 19
- 0
src/main/java/rocks/zipcode/io/repository/PostRepository.java View File

1
+package rocks.zipcode.io.repository;
2
+
3
+import rocks.zipcode.io.domain.Post;
4
+import org.springframework.data.jpa.repository.*;
5
+import org.springframework.stereotype.Repository;
6
+
7
+import java.util.List;
8
+
9
+/**
10
+ * Spring Data  repository for the Post entity.
11
+ */
12
+@SuppressWarnings("unused")
13
+@Repository
14
+public interface PostRepository extends JpaRepository<Post, Long> {
15
+
16
+    @Query("select post from Post post where post.owner.login = ?#{principal.username}")
17
+    List<Post> findByOwnerIsCurrentUser();
18
+
19
+}

+ 15
- 0
src/main/java/rocks/zipcode/io/repository/ProfileRepository.java View File

1
+package rocks.zipcode.io.repository;
2
+
3
+import rocks.zipcode.io.domain.Profile;
4
+import org.springframework.data.jpa.repository.*;
5
+import org.springframework.stereotype.Repository;
6
+
7
+
8
+/**
9
+ * Spring Data  repository for the Profile entity.
10
+ */
11
+@SuppressWarnings("unused")
12
+@Repository
13
+public interface ProfileRepository extends JpaRepository<Profile, Long> {
14
+
15
+}

+ 4
- 0
src/main/java/rocks/zipcode/io/repository/UserRepository.java View File

1
 package rocks.zipcode.io.repository;
1
 package rocks.zipcode.io.repository;
2
 
2
 
3
+import org.springframework.data.jpa.repository.Query;
3
 import rocks.zipcode.io.domain.User;
4
 import rocks.zipcode.io.domain.User;
4
 
5
 
5
 import org.springframework.cache.annotation.Cacheable;
6
 import org.springframework.cache.annotation.Cacheable;
32
 
33
 
33
     Optional<User> findOneByLogin(String login);
34
     Optional<User> findOneByLogin(String login);
34
 
35
 
36
+    @Query("select user from User user where user.login = ?#{principal.username}")
37
+    Optional<User> findOneByCurrentUser();
38
+
35
     @EntityGraph(attributePaths = "authorities")
39
     @EntityGraph(attributePaths = "authorities")
36
     Optional<User> findOneWithAuthoritiesById(Long id);
40
     Optional<User> findOneWithAuthoritiesById(Long id);
37
 
41
 

+ 15
- 0
src/main/java/rocks/zipcode/io/repository/VideoRepository.java View File

1
+package rocks.zipcode.io.repository;
2
+
3
+import rocks.zipcode.io.domain.Video;
4
+import org.springframework.data.jpa.repository.*;
5
+import org.springframework.stereotype.Repository;
6
+
7
+
8
+/**
9
+ * Spring Data  repository for the Video entity.
10
+ */
11
+@SuppressWarnings("unused")
12
+@Repository
13
+public interface VideoRepository extends JpaRepository<Video, Long> {
14
+
15
+}

+ 31
- 1
src/main/java/rocks/zipcode/io/service/UserService.java View File

1
 package rocks.zipcode.io.service;
1
 package rocks.zipcode.io.service;
2
 
2
 
3
 import rocks.zipcode.io.config.Constants;
3
 import rocks.zipcode.io.config.Constants;
4
+import rocks.zipcode.io.domain.AccountDetails;
4
 import rocks.zipcode.io.domain.Authority;
5
 import rocks.zipcode.io.domain.Authority;
6
+import rocks.zipcode.io.domain.Profile;
5
 import rocks.zipcode.io.domain.User;
7
 import rocks.zipcode.io.domain.User;
8
+import rocks.zipcode.io.repository.AccountDetailsRepository;
6
 import rocks.zipcode.io.repository.AuthorityRepository;
9
 import rocks.zipcode.io.repository.AuthorityRepository;
10
+import rocks.zipcode.io.repository.ProfileRepository;
7
 import rocks.zipcode.io.repository.UserRepository;
11
 import rocks.zipcode.io.repository.UserRepository;
8
 import rocks.zipcode.io.security.AuthoritiesConstants;
12
 import rocks.zipcode.io.security.AuthoritiesConstants;
9
 import rocks.zipcode.io.security.SecurityUtils;
13
 import rocks.zipcode.io.security.SecurityUtils;
37
 
41
 
38
     private final UserRepository userRepository;
42
     private final UserRepository userRepository;
39
 
43
 
44
+    private final ProfileRepository profileRepository;
45
+
46
+    private final AccountDetailsRepository accountDetailsRepository;
47
+
40
     private final PasswordEncoder passwordEncoder;
48
     private final PasswordEncoder passwordEncoder;
41
 
49
 
42
     private final AuthorityRepository authorityRepository;
50
     private final AuthorityRepository authorityRepository;
43
 
51
 
44
     private final CacheManager cacheManager;
52
     private final CacheManager cacheManager;
45
 
53
 
46
-    public UserService(UserRepository userRepository, PasswordEncoder passwordEncoder, AuthorityRepository authorityRepository, CacheManager cacheManager) {
54
+    public UserService(UserRepository userRepository, AccountDetailsRepository accountDetailsRepository, ProfileRepository profileRepository, PasswordEncoder passwordEncoder, AuthorityRepository authorityRepository, CacheManager cacheManager) {
47
         this.userRepository = userRepository;
55
         this.userRepository = userRepository;
48
         this.passwordEncoder = passwordEncoder;
56
         this.passwordEncoder = passwordEncoder;
49
         this.authorityRepository = authorityRepository;
57
         this.authorityRepository = authorityRepository;
50
         this.cacheManager = cacheManager;
58
         this.cacheManager = cacheManager;
59
+        this.profileRepository = profileRepository;
60
+        this.accountDetailsRepository = accountDetailsRepository;
51
     }
61
     }
52
 
62
 
53
     public Optional<User> activateRegistration(String key) {
63
     public Optional<User> activateRegistration(String key) {
139
         user.setLastName(userDTO.getLastName());
149
         user.setLastName(userDTO.getLastName());
140
         user.setEmail(userDTO.getEmail().toLowerCase());
150
         user.setEmail(userDTO.getEmail().toLowerCase());
141
         user.setImageUrl(userDTO.getImageUrl());
151
         user.setImageUrl(userDTO.getImageUrl());
152
+
153
+        //create default profile
154
+        Profile profile = new Profile();
155
+        profile.setBio("");
156
+        profile.setUserProfile(user);
157
+        profile.setAccessible(true);
158
+
159
+        //create default account details
160
+        AccountDetails accountDetails = new AccountDetails();
161
+        accountDetails.setSecurityQuestion("");
162
+        accountDetails.setSecurityAnswer("");
163
+
142
         if (userDTO.getLangKey() == null) {
164
         if (userDTO.getLangKey() == null) {
143
             user.setLangKey(Constants.DEFAULT_LANGUAGE); // default language
165
             user.setLangKey(Constants.DEFAULT_LANGUAGE); // default language
144
         } else {
166
         } else {
157
                 .collect(Collectors.toSet());
179
                 .collect(Collectors.toSet());
158
             user.setAuthorities(authorities);
180
             user.setAuthorities(authorities);
159
         }
181
         }
182
+
160
         userRepository.save(user);
183
         userRepository.save(user);
184
+
185
+        //save the default profile
186
+        profileRepository.save(profile);
187
+
188
+        //save the default account details
189
+        accountDetailsRepository.save(accountDetails);
190
+
161
         this.clearUserCaches(user);
191
         this.clearUserCaches(user);
162
         log.debug("Created Information for User: {}", user);
192
         log.debug("Created Information for User: {}", user);
163
         return user;
193
         return user;

+ 119
- 0
src/main/java/rocks/zipcode/io/web/rest/AccountDetailsResource.java View File

1
+package rocks.zipcode.io.web.rest;
2
+
3
+import com.codahale.metrics.annotation.Timed;
4
+import rocks.zipcode.io.domain.AccountDetails;
5
+import rocks.zipcode.io.repository.AccountDetailsRepository;
6
+import rocks.zipcode.io.web.rest.errors.BadRequestAlertException;
7
+import rocks.zipcode.io.web.rest.util.HeaderUtil;
8
+import io.github.jhipster.web.util.ResponseUtil;
9
+import org.slf4j.Logger;
10
+import org.slf4j.LoggerFactory;
11
+import org.springframework.http.ResponseEntity;
12
+import org.springframework.web.bind.annotation.*;
13
+
14
+import java.net.URI;
15
+import java.net.URISyntaxException;
16
+
17
+import java.util.List;
18
+import java.util.Optional;
19
+
20
+/**
21
+ * REST controller for managing AccountDetails.
22
+ */
23
+@RestController
24
+@RequestMapping("/api")
25
+public class AccountDetailsResource {
26
+
27
+    private final Logger log = LoggerFactory.getLogger(AccountDetailsResource.class);
28
+
29
+    private static final String ENTITY_NAME = "accountDetails";
30
+
31
+    private final AccountDetailsRepository accountDetailsRepository;
32
+
33
+    public AccountDetailsResource(AccountDetailsRepository accountDetailsRepository) {
34
+        this.accountDetailsRepository = accountDetailsRepository;
35
+    }
36
+
37
+    /**
38
+     * POST  /account-details : Create a new accountDetails.
39
+     *
40
+     * @param accountDetails the accountDetails to create
41
+     * @return the ResponseEntity with status 201 (Created) and with body the new accountDetails, or with status 400 (Bad Request) if the accountDetails has already an ID
42
+     * @throws URISyntaxException if the Location URI syntax is incorrect
43
+     */
44
+    @PostMapping("/account-details")
45
+    @Timed
46
+    public ResponseEntity<AccountDetails> createAccountDetails(@RequestBody AccountDetails accountDetails) throws URISyntaxException {
47
+        log.debug("REST request to save AccountDetails : {}", accountDetails);
48
+        if (accountDetails.getId() != null) {
49
+            throw new BadRequestAlertException("A new accountDetails cannot already have an ID", ENTITY_NAME, "idexists");
50
+        }
51
+        AccountDetails result = accountDetailsRepository.save(accountDetails);
52
+        return ResponseEntity.created(new URI("/api/account-details/" + result.getId()))
53
+            .headers(HeaderUtil.createEntityCreationAlert(ENTITY_NAME, result.getId().toString()))
54
+            .body(result);
55
+    }
56
+
57
+    /**
58
+     * PUT  /account-details : Updates an existing accountDetails.
59
+     *
60
+     * @param accountDetails the accountDetails to update
61
+     * @return the ResponseEntity with status 200 (OK) and with body the updated accountDetails,
62
+     * or with status 400 (Bad Request) if the accountDetails is not valid,
63
+     * or with status 500 (Internal Server Error) if the accountDetails couldn't be updated
64
+     * @throws URISyntaxException if the Location URI syntax is incorrect
65
+     */
66
+    @PutMapping("/account-details")
67
+    @Timed
68
+    public ResponseEntity<AccountDetails> updateAccountDetails(@RequestBody AccountDetails accountDetails) throws URISyntaxException {
69
+        log.debug("REST request to update AccountDetails : {}", accountDetails);
70
+        if (accountDetails.getId() == null) {
71
+            throw new BadRequestAlertException("Invalid id", ENTITY_NAME, "idnull");
72
+        }
73
+        AccountDetails result = accountDetailsRepository.save(accountDetails);
74
+        return ResponseEntity.ok()
75
+            .headers(HeaderUtil.createEntityUpdateAlert(ENTITY_NAME, accountDetails.getId().toString()))
76
+            .body(result);
77
+    }
78
+
79
+    /**
80
+     * GET  /account-details : get all the accountDetails.
81
+     *
82
+     * @return the ResponseEntity with status 200 (OK) and the list of accountDetails in body
83
+     */
84
+    @GetMapping("/account-details")
85
+    @Timed
86
+    public List<AccountDetails> getAllAccountDetails() {
87
+        log.debug("REST request to get all AccountDetails");
88
+        return accountDetailsRepository.findAll();
89
+    }
90
+
91
+    /**
92
+     * GET  /account-details/:id : get the "id" accountDetails.
93
+     *
94
+     * @param id the id of the accountDetails to retrieve
95
+     * @return the ResponseEntity with status 200 (OK) and with body the accountDetails, or with status 404 (Not Found)
96
+     */
97
+    @GetMapping("/account-details/{id}")
98
+    @Timed
99
+    public ResponseEntity<AccountDetails> getAccountDetails(@PathVariable Long id) {
100
+        log.debug("REST request to get AccountDetails : {}", id);
101
+        Optional<AccountDetails> accountDetails = accountDetailsRepository.findById(id);
102
+        return ResponseUtil.wrapOrNotFound(accountDetails);
103
+    }
104
+
105
+    /**
106
+     * DELETE  /account-details/:id : delete the "id" accountDetails.
107
+     *
108
+     * @param id the id of the accountDetails to delete
109
+     * @return the ResponseEntity with status 200 (OK)
110
+     */
111
+    @DeleteMapping("/account-details/{id}")
112
+    @Timed
113
+    public ResponseEntity<Void> deleteAccountDetails(@PathVariable Long id) {
114
+        log.debug("REST request to delete AccountDetails : {}", id);
115
+
116
+        accountDetailsRepository.deleteById(id);
117
+        return ResponseEntity.ok().headers(HeaderUtil.createEntityDeletionAlert(ENTITY_NAME, id.toString())).build();
118
+    }
119
+}

+ 0
- 189
src/main/java/rocks/zipcode/io/web/rest/AccountResource.java View File

1
-package rocks.zipcode.io.web.rest;
2
-
3
-import com.codahale.metrics.annotation.Timed;
4
-
5
-import rocks.zipcode.io.domain.User;
6
-import rocks.zipcode.io.repository.UserRepository;
7
-import rocks.zipcode.io.security.SecurityUtils;
8
-import rocks.zipcode.io.service.MailService;
9
-import rocks.zipcode.io.service.UserService;
10
-import rocks.zipcode.io.service.dto.PasswordChangeDTO;
11
-import rocks.zipcode.io.service.dto.UserDTO;
12
-import rocks.zipcode.io.web.rest.errors.*;
13
-import rocks.zipcode.io.web.rest.vm.KeyAndPasswordVM;
14
-import rocks.zipcode.io.web.rest.vm.ManagedUserVM;
15
-
16
-import org.apache.commons.lang3.StringUtils;
17
-import org.slf4j.Logger;
18
-import org.slf4j.LoggerFactory;
19
-import org.springframework.http.HttpStatus;
20
-import org.springframework.web.bind.annotation.*;
21
-
22
-import javax.servlet.http.HttpServletRequest;
23
-import javax.validation.Valid;
24
-import java.util.*;
25
-
26
-
27
-/**
28
- * REST controller for managing the current user's account.
29
- */
30
-@RestController
31
-@RequestMapping("/api")
32
-public class AccountResource {
33
-
34
-    private final Logger log = LoggerFactory.getLogger(AccountResource.class);
35
-
36
-    private final UserRepository userRepository;
37
-
38
-    private final UserService userService;
39
-
40
-    private final MailService mailService;
41
-
42
-    public AccountResource(UserRepository userRepository, UserService userService, MailService mailService) {
43
-
44
-        this.userRepository = userRepository;
45
-        this.userService = userService;
46
-        this.mailService = mailService;
47
-    }
48
-
49
-    /**
50
-     * POST  /register : register the user.
51
-     *
52
-     * @param managedUserVM the managed user View Model
53
-     * @throws InvalidPasswordException 400 (Bad Request) if the password is incorrect
54
-     * @throws EmailAlreadyUsedException 400 (Bad Request) if the email is already used
55
-     * @throws LoginAlreadyUsedException 400 (Bad Request) if the login is already used
56
-     */
57
-    @PostMapping("/register")
58
-    @Timed
59
-    @ResponseStatus(HttpStatus.CREATED)
60
-    public void registerAccount(@Valid @RequestBody ManagedUserVM managedUserVM) {
61
-        if (!checkPasswordLength(managedUserVM.getPassword())) {
62
-            throw new InvalidPasswordException();
63
-        }
64
-        User user = userService.registerUser(managedUserVM, managedUserVM.getPassword());
65
-        mailService.sendActivationEmail(user);
66
-    }
67
-
68
-    /**
69
-     * GET  /activate : activate the registered user.
70
-     *
71
-     * @param key the activation key
72
-     * @throws RuntimeException 500 (Internal Server Error) if the user couldn't be activated
73
-     */
74
-    @GetMapping("/activate")
75
-    @Timed
76
-    public void activateAccount(@RequestParam(value = "key") String key) {
77
-        Optional<User> user = userService.activateRegistration(key);
78
-        if (!user.isPresent()) {
79
-            throw new InternalServerErrorException("No user was found for this activation key");
80
-        }
81
-    }
82
-
83
-    /**
84
-     * GET  /authenticate : check if the user is authenticated, and return its login.
85
-     *
86
-     * @param request the HTTP request
87
-     * @return the login if the user is authenticated
88
-     */
89
-    @GetMapping("/authenticate")
90
-    @Timed
91
-    public String isAuthenticated(HttpServletRequest request) {
92
-        log.debug("REST request to check if the current user is authenticated");
93
-        return request.getRemoteUser();
94
-    }
95
-
96
-    /**
97
-     * GET  /account : get the current user.
98
-     *
99
-     * @return the current user
100
-     * @throws RuntimeException 500 (Internal Server Error) if the user couldn't be returned
101
-     */
102
-    @GetMapping("/account")
103
-    @Timed
104
-    public UserDTO getAccount() {
105
-        return userService.getUserWithAuthorities()
106
-            .map(UserDTO::new)
107
-            .orElseThrow(() -> new InternalServerErrorException("User could not be found"));
108
-    }
109
-
110
-    /**
111
-     * POST  /account : update the current user information.
112
-     *
113
-     * @param userDTO the current user information
114
-     * @throws EmailAlreadyUsedException 400 (Bad Request) if the email is already used
115
-     * @throws RuntimeException 500 (Internal Server Error) if the user login wasn't found
116
-     */
117
-    @PostMapping("/account")
118
-    @Timed
119
-    public void saveAccount(@Valid @RequestBody UserDTO userDTO) {
120
-        final String userLogin = SecurityUtils.getCurrentUserLogin().orElseThrow(() -> new InternalServerErrorException("Current user login not found"));
121
-        Optional<User> existingUser = userRepository.findOneByEmailIgnoreCase(userDTO.getEmail());
122
-        if (existingUser.isPresent() && (!existingUser.get().getLogin().equalsIgnoreCase(userLogin))) {
123
-            throw new EmailAlreadyUsedException();
124
-        }
125
-        Optional<User> user = userRepository.findOneByLogin(userLogin);
126
-        if (!user.isPresent()) {
127
-            throw new InternalServerErrorException("User could not be found");
128
-        }
129
-        userService.updateUser(userDTO.getFirstName(), userDTO.getLastName(), userDTO.getEmail(),
130
-            userDTO.getLangKey(), userDTO.getImageUrl());
131
-    }
132
-
133
-    /**
134
-     * POST  /account/change-password : changes the current user's password
135
-     *
136
-     * @param passwordChangeDto current and new password
137
-     * @throws InvalidPasswordException 400 (Bad Request) if the new password is incorrect
138
-     */
139
-    @PostMapping(path = "/account/change-password")
140
-    @Timed
141
-    public void changePassword(@RequestBody PasswordChangeDTO passwordChangeDto) {
142
-        if (!checkPasswordLength(passwordChangeDto.getNewPassword())) {
143
-            throw new InvalidPasswordException();
144
-        }
145
-        userService.changePassword(passwordChangeDto.getCurrentPassword(), passwordChangeDto.getNewPassword());
146
-    }
147
-
148
-    /**
149
-     * POST   /account/reset-password/init : Send an email to reset the password of the user
150
-     *
151
-     * @param mail the mail of the user
152
-     * @throws EmailNotFoundException 400 (Bad Request) if the email address is not registered
153
-     */
154
-    @PostMapping(path = "/account/reset-password/init")
155
-    @Timed
156
-    public void requestPasswordReset(@RequestBody String mail) {
157
-       mailService.sendPasswordResetMail(
158
-           userService.requestPasswordReset(mail)
159
-               .orElseThrow(EmailNotFoundException::new)
160
-       );
161
-    }
162
-
163
-    /**
164
-     * POST   /account/reset-password/finish : Finish to reset the password of the user
165
-     *
166
-     * @param keyAndPassword the generated key and the new password
167
-     * @throws InvalidPasswordException 400 (Bad Request) if the password is incorrect
168
-     * @throws RuntimeException 500 (Internal Server Error) if the password could not be reset
169
-     */
170
-    @PostMapping(path = "/account/reset-password/finish")
171
-    @Timed
172
-    public void finishPasswordReset(@RequestBody KeyAndPasswordVM keyAndPassword) {
173
-        if (!checkPasswordLength(keyAndPassword.getNewPassword())) {
174
-            throw new InvalidPasswordException();
175
-        }
176
-        Optional<User> user =
177
-            userService.completePasswordReset(keyAndPassword.getNewPassword(), keyAndPassword.getKey());
178
-
179
-        if (!user.isPresent()) {
180
-            throw new InternalServerErrorException("No user was found for this reset key");
181
-        }
182
-    }
183
-
184
-    private static boolean checkPasswordLength(String password) {
185
-        return !StringUtils.isEmpty(password) &&
186
-            password.length() >= ManagedUserVM.PASSWORD_MIN_LENGTH &&
187
-            password.length() <= ManagedUserVM.PASSWORD_MAX_LENGTH;
188
-    }
189
-}

+ 119
- 0
src/main/java/rocks/zipcode/io/web/rest/AlbumResource.java View File

1
+package rocks.zipcode.io.web.rest;
2
+
3
+import com.codahale.metrics.annotation.Timed;
4
+import rocks.zipcode.io.domain.Album;
5
+import rocks.zipcode.io.repository.AlbumRepository;
6
+import rocks.zipcode.io.web.rest.errors.BadRequestAlertException;
7
+import rocks.zipcode.io.web.rest.util.HeaderUtil;
8
+import io.github.jhipster.web.util.ResponseUtil;
9
+import org.slf4j.Logger;
10
+import org.slf4j.LoggerFactory;
11
+import org.springframework.http.ResponseEntity;
12
+import org.springframework.web.bind.annotation.*;
13
+
14
+import java.net.URI;
15
+import java.net.URISyntaxException;
16
+
17
+import java.util.List;
18
+import java.util.Optional;
19
+
20
+/**
21
+ * REST controller for managing Album.
22
+ */
23
+@RestController
24
+@RequestMapping("/api")
25
+public class AlbumResource {
26
+
27
+    private final Logger log = LoggerFactory.getLogger(AlbumResource.class);
28
+
29
+    private static final String ENTITY_NAME = "album";
30
+
31
+    private final AlbumRepository albumRepository;
32
+
33
+    public AlbumResource(AlbumRepository albumRepository) {
34
+        this.albumRepository = albumRepository;
35
+    }
36
+
37
+    /**
38
+     * POST  /albums : Create a new album.
39
+     *
40
+     * @param album the album to create
41
+     * @return the ResponseEntity with status 201 (Created) and with body the new album, or with status 400 (Bad Request) if the album has already an ID
42
+     * @throws URISyntaxException if the Location URI syntax is incorrect
43
+     */
44
+    @PostMapping("/albums")
45
+    @Timed
46
+    public ResponseEntity<Album> createAlbum(@RequestBody Album album) throws URISyntaxException {
47
+        log.debug("REST request to save Album : {}", album);
48
+        if (album.getId() != null) {
49
+            throw new BadRequestAlertException("A new album cannot already have an ID", ENTITY_NAME, "idexists");
50
+        }
51
+        Album result = albumRepository.save(album);
52
+        return ResponseEntity.created(new URI("/api/albums/" + result.getId()))
53
+            .headers(HeaderUtil.createEntityCreationAlert(ENTITY_NAME, result.getId().toString()))
54
+            .body(result);
55
+    }
56
+
57
+    /**
58
+     * PUT  /albums : Updates an existing album.
59
+     *
60
+     * @param album the album to update
61
+     * @return the ResponseEntity with status 200 (OK) and with body the updated album,
62
+     * or with status 400 (Bad Request) if the album is not valid,
63
+     * or with status 500 (Internal Server Error) if the album couldn't be updated
64
+     * @throws URISyntaxException if the Location URI syntax is incorrect
65
+     */
66
+    @PutMapping("/albums")
67
+    @Timed
68
+    public ResponseEntity<Album> updateAlbum(@RequestBody Album album) throws URISyntaxException {
69
+        log.debug("REST request to update Album : {}", album);
70
+        if (album.getId() == null) {
71
+            throw new BadRequestAlertException("Invalid id", ENTITY_NAME, "idnull");
72
+        }
73
+        Album result = albumRepository.save(album);
74
+        return ResponseEntity.ok()
75
+            .headers(HeaderUtil.createEntityUpdateAlert(ENTITY_NAME, album.getId().toString()))
76
+            .body(result);
77
+    }
78
+
79
+    /**
80
+     * GET  /albums : get all the albums.
81
+     *
82
+     * @return the ResponseEntity with status 200 (OK) and the list of albums in body
83
+     */
84
+    @GetMapping("/albums")
85
+    @Timed
86
+    public List<Album> getAllAlbums() {
87
+        log.debug("REST request to get all Albums");
88
+        return albumRepository.findAll();
89
+    }
90
+
91
+    /**
92
+     * GET  /albums/:id : get the "id" album.
93
+     *
94
+     * @param id the id of the album to retrieve
95
+     * @return the ResponseEntity with status 200 (OK) and with body the album, or with status 404 (Not Found)
96
+     */
97
+    @GetMapping("/albums/{id}")
98
+    @Timed
99
+    public ResponseEntity<Album> getAlbum(@PathVariable Long id) {
100
+        log.debug("REST request to get Album : {}", id);
101
+        Optional<Album> album = albumRepository.findById(id);
102
+        return ResponseUtil.wrapOrNotFound(album);
103
+    }
104
+
105
+    /**
106
+     * DELETE  /albums/:id : delete the "id" album.
107
+     *
108
+     * @param id the id of the album to delete
109
+     * @return the ResponseEntity with status 200 (OK)
110
+     */
111
+    @DeleteMapping("/albums/{id}")
112
+    @Timed
113
+    public ResponseEntity<Void> deleteAlbum(@PathVariable Long id) {
114
+        log.debug("REST request to delete Album : {}", id);
115
+
116
+        albumRepository.deleteById(id);
117
+        return ResponseEntity.ok().headers(HeaderUtil.createEntityDeletionAlert(ENTITY_NAME, id.toString())).build();
118
+    }
119
+}

+ 119
- 0
src/main/java/rocks/zipcode/io/web/rest/CommentResource.java View File

1
+package rocks.zipcode.io.web.rest;
2
+
3
+import com.codahale.metrics.annotation.Timed;
4
+import rocks.zipcode.io.domain.Comment;
5
+import rocks.zipcode.io.repository.CommentRepository;
6
+import rocks.zipcode.io.web.rest.errors.BadRequestAlertException;
7
+import rocks.zipcode.io.web.rest.util.HeaderUtil;
8
+import io.github.jhipster.web.util.ResponseUtil;
9
+import org.slf4j.Logger;
10
+import org.slf4j.LoggerFactory;
11
+import org.springframework.http.ResponseEntity;
12
+import org.springframework.web.bind.annotation.*;
13
+
14
+import java.net.URI;
15
+import java.net.URISyntaxException;
16
+
17
+import java.util.List;
18
+import java.util.Optional;
19
+
20
+/**
21
+ * REST controller for managing Comment.
22
+ */
23
+@RestController
24
+@RequestMapping("/api")
25
+public class CommentResource {
26
+
27
+    private final Logger log = LoggerFactory.getLogger(CommentResource.class);
28
+
29
+    private static final String ENTITY_NAME = "comment";
30
+
31
+    private final CommentRepository commentRepository;
32
+
33
+    public CommentResource(CommentRepository commentRepository) {
34
+        this.commentRepository = commentRepository;
35
+    }
36
+
37
+    /**
38
+     * POST  /comments : Create a new comment.
39
+     *
40
+     * @param comment the comment to create
41
+     * @return the ResponseEntity with status 201 (Created) and with body the new comment, or with status 400 (Bad Request) if the comment has already an ID
42
+     * @throws URISyntaxException if the Location URI syntax is incorrect
43
+     */
44
+    @PostMapping("/comments")
45
+    @Timed
46
+    public ResponseEntity<Comment> createComment(@RequestBody Comment comment) throws URISyntaxException {
47
+        log.debug("REST request to save Comment : {}", comment);
48
+        if (comment.getId() != null) {
49
+            throw new BadRequestAlertException("A new comment cannot already have an ID", ENTITY_NAME, "idexists");
50
+        }
51
+        Comment result = commentRepository.save(comment);
52
+        return ResponseEntity.created(new URI("/api/comments/" + result.getId()))
53
+            .headers(HeaderUtil.createEntityCreationAlert(ENTITY_NAME, result.getId().toString()))
54
+            .body(result);
55
+    }
56
+
57
+    /**
58
+     * PUT  /comments : Updates an existing comment.
59
+     *
60
+     * @param comment the comment to update
61
+     * @return the ResponseEntity with status 200 (OK) and with body the updated comment,
62
+     * or with status 400 (Bad Request) if the comment is not valid,
63
+     * or with status 500 (Internal Server Error) if the comment couldn't be updated
64
+     * @throws URISyntaxException if the Location URI syntax is incorrect
65
+     */
66
+    @PutMapping("/comments")
67
+    @Timed
68
+    public ResponseEntity<Comment> updateComment(@RequestBody Comment comment) throws URISyntaxException {
69
+        log.debug("REST request to update Comment : {}", comment);
70
+        if (comment.getId() == null) {
71
+            throw new BadRequestAlertException("Invalid id", ENTITY_NAME, "idnull");
72
+        }
73
+        Comment result = commentRepository.save(comment);
74
+        return ResponseEntity.ok()
75
+            .headers(HeaderUtil.createEntityUpdateAlert(ENTITY_NAME, comment.getId().toString()))
76
+            .body(result);
77
+    }
78
+
79
+    /**
80
+     * GET  /comments : get all the comments.
81
+     *
82
+     * @return the ResponseEntity with status 200 (OK) and the list of comments in body
83
+     */
84
+    @GetMapping("/comments")
85
+    @Timed
86
+    public List<Comment> getAllComments() {
87
+        log.debug("REST request to get all Comments");
88
+        return commentRepository.findAll();
89
+    }
90
+
91
+    /**
92
+     * GET  /comments/:id : get the "id" comment.
93
+     *
94
+     * @param id the id of the comment to retrieve
95
+     * @return the ResponseEntity with status 200 (OK) and with body the comment, or with status 404 (Not Found)
96
+     */
97
+    @GetMapping("/comments/{id}")
98
+    @Timed
99
+    public ResponseEntity<Comment> getComment(@PathVariable Long id) {
100
+        log.debug("REST request to get Comment : {}", id);
101
+        Optional<Comment> comment = commentRepository.findById(id);
102
+        return ResponseUtil.wrapOrNotFound(comment);
103
+    }
104
+
105
+    /**
106
+     * DELETE  /comments/:id : delete the "id" comment.
107
+     *
108
+     * @param id the id of the comment to delete
109
+     * @return the ResponseEntity with status 200 (OK)
110
+     */
111
+    @DeleteMapping("/comments/{id}")
112
+    @Timed
113
+    public ResponseEntity<Void> deleteComment(@PathVariable Long id) {
114
+        log.debug("REST request to delete Comment : {}", id);
115
+
116
+        commentRepository.deleteById(id);
117
+        return ResponseEntity.ok().headers(HeaderUtil.createEntityDeletionAlert(ENTITY_NAME, id.toString())).build();
118
+    }
119
+}

+ 119
- 0
src/main/java/rocks/zipcode/io/web/rest/FriendResource.java View File

1
+package rocks.zipcode.io.web.rest;
2
+
3
+import com.codahale.metrics.annotation.Timed;
4
+import rocks.zipcode.io.domain.Friend;
5
+import rocks.zipcode.io.repository.FriendRepository;
6
+import rocks.zipcode.io.web.rest.errors.BadRequestAlertException;
7
+import rocks.zipcode.io.web.rest.util.HeaderUtil;
8
+import io.github.jhipster.web.util.ResponseUtil;
9
+import org.slf4j.Logger;
10
+import org.slf4j.LoggerFactory;
11
+import org.springframework.http.ResponseEntity;
12
+import org.springframework.web.bind.annotation.*;
13
+
14
+import java.net.URI;
15
+import java.net.URISyntaxException;
16
+
17
+import java.util.List;
18
+import java.util.Optional;
19
+
20
+/**
21
+ * REST controller for managing Friend.
22
+ */
23
+@RestController
24
+@RequestMapping("/api")
25
+public class FriendResource {
26
+
27
+    private final Logger log = LoggerFactory.getLogger(FriendResource.class);
28
+
29
+    private static final String ENTITY_NAME = "friend";
30
+
31
+    private final FriendRepository friendRepository;
32
+
33
+    public FriendResource(FriendRepository friendRepository) {
34
+        this.friendRepository = friendRepository;
35
+    }
36
+
37
+    /**
38
+     * POST  /friends : Create a new friend.
39
+     *
40
+     * @param friend the friend to create
41
+     * @return the ResponseEntity with status 201 (Created) and with body the new friend, or with status 400 (Bad Request) if the friend has already an ID
42
+     * @throws URISyntaxException if the Location URI syntax is incorrect
43
+     */
44
+    @PostMapping("/friends")
45
+    @Timed
46
+    public ResponseEntity<Friend> createFriend(@RequestBody Friend friend) throws URISyntaxException {
47
+        log.debug("REST request to save Friend : {}", friend);
48
+        if (friend.getId() != null) {
49
+            throw new BadRequestAlertException("A new friend cannot already have an ID", ENTITY_NAME, "idexists");
50
+        }
51
+        Friend result = friendRepository.save(friend);
52
+        return ResponseEntity.created(new URI("/api/friends/" + result.getId()))
53
+            .headers(HeaderUtil.createEntityCreationAlert(ENTITY_NAME, result.getId().toString()))
54
+            .body(result);
55
+    }
56
+
57
+    /**
58
+     * PUT  /friends : Updates an existing friend.
59
+     *
60
+     * @param friend the friend to update
61
+     * @return the ResponseEntity with status 200 (OK) and with body the updated friend,
62
+     * or with status 400 (Bad Request) if the friend is not valid,
63
+     * or with status 500 (Internal Server Error) if the friend couldn't be updated
64
+     * @throws URISyntaxException if the Location URI syntax is incorrect
65
+     */
66
+    @PutMapping("/friends")
67
+    @Timed
68
+    public ResponseEntity<Friend> updateFriend(@RequestBody Friend friend) throws URISyntaxException {
69
+        log.debug("REST request to update Friend : {}", friend);
70
+        if (friend.getId() == null) {
71
+            throw new BadRequestAlertException("Invalid id", ENTITY_NAME, "idnull");
72
+        }
73
+        Friend result = friendRepository.save(friend);
74
+        return ResponseEntity.ok()
75
+            .headers(HeaderUtil.createEntityUpdateAlert(ENTITY_NAME, friend.getId().toString()))
76
+            .body(result);
77
+    }
78
+
79
+    /**
80
+     * GET  /friends : get all the friends.
81
+     *
82
+     * @return the ResponseEntity with status 200 (OK) and the list of friends in body
83
+     */
84
+    @GetMapping("/friends")
85
+    @Timed
86
+    public List<Friend> getAllFriends() {
87
+        log.debug("REST request to get all Friends");
88
+        return friendRepository.findAll();
89
+    }
90
+
91
+    /**
92
+     * GET  /friends/:id : get the "id" friend.
93
+     *
94
+     * @param id the id of the friend to retrieve
95
+     * @return the ResponseEntity with status 200 (OK) and with body the friend, or with status 404 (Not Found)
96
+     */
97
+    @GetMapping("/friends/{id}")
98
+    @Timed
99
+    public ResponseEntity<Friend> getFriend(@PathVariable Long id) {
100
+        log.debug("REST request to get Friend : {}", id);
101
+        Optional<Friend> friend = friendRepository.findById(id);
102
+        return ResponseUtil.wrapOrNotFound(friend);
103
+    }
104
+
105
+    /**
106
+     * DELETE  /friends/:id : delete the "id" friend.
107
+     *
108
+     * @param id the id of the friend to delete
109
+     * @return the ResponseEntity with status 200 (OK)
110
+     */
111
+    @DeleteMapping("/friends/{id}")
112
+    @Timed
113
+    public ResponseEntity<Void> deleteFriend(@PathVariable Long id) {
114
+        log.debug("REST request to delete Friend : {}", id);
115
+
116
+        friendRepository.deleteById(id);
117
+        return ResponseEntity.ok().headers(HeaderUtil.createEntityDeletionAlert(ENTITY_NAME, id.toString())).build();
118
+    }
119
+}

+ 120
- 0
src/main/java/rocks/zipcode/io/web/rest/PhotoResource.java View File

1
+package rocks.zipcode.io.web.rest;
2
+
3
+import com.codahale.metrics.annotation.Timed;
4
+import rocks.zipcode.io.domain.Photo;
5
+import rocks.zipcode.io.repository.PhotoRepository;
6
+import rocks.zipcode.io.web.rest.errors.BadRequestAlertException;
7
+import rocks.zipcode.io.web.rest.util.HeaderUtil;
8
+import io.github.jhipster.web.util.ResponseUtil;
9
+import org.slf4j.Logger;
10
+import org.slf4j.LoggerFactory;
11
+import org.springframework.http.ResponseEntity;
12
+import org.springframework.web.bind.annotation.*;
13
+
14
+import java.net.URI;
15
+import java.net.URISyntaxException;
16
+
17
+import java.util.List;
18
+import java.util.Optional;
19
+
20
+/**
21
+ * REST controller for managing Photo.
22
+ */
23
+@RestController
24
+@RequestMapping("/api")
25
+public class PhotoResource {
26
+
27
+    private final Logger log = LoggerFactory.getLogger(PhotoResource.class);
28
+
29
+    private static final String ENTITY_NAME = "photo";
30
+
31
+    private final PhotoRepository photoRepository;
32
+
33
+    public PhotoResource(PhotoRepository photoRepository) {
34
+        this.photoRepository = photoRepository;
35
+    }
36
+
37
+    /**
38
+     * POST  /photos : Create a new photo.
39
+     *
40
+     * @param photo the photo to create
41
+     * @return the ResponseEntity with status 201 (Created) and with body the new photo, or with status 400 (Bad Request) if the photo has already an ID
42
+     * @throws URISyntaxException if the Location URI syntax is incorrect
43
+     */
44
+    @PostMapping("/photos")
45
+    @Timed
46
+    public ResponseEntity<Photo> createPhoto(@RequestBody Photo photo) throws URISyntaxException {
47
+        log.debug("REST request to save Photo : {}", photo);
48
+        if (photo.getId() != null) {
49
+            throw new BadRequestAlertException("A new photo cannot already have an ID", ENTITY_NAME, "idexists");
50
+        }
51
+        Photo result = photoRepository.save(photo);
52
+        return ResponseEntity.created(new URI("/api/photos/" + result.getId()))
53
+            .headers(HeaderUtil.createEntityCreationAlert(ENTITY_NAME, result.getId().toString()))
54
+            .body(result);
55
+    }
56
+
57
+    /**
58
+     * PUT  /photos : Updates an existing photo.
59
+     *
60
+     * @param photo the photo to update
61
+     * @return the ResponseEntity with status 200 (OK) and with body the updated photo,
62
+     * or with status 400 (Bad Request) if the photo is not valid,
63
+     * or with status 500 (Internal Server Error) if the photo couldn't be updated
64
+     * @throws URISyntaxException if the Location URI syntax is incorrect
65
+     */
66
+    @PutMapping("/photos")
67
+    @Timed
68
+    public ResponseEntity<Photo> updatePhoto(@RequestBody Photo photo) throws URISyntaxException {
69
+        log.debug("REST request to update Photo : {}", photo);
70
+        if (photo.getId() == null) {
71
+            throw new BadRequestAlertException("Invalid id", ENTITY_NAME, "idnull");
72
+        }
73
+        Photo result = photoRepository.save(photo);
74
+        return ResponseEntity.ok()
75
+            .headers(HeaderUtil.createEntityUpdateAlert(ENTITY_NAME, photo.getId().toString()))
76
+            .body(result);
77
+    }
78
+
79
+    /**
80
+     * GET  /photos : get all the photos.
81
+     *
82
+     * @param eagerload flag to eager load entities from relationships (This is applicable for many-to-many)
83
+     * @return the ResponseEntity with status 200 (OK) and the list of photos in body
84
+     */
85
+    @GetMapping("/photos")
86
+    @Timed
87
+    public List<Photo> getAllPhotos(@RequestParam(required = false, defaultValue = "false") boolean eagerload) {
88
+        log.debug("REST request to get all Photos");
89
+        return photoRepository.findAllWithEagerRelationships();
90
+    }
91
+
92
+    /**
93
+     * GET  /photos/:id : get the "id" photo.
94
+     *
95
+     * @param id the id of the photo to retrieve
96
+     * @return the ResponseEntity with status 200 (OK) and with body the photo, or with status 404 (Not Found)
97
+     */
98
+    @GetMapping("/photos/{id}")
99
+    @Timed
100
+    public ResponseEntity<Photo> getPhoto(@PathVariable Long id) {
101
+        log.debug("REST request to get Photo : {}", id);
102
+        Optional<Photo> photo = photoRepository.findOneWithEagerRelationships(id);
103
+        return ResponseUtil.wrapOrNotFound(photo);
104
+    }
105
+
106
+    /**
107
+     * DELETE  /photos/:id : delete the "id" photo.
108
+     *
109
+     * @param id the id of the photo to delete
110
+     * @return the ResponseEntity with status 200 (OK)
111
+     */
112
+    @DeleteMapping("/photos/{id}")
113
+    @Timed
114
+    public ResponseEntity<Void> deletePhoto(@PathVariable Long id) {
115
+        log.debug("REST request to delete Photo : {}", id);
116
+
117
+        photoRepository.deleteById(id);
118
+        return ResponseEntity.ok().headers(HeaderUtil.createEntityDeletionAlert(ENTITY_NAME, id.toString())).build();
119
+    }
120
+}

+ 124
- 0
src/main/java/rocks/zipcode/io/web/rest/PostResource.java View File

1
+package rocks.zipcode.io.web.rest;
2
+
3
+import com.codahale.metrics.annotation.Timed;
4
+import rocks.zipcode.io.domain.Post;
5
+import rocks.zipcode.io.repository.PostRepository;
6
+import rocks.zipcode.io.repository.UserRepository;
7
+import rocks.zipcode.io.web.rest.errors.BadRequestAlertException;
8
+import rocks.zipcode.io.web.rest.util.HeaderUtil;
9
+import io.github.jhipster.web.util.ResponseUtil;
10
+import org.slf4j.Logger;
11
+import org.slf4j.LoggerFactory;
12
+import org.springframework.http.ResponseEntity;
13
+import org.springframework.web.bind.annotation.*;
14
+
15
+import java.net.URI;
16
+import java.net.URISyntaxException;
17
+
18
+import java.util.List;
19
+import java.util.Optional;
20
+
21
+/**
22
+ * REST controller for managing Post.
23
+ */
24
+@RestController
25
+@RequestMapping("/api")
26
+public class PostResource {
27
+
28
+    private final Logger log = LoggerFactory.getLogger(PostResource.class);
29
+
30
+    private static final String ENTITY_NAME = "post";
31
+
32
+    private final PostRepository postRepository;
33
+
34
+    private final UserRepository userRepository;
35
+
36
+    public PostResource(PostRepository postRepository, UserRepository userRepository) {
37
+        this.postRepository = postRepository;
38
+        this.userRepository = userRepository;
39
+    }
40
+
41
+    /**
42
+     * POST  /posts : Create a new post.
43
+     *
44
+     * @param post the post to create
45
+     * @return the ResponseEntity with status 201 (Created) and with body the new post, or with status 400 (Bad Request) if the post has already an ID
46
+     * @throws URISyntaxException if the Location URI syntax is incorrect
47
+     */
48
+    @PostMapping("/posts")
49
+    @Timed
50
+    public ResponseEntity<Post> createPost(@RequestBody Post post) throws URISyntaxException {
51
+        post.setOwner(userRepository.findOneByCurrentUser().get());
52
+        log.debug("REST request to save Post : {}", post);
53
+        if (post.getId() != null) {
54
+            throw new BadRequestAlertException("A new post cannot already have an ID", ENTITY_NAME, "idexists");
55
+        }
56
+        Post result = postRepository.save(post);
57
+        return ResponseEntity.created(new URI("/api/posts/" + result.getId()))
58
+            .headers(HeaderUtil.createEntityCreationAlert(ENTITY_NAME, result.getId().toString()))
59
+            .body(result);
60
+    }
61
+
62
+    /**
63
+     * PUT  /posts : Updates an existing post.
64
+     *
65
+     * @param post the post to update
66
+     * @return the ResponseEntity with status 200 (OK) and with body the updated post,
67
+     * or with status 400 (Bad Request) if the post is not valid,
68
+     * or with status 500 (Internal Server Error) if the post couldn't be updated
69
+     * @throws URISyntaxException if the Location URI syntax is incorrect
70
+     */
71
+    @PutMapping("/posts")
72
+    @Timed
73
+    public ResponseEntity<Post> updatePost(@RequestBody Post post) throws URISyntaxException {
74
+        log.debug("REST request to update Post : {}", post);
75
+        if (post.getId() == null) {
76
+            throw new BadRequestAlertException("Invalid id", ENTITY_NAME, "idnull");
77
+        }
78
+        Post result = postRepository.save(post);
79
+        return ResponseEntity.ok()
80
+            .headers(HeaderUtil.createEntityUpdateAlert(ENTITY_NAME, post.getId().toString()))
81
+            .body(result);
82
+    }
83
+
84
+    /**
85
+     * GET  /posts : get all the posts.
86
+     *
87
+     * @return the ResponseEntity with status 200 (OK) and the list of posts in body
88
+     */
89
+    @GetMapping("/posts")
90
+    @Timed
91
+    public List<Post> getAllPosts() {
92
+        log.debug("REST request to get all Posts");
93
+        return postRepository.findByOwnerIsCurrentUser();
94
+    }
95
+
96
+    /**
97
+     * GET  /posts/:id : get the "id" post.
98
+     *
99
+     * @param id the id of the post to retrieve
100
+     * @return the ResponseEntity with status 200 (OK) and with body the post, or with status 404 (Not Found)
101
+     */
102
+    @GetMapping("/posts/{id}")
103
+    @Timed
104
+    public ResponseEntity<Post> getPost(@PathVariable Long id) {
105
+        log.debug("REST request to get Post : {}", id);
106
+        Optional<Post> post = postRepository.findById(id);
107
+        return ResponseUtil.wrapOrNotFound(post);
108
+    }
109
+
110
+    /**
111
+     * DELETE  /posts/:id : delete the "id" post.
112
+     *
113
+     * @param id the id of the post to delete
114
+     * @return the ResponseEntity with status 200 (OK)
115
+     */
116
+    @DeleteMapping("/posts/{id}")
117
+    @Timed
118
+    public ResponseEntity<Void> deletePost(@PathVariable Long id) {
119
+        log.debug("REST request to delete Post : {}", id);
120
+
121
+        postRepository.deleteById(id);
122
+        return ResponseEntity.ok().headers(HeaderUtil.createEntityDeletionAlert(ENTITY_NAME, id.toString())).build();
123
+    }
124
+}

+ 119
- 0
src/main/java/rocks/zipcode/io/web/rest/ProfileResource.java View File

1
+package rocks.zipcode.io.web.rest;
2
+
3
+import com.codahale.metrics.annotation.Timed;
4
+import rocks.zipcode.io.domain.Profile;
5
+import rocks.zipcode.io.repository.ProfileRepository;
6
+import rocks.zipcode.io.web.rest.errors.BadRequestAlertException;
7
+import rocks.zipcode.io.web.rest.util.HeaderUtil;
8
+import io.github.jhipster.web.util.ResponseUtil;
9
+import org.slf4j.Logger;
10
+import org.slf4j.LoggerFactory;
11
+import org.springframework.http.ResponseEntity;
12
+import org.springframework.web.bind.annotation.*;
13
+
14
+import java.net.URI;
15
+import java.net.URISyntaxException;
16
+
17
+import java.util.List;
18
+import java.util.Optional;
19
+
20
+/**
21
+ * REST controller for managing Profile.
22
+ */
23
+@RestController
24
+@RequestMapping("/api")
25
+public class ProfileResource {
26
+
27
+    private final Logger log = LoggerFactory.getLogger(ProfileResource.class);
28
+
29
+    private static final String ENTITY_NAME = "profile";
30
+
31
+    private final ProfileRepository profileRepository;
32
+
33
+    public ProfileResource(ProfileRepository profileRepository) {
34
+        this.profileRepository = profileRepository;
35
+    }
36
+
37
+    /**
38
+     * POST  /profiles : Create a new profile.
39
+     *
40
+     * @param profile the profile to create
41
+     * @return the ResponseEntity with status 201 (Created) and with body the new profile, or with status 400 (Bad Request) if the profile has already an ID
42
+     * @throws URISyntaxException if the Location URI syntax is incorrect
43
+     */
44
+    @PostMapping("/profiles")
45
+    @Timed
46
+    public ResponseEntity<Profile> createProfile(@RequestBody Profile profile) throws URISyntaxException {
47
+        log.debug("REST request to save Profile : {}", profile);
48
+        if (profile.getId() != null) {
49
+            throw new BadRequestAlertException("A new profile cannot already have an ID", ENTITY_NAME, "idexists");
50
+        }
51
+        Profile result = profileRepository.save(profile);
52
+        return ResponseEntity.created(new URI("/api/profiles/" + result.getId()))
53
+            .headers(HeaderUtil.createEntityCreationAlert(ENTITY_NAME, result.getId().toString()))
54
+            .body(result);
55
+    }
56
+
57
+    /**
58
+     * PUT  /profiles : Updates an existing profile.
59
+     *
60
+     * @param profile the profile to update
61
+     * @return the ResponseEntity with status 200 (OK) and with body the updated profile,
62
+     * or with status 400 (Bad Request) if the profile is not valid,
63
+     * or with status 500 (Internal Server Error) if the profile couldn't be updated
64
+     * @throws URISyntaxException if the Location URI syntax is incorrect
65
+     */
66
+    @PutMapping("/profiles")
67
+    @Timed
68
+    public ResponseEntity<Profile> updateProfile(@RequestBody Profile profile) throws URISyntaxException {
69
+        log.debug("REST request to update Profile : {}", profile);
70
+        if (profile.getId() == null) {
71
+            throw new BadRequestAlertException("Invalid id", ENTITY_NAME, "idnull");
72
+        }
73
+        Profile result = profileRepository.save(profile);
74
+        return ResponseEntity.ok()
75
+            .headers(HeaderUtil.createEntityUpdateAlert(ENTITY_NAME, profile.getId().toString()))
76
+            .body(result);
77
+    }
78
+
79
+    /**
80
+     * GET  /profiles : get all the profiles.
81
+     *
82
+     * @return the ResponseEntity with status 200 (OK) and the list of profiles in body
83
+     */
84
+    @GetMapping("/profiles")
85
+    @Timed
86
+    public List<Profile> getAllProfiles() {
87
+        log.debug("REST request to get all Profiles");
88
+        return profileRepository.findAll();
89
+    }
90
+
91
+    /**
92
+     * GET  /profiles/:id : get the "id" profile.
93
+     *
94
+     * @param id the id of the profile to retrieve
95
+     * @return the ResponseEntity with status 200 (OK) and with body the profile, or with status 404 (Not Found)
96
+     */
97
+    @GetMapping("/profiles/{id}")
98
+    @Timed
99
+    public ResponseEntity<Profile> getProfile(@PathVariable Long id) {
100
+        log.debug("REST request to get Profile : {}", id);
101
+        Optional<Profile> profile = profileRepository.findById(id);
102
+        return ResponseUtil.wrapOrNotFound(profile);
103
+    }
104
+
105
+    /**
106
+     * DELETE  /profiles/:id : delete the "id" profile.
107
+     *
108
+     * @param id the id of the profile to delete
109
+     * @return the ResponseEntity with status 200 (OK)
110
+     */
111
+    @DeleteMapping("/profiles/{id}")
112
+    @Timed
113
+    public ResponseEntity<Void> deleteProfile(@PathVariable Long id) {
114
+        log.debug("REST request to delete Profile : {}", id);
115
+
116
+        profileRepository.deleteById(id);
117
+        return ResponseEntity.ok().headers(HeaderUtil.createEntityDeletionAlert(ENTITY_NAME, id.toString())).build();
118
+    }
119
+}

+ 3
- 0
src/main/java/rocks/zipcode/io/web/rest/UserResource.java View File

1
 package rocks.zipcode.io.web.rest;
1
 package rocks.zipcode.io.web.rest;
2
 
2
 
3
 import rocks.zipcode.io.config.Constants;
3
 import rocks.zipcode.io.config.Constants;
4
+import rocks.zipcode.io.domain.Profile;
4
 import rocks.zipcode.io.domain.User;
5
 import rocks.zipcode.io.domain.User;
6
+import rocks.zipcode.io.repository.ProfileRepository;
5
 import rocks.zipcode.io.repository.UserRepository;
7
 import rocks.zipcode.io.repository.UserRepository;
6
 import rocks.zipcode.io.security.AuthoritiesConstants;
8
 import rocks.zipcode.io.security.AuthoritiesConstants;
7
 import rocks.zipcode.io.service.MailService;
9
 import rocks.zipcode.io.service.MailService;
100
             throw new EmailAlreadyUsedException();
102
             throw new EmailAlreadyUsedException();
101
         } else {
103
         } else {
102
             User newUser = userService.createUser(userDTO);
104
             User newUser = userService.createUser(userDTO);
105
+
103
             mailService.sendCreationEmail(newUser);
106
             mailService.sendCreationEmail(newUser);
104
             return ResponseEntity.created(new URI("/api/users/" + newUser.getLogin()))
107
             return ResponseEntity.created(new URI("/api/users/" + newUser.getLogin()))
105
                 .headers(HeaderUtil.createAlert( "userManagement.created", newUser.getLogin()))
108
                 .headers(HeaderUtil.createAlert( "userManagement.created", newUser.getLogin()))

+ 119
- 0
src/main/java/rocks/zipcode/io/web/rest/VideoResource.java View File

1
+package rocks.zipcode.io.web.rest;
2
+
3
+import com.codahale.metrics.annotation.Timed;
4
+import rocks.zipcode.io.domain.Video;
5
+import rocks.zipcode.io.repository.VideoRepository;
6
+import rocks.zipcode.io.web.rest.errors.BadRequestAlertException;
7
+import rocks.zipcode.io.web.rest.util.HeaderUtil;
8
+import io.github.jhipster.web.util.ResponseUtil;
9
+import org.slf4j.Logger;
10
+import org.slf4j.LoggerFactory;
11
+import org.springframework.http.ResponseEntity;
12
+import org.springframework.web.bind.annotation.*;
13
+
14
+import java.net.URI;
15
+import java.net.URISyntaxException;
16
+
17
+import java.util.List;
18
+import java.util.Optional;
19
+
20
+/**
21
+ * REST controller for managing Video.
22
+ */
23
+@RestController
24
+@RequestMapping("/api")
25
+public class VideoResource {
26
+
27
+    private final Logger log = LoggerFactory.getLogger(VideoResource.class);
28
+
29
+    private static final String ENTITY_NAME = "video";
30
+
31
+    private final VideoRepository videoRepository;
32
+
33
+    public VideoResource(VideoRepository videoRepository) {
34
+        this.videoRepository = videoRepository;
35
+    }
36
+
37
+    /**
38
+     * POST  /videos : Create a new video.
39
+     *
40
+     * @param video the video to create
41
+     * @return the ResponseEntity with status 201 (Created) and with body the new video, or with status 400 (Bad Request) if the video has already an ID
42
+     * @throws URISyntaxException if the Location URI syntax is incorrect
43
+     */
44
+    @PostMapping("/videos")
45
+    @Timed
46
+    public ResponseEntity<Video> createVideo(@RequestBody Video video) throws URISyntaxException {
47
+        log.debug("REST request to save Video : {}", video);
48
+        if (video.getId() != null) {
49
+            throw new BadRequestAlertException("A new video cannot already have an ID", ENTITY_NAME, "idexists");
50
+        }
51
+        Video result = videoRepository.save(video);
52
+        return ResponseEntity.created(new URI("/api/videos/" + result.getId()))
53
+            .headers(HeaderUtil.createEntityCreationAlert(ENTITY_NAME, result.getId().toString()))
54
+            .body(result);
55
+    }
56
+
57
+    /**
58
+     * PUT  /videos : Updates an existing video.
59
+     *
60
+     * @param video the video to update
61
+     * @return the ResponseEntity with status 200 (OK) and with body the updated video,
62
+     * or with status 400 (Bad Request) if the video is not valid,
63
+     * or with status 500 (Internal Server Error) if the video couldn't be updated
64
+     * @throws URISyntaxException if the Location URI syntax is incorrect
65
+     */
66
+    @PutMapping("/videos")
67
+    @Timed
68
+    public ResponseEntity<Video> updateVideo(@RequestBody Video video) throws URISyntaxException {
69
+        log.debug("REST request to update Video : {}", video);
70
+        if (video.getId() == null) {
71
+            throw new BadRequestAlertException("Invalid id", ENTITY_NAME, "idnull");
72
+        }
73
+        Video result = videoRepository.save(video);
74
+        return ResponseEntity.ok()
75
+            .headers(HeaderUtil.createEntityUpdateAlert(ENTITY_NAME, video.getId().toString()))
76
+            .body(result);
77
+    }
78
+
79
+    /**
80
+     * GET  /videos : get all the videos.
81
+     *
82
+     * @return the ResponseEntity with status 200 (OK) and the list of videos in body
83
+     */
84
+    @GetMapping("/videos")
85
+    @Timed
86
+    public List<Video> getAllVideos() {
87
+        log.debug("REST request to get all Videos");
88
+        return videoRepository.findAll();
89
+    }
90
+
91
+    /**
92
+     * GET  /videos/:id : get the "id" video.
93
+     *
94
+     * @param id the id of the video to retrieve
95
+     * @return the ResponseEntity with status 200 (OK) and with body the video, or with status 404 (Not Found)
96
+     */
97
+    @GetMapping("/videos/{id}")
98
+    @Timed
99
+    public ResponseEntity<Video> getVideo(@PathVariable Long id) {
100
+        log.debug("REST request to get Video : {}", id);
101
+        Optional<Video> video = videoRepository.findById(id);
102
+        return ResponseUtil.wrapOrNotFound(video);
103
+    }
104
+
105
+    /**
106
+     * DELETE  /videos/:id : delete the "id" video.
107
+     *
108
+     * @param id the id of the video to delete
109
+     * @return the ResponseEntity with status 200 (OK)
110
+     */
111
+    @DeleteMapping("/videos/{id}")
112
+    @Timed
113
+    public ResponseEntity<Void> deleteVideo(@PathVariable Long id) {
114
+        log.debug("REST request to delete Video : {}", id);
115
+
116
+        videoRepository.deleteById(id);
117
+        return ResponseEntity.ok().headers(HeaderUtil.createEntityDeletionAlert(ENTITY_NAME, id.toString())).build();
118
+    }
119
+}

+ 1
- 0
src/main/resources/.h2.server.properties View File

1
 #H2 Server Properties
1
 #H2 Server Properties
2
+#Wed Jan 09 09:38:54 EST 2019
2
 0=JHipster H2 (Memory)|org.h2.Driver|jdbc\:h2\:mem\:faeboo|FaeBoo
3
 0=JHipster H2 (Memory)|org.h2.Driver|jdbc\:h2\:mem\:faeboo|FaeBoo
3
 webAllowOthers=true
4
 webAllowOthers=true
4
 webPort=8082
5
 webPort=8082

+ 9
- 4
src/main/resources/config/application-dev.yml View File

69
     liquibase:
69
     liquibase:
70
         contexts: dev
70
         contexts: dev
71
     mail:
71
     mail:
72
-        host: localhost
73
-        port: 25
74
-        username:
75
-        password:
72
+        host: smtp.gmail.com
73
+        port: 587
74
+        username: faebooreg@gmail.com
75
+        password: FaeBooBuzzK1ll!
76
+        protocol: smtp
77
+        properties.mail.smtp:
78
+            auth: true
79
+            starttls.enable: true
80
+            ssl.trust: smtp.gmail.com
76
     messages:
81
     messages:
77
         cache-duration: PT1S # 1 second, see the ISO 8601 standard
82
         cache-duration: PT1S # 1 second, see the ISO 8601 standard
78
     thymeleaf:
83
     thymeleaf:

+ 43
- 0
src/main/resources/config/liquibase/changelog/20190102220056_added_entity_AccountDetails.xml View File

1
+<?xml version="1.0" encoding="utf-8"?>
2
+<databaseChangeLog
3
+    xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
4
+    xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
5
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
6
+    xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd
7
+                        http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">
8
+
9
+    <property name="now" value="now()" dbms="h2"/>
10
+
11
+    <property name="now" value="current_timestamp" dbms="postgresql"/>
12
+
13
+    <property name="floatType" value="float4" dbms="postgresql, h2"/>
14
+    <property name="floatType" value="float" dbms="mysql, oracle, mssql"/>
15
+
16
+    <!--
17
+        Added the entity AccountDetails.
18
+    -->
19
+    <changeSet id="20190102220056-1" author="jhipster">
20
+        <createTable tableName="account_details">
21
+            <column name="id" type="bigint" autoIncrement="${autoIncrement}">
22
+                <constraints primaryKey="true" nullable="false"/>
23
+            </column>
24
+            <column name="security_question" type="varchar(255)">
25
+                <constraints nullable="true" />
26
+            </column>
27
+
28
+            <column name="security_answer" type="varchar(255)">
29
+                <constraints nullable="true" />
30
+            </column>
31
+
32
+            <column name="phone_number" type="varchar(255)">
33
+                <constraints nullable="true" />
34
+            </column>
35
+            <column name="user_account_id" type="bigint">
36
+                <constraints unique="true" nullable="true" uniqueConstraintName="ux_account_details_user_account_id" />
37
+            </column>
38
+            <!-- jhipster-needle-liquibase-add-column - JHipster will add columns here, do not remove-->
39
+        </createTable>
40
+        
41
+    </changeSet>
42
+    <!-- jhipster-needle-liquibase-add-changeset - JHipster will add changesets here, do not remove-->
43
+</databaseChangeLog>

+ 18
- 0
src/main/resources/config/liquibase/changelog/20190102220056_added_entity_constraints_AccountDetails.xml View File

1
+<?xml version="1.0" encoding="utf-8"?>
2
+<databaseChangeLog
3
+    xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
4
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5
+    xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd">
6
+    <!--
7
+        Added the constraints for entity AccountDetails.
8
+    -->
9
+    <changeSet id="20190102220056-2" author="jhipster">
10
+        
11
+        <addForeignKeyConstraint baseColumnNames="user_account_id"
12
+                                 baseTableName="account_details"
13
+                                 constraintName="fk_account_details_user_account_id"
14
+                                 referencedColumnNames="id"
15
+                                 referencedTableName="jhi_user"/>
16
+
17
+    </changeSet>
18
+</databaseChangeLog>

+ 39
- 0
src/main/resources/config/liquibase/changelog/20190102220057_added_entity_Profile.xml View File

1
+<?xml version="1.0" encoding="utf-8"?>
2
+<databaseChangeLog
3
+    xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
4
+    xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
5
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
6
+    xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd
7
+                        http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">
8
+
9
+    <property name="now" value="now()" dbms="h2"/>
10
+
11
+    <property name="now" value="current_timestamp" dbms="postgresql"/>
12
+
13
+    <property name="floatType" value="float4" dbms="postgresql, h2"/>
14
+    <property name="floatType" value="float" dbms="mysql, oracle, mssql"/>
15
+
16
+    <!--
17
+        Added the entity Profile.
18
+    -->
19
+    <changeSet id="20190102220057-1" author="jhipster">
20
+        <createTable tableName="profile">
21
+            <column name="id" type="bigint" autoIncrement="${autoIncrement}">
22
+                <constraints primaryKey="true" nullable="false"/>
23
+            </column>
24
+            <column name="bio" type="varchar(255)">
25
+                <constraints nullable="true" />
26
+            </column>
27
+
28
+            <column name="jhi_accessible" type="boolean">
29
+                <constraints nullable="true" />
30
+            </column>
31
+            <column name="user_profile_id" type="bigint">
32
+                <constraints unique="true" nullable="true" uniqueConstraintName="ux_profile_user_profile_id" />
33
+            </column>
34
+            <!-- jhipster-needle-liquibase-add-column - JHipster will add columns here, do not remove-->
35
+        </createTable>
36
+        
37
+    </changeSet>
38
+    <!-- jhipster-needle-liquibase-add-changeset - JHipster will add changesets here, do not remove-->
39
+</databaseChangeLog>

+ 18
- 0
src/main/resources/config/liquibase/changelog/20190102220057_added_entity_constraints_Profile.xml View File

1
+<?xml version="1.0" encoding="utf-8"?>
2
+<databaseChangeLog
3
+    xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
4
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5
+    xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd">
6
+    <!--
7
+        Added the constraints for entity Profile.
8
+    -->
9
+    <changeSet id="20190102220057-2" author="jhipster">
10
+        
11
+        <addForeignKeyConstraint baseColumnNames="user_profile_id"
12
+                                 baseTableName="profile"
13
+                                 constraintName="fk_profile_user_profile_id"
14
+                                 referencedColumnNames="id"
15
+                                 referencedTableName="jhi_user"/>
16
+
17
+    </changeSet>
18
+</databaseChangeLog>

+ 41
- 0
src/main/resources/config/liquibase/changelog/20190102220058_added_entity_Friend.xml View File

1
+<?xml version="1.0" encoding="utf-8"?>
2
+<databaseChangeLog
3
+    xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
4
+    xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
5
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
6
+    xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd
7
+                        http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">
8
+
9
+    <property name="now" value="now()" dbms="h2"/>
10
+
11
+    <property name="now" value="current_timestamp" dbms="postgresql"/>
12
+
13
+    <property name="floatType" value="float4" dbms="postgresql, h2"/>
14
+    <property name="floatType" value="float" dbms="mysql, oracle, mssql"/>
15
+
16
+    <!--
17
+        Added the entity Friend.
18
+    -->
19
+    <changeSet id="20190102220058-1" author="jhipster">
20
+        <createTable tableName="friend">
21
+            <column name="id" type="bigint" autoIncrement="${autoIncrement}">
22
+                <constraints primaryKey="true" nullable="false"/>
23
+            </column>
24
+            <column name="top_friend" type="boolean">
25
+                <constraints nullable="true" />
26
+            </column>
27
+
28
+            <column name="user_id" type="bigint">
29
+                <constraints nullable="true" />
30
+            </column>
31
+
32
+            <column name="friend_id" type="bigint">
33
+                <constraints nullable="true" />
34
+            </column>
35
+
36
+            <!-- jhipster-needle-liquibase-add-column - JHipster will add columns here, do not remove-->
37
+        </createTable>
38
+        
39
+    </changeSet>
40
+    <!-- jhipster-needle-liquibase-add-changeset - JHipster will add changesets here, do not remove-->
41
+</databaseChangeLog>

+ 24
- 0
src/main/resources/config/liquibase/changelog/20190102220058_added_entity_constraints_Friend.xml View File

1
+<?xml version="1.0" encoding="utf-8"?>
2
+<databaseChangeLog
3
+    xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
4
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5
+    xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd">
6
+    <!--
7
+        Added the constraints for entity Friend.
8
+    -->
9
+    <changeSet id="20190102220058-2" author="jhipster">
10
+        
11
+        <addForeignKeyConstraint baseColumnNames="user_id"
12
+                                 baseTableName="friend"
13
+                                 constraintName="fk_friend_user_id"
14
+                                 referencedColumnNames="id"
15
+                                 referencedTableName="jhi_user"/>
16
+
17
+        <addForeignKeyConstraint baseColumnNames="friend_id"
18
+                                 baseTableName="friend"
19
+                                 constraintName="fk_friend_friend_id"
20
+                                 referencedColumnNames="id"
21
+                                 referencedTableName="jhi_user"/>
22
+
23
+    </changeSet>
24
+</databaseChangeLog>

+ 41
- 0
src/main/resources/config/liquibase/changelog/20190102220059_added_entity_Album.xml View File

1
+<?xml version="1.0" encoding="utf-8"?>
2
+<databaseChangeLog
3
+    xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
4
+    xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
5
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
6
+    xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd
7
+                        http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">
8
+
9
+    <property name="now" value="now()" dbms="h2"/>
10
+
11
+    <property name="now" value="current_timestamp" dbms="postgresql"/>
12
+
13
+    <property name="floatType" value="float4" dbms="postgresql, h2"/>
14
+    <property name="floatType" value="float" dbms="mysql, oracle, mssql"/>
15
+
16
+    <!--
17
+        Added the entity Album.
18
+    -->
19
+    <changeSet id="20190102220059-1" author="jhipster">
20
+        <createTable tableName="album">
21
+            <column name="id" type="bigint" autoIncrement="${autoIncrement}">
22
+                <constraints primaryKey="true" nullable="false"/>
23
+            </column>
24
+            <column name="name" type="varchar(255)">
25
+                <constraints nullable="true" />
26
+            </column>
27
+
28
+            <column name="description" type="varchar(255)">
29
+                <constraints nullable="true" />
30
+            </column>
31
+
32
+            <column name="owner_id" type="bigint">
33
+                <constraints nullable="true" />
34
+            </column>
35
+
36
+            <!-- jhipster-needle-liquibase-add-column - JHipster will add columns here, do not remove-->
37
+        </createTable>
38
+        
39
+    </changeSet>
40
+    <!-- jhipster-needle-liquibase-add-changeset - JHipster will add changesets here, do not remove-->
41
+</databaseChangeLog>

+ 18
- 0
src/main/resources/config/liquibase/changelog/20190102220059_added_entity_constraints_Album.xml View File

1
+<?xml version="1.0" encoding="utf-8"?>
2
+<databaseChangeLog
3
+    xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
4
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5
+    xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd">
6
+    <!--
7
+        Added the constraints for entity Album.
8
+    -->
9
+    <changeSet id="20190102220059-2" author="jhipster">
10
+        
11
+        <addForeignKeyConstraint baseColumnNames="owner_id"
12
+                                 baseTableName="album"
13
+                                 constraintName="fk_album_owner_id"
14
+                                 referencedColumnNames="id"
15
+                                 referencedTableName="jhi_user"/>
16
+
17
+    </changeSet>
18
+</databaseChangeLog>

+ 52
- 0
src/main/resources/config/liquibase/changelog/20190102220100_added_entity_Photo.xml View File

1
+<?xml version="1.0" encoding="utf-8"?>
2
+<databaseChangeLog
3
+    xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
4
+    xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
5
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
6
+    xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd
7
+                        http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">
8
+
9
+    <property name="now" value="now()" dbms="h2"/>
10
+
11
+    <property name="now" value="current_timestamp" dbms="postgresql"/>
12
+
13
+    <property name="floatType" value="float4" dbms="postgresql, h2"/>
14
+    <property name="floatType" value="float" dbms="mysql, oracle, mssql"/>
15
+
16
+    <!--
17
+        Added the entity Photo.
18
+    -->
19
+    <changeSet id="20190102220100-1" author="jhipster">
20
+        <createTable tableName="photo">
21
+            <column name="id" type="bigint" autoIncrement="${autoIncrement}">
22
+                <constraints primaryKey="true" nullable="false"/>
23
+            </column>
24
+            <column name="image_url" type="varchar(255)">
25
+                <constraints nullable="true" />
26
+            </column>
27
+
28
+            <column name="jhi_size" type="bigint">
29
+                <constraints nullable="true" />
30
+            </column>
31
+
32
+            <column name="post_id" type="bigint">
33
+                <constraints nullable="true" />
34
+            </column>
35
+
36
+            <!-- jhipster-needle-liquibase-add-column - JHipster will add columns here, do not remove-->
37
+        </createTable>
38
+        
39
+        <createTable tableName="photo_album">
40
+            <column name="albums_id" type="bigint">
41
+                <constraints nullable="false"/>
42
+            </column>
43
+            <column name="photos_id" type="bigint">
44
+                <constraints nullable="false"/>
45
+            </column>
46
+        </createTable>
47
+
48
+        <addPrimaryKey columnNames="photos_id, albums_id" tableName="photo_album"/>
49
+        
50
+    </changeSet>
51
+    <!-- jhipster-needle-liquibase-add-changeset - JHipster will add changesets here, do not remove-->
52
+</databaseChangeLog>

+ 29
- 0
src/main/resources/config/liquibase/changelog/20190102220100_added_entity_constraints_Photo.xml View File

1
+<?xml version="1.0" encoding="utf-8"?>
2
+<databaseChangeLog
3
+    xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
4
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5
+    xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd">
6
+    <!--
7
+        Added the constraints for entity Photo.
8
+    -->
9
+    <changeSet id="20190102220100-2" author="jhipster">
10
+        
11
+        <addForeignKeyConstraint baseColumnNames="post_id"
12
+                                 baseTableName="photo"
13
+                                 constraintName="fk_photo_post_id"
14
+                                 referencedColumnNames="id"
15
+                                 referencedTableName="post"/>
16
+
17
+        <addForeignKeyConstraint baseColumnNames="photos_id"
18
+                                 baseTableName="photo_album"
19
+                                 constraintName="fk_photo_album_photos_id"
20
+                                 referencedColumnNames="id"
21
+                                 referencedTableName="photo"/>
22
+        <addForeignKeyConstraint baseColumnNames="albums_id"
23
+                                 baseTableName="photo_album"
24
+                                 constraintName="fk_photo_album_albums_id"
25
+                                 referencedColumnNames="id"
26
+                                 referencedTableName="album"/>
27
+        
28
+    </changeSet>
29
+</databaseChangeLog>

+ 41
- 0
src/main/resources/config/liquibase/changelog/20190102220101_added_entity_Video.xml View File

1
+<?xml version="1.0" encoding="utf-8"?>
2
+<databaseChangeLog
3
+    xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
4
+    xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
5
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
6
+    xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd
7
+                        http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">
8
+
9
+    <property name="now" value="now()" dbms="h2"/>
10
+
11
+    <property name="now" value="current_timestamp" dbms="postgresql"/>
12
+
13
+    <property name="floatType" value="float4" dbms="postgresql, h2"/>
14
+    <property name="floatType" value="float" dbms="mysql, oracle, mssql"/>
15
+
16
+    <!--
17
+        Added the entity Video.
18
+    -->
19
+    <changeSet id="20190102220101-1" author="jhipster">
20
+        <createTable tableName="video">
21
+            <column name="id" type="bigint" autoIncrement="${autoIncrement}">
22
+                <constraints primaryKey="true" nullable="false"/>
23
+            </column>
24
+            <column name="video_url" type="varchar(255)">
25
+                <constraints nullable="true" />
26
+            </column>
27
+
28
+            <column name="jhi_size" type="bigint">
29
+                <constraints nullable="true" />
30
+            </column>
31
+
32
+            <column name="post_id" type="bigint">
33
+                <constraints nullable="true" />
34
+            </column>
35
+
36
+            <!-- jhipster-needle-liquibase-add-column - JHipster will add columns here, do not remove-->
37
+        </createTable>
38
+        
39
+    </changeSet>
40
+    <!-- jhipster-needle-liquibase-add-changeset - JHipster will add changesets here, do not remove-->
41
+</databaseChangeLog>

+ 18
- 0
src/main/resources/config/liquibase/changelog/20190102220101_added_entity_constraints_Video.xml View File

1
+<?xml version="1.0" encoding="utf-8"?>
2
+<databaseChangeLog
3
+    xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
4
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5
+    xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd">
6
+    <!--
7
+        Added the constraints for entity Video.
8
+    -->
9
+    <changeSet id="20190102220101-2" author="jhipster">
10
+        
11
+        <addForeignKeyConstraint baseColumnNames="post_id"
12
+                                 baseTableName="video"
13
+                                 constraintName="fk_video_post_id"
14
+                                 referencedColumnNames="id"
15
+                                 referencedTableName="post"/>
16
+
17
+    </changeSet>
18
+</databaseChangeLog>

+ 49
- 0
src/main/resources/config/liquibase/changelog/20190102220102_added_entity_Post.xml View File

1
+<?xml version="1.0" encoding="utf-8"?>
2
+<databaseChangeLog
3
+    xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
4
+    xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
5
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
6
+    xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd
7
+                        http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">
8
+
9
+    <property name="now" value="now()" dbms="h2"/>
10
+
11
+    <property name="now" value="current_timestamp" dbms="postgresql"/>
12
+
13
+    <property name="floatType" value="float4" dbms="postgresql, h2"/>
14
+    <property name="floatType" value="float" dbms="mysql, oracle, mssql"/>
15
+
16
+    <!--
17
+        Added the entity Post.
18
+    -->
19
+    <changeSet id="20190102220102-1" author="jhipster">
20
+        <createTable tableName="post">
21
+            <column name="id" type="bigint" autoIncrement="${autoIncrement}">
22
+                <constraints primaryKey="true" nullable="false"/>
23
+            </column>
24
+            <column name="number_of_comments" type="bigint">
25
+                <constraints nullable="true" />
26
+            </column>
27
+
28
+            <column name="content" type="varchar(255)">
29
+                <constraints nullable="true" />
30
+            </column>
31
+
32
+            <column name="likes" type="bigint">
33
+                <constraints nullable="true" />
34
+            </column>
35
+
36
+            <column name="dislikes" type="bigint">
37
+                <constraints nullable="true" />
38
+            </column>
39
+
40
+            <column name="owner_id" type="bigint">
41
+                <constraints nullable="true" />
42
+            </column>
43
+
44
+            <!-- jhipster-needle-liquibase-add-column - JHipster will add columns here, do not remove-->
45
+        </createTable>
46
+        
47
+    </changeSet>
48
+    <!-- jhipster-needle-liquibase-add-changeset - JHipster will add changesets here, do not remove-->
49
+</databaseChangeLog>

+ 18
- 0
src/main/resources/config/liquibase/changelog/20190102220102_added_entity_constraints_Post.xml View File

1
+<?xml version="1.0" encoding="utf-8"?>
2
+<databaseChangeLog
3
+    xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
4
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5
+    xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd">
6
+    <!--
7
+        Added the constraints for entity Post.
8
+    -->
9
+    <changeSet id="20190102220102-2" author="jhipster">
10
+        
11
+        <addForeignKeyConstraint baseColumnNames="owner_id"
12
+                                 baseTableName="post"
13
+                                 constraintName="fk_post_owner_id"
14
+                                 referencedColumnNames="id"
15
+                                 referencedTableName="jhi_user"/>
16
+
17
+    </changeSet>
18
+</databaseChangeLog>

+ 49
- 0
src/main/resources/config/liquibase/changelog/20190102220103_added_entity_Comment.xml View File

1
+<?xml version="1.0" encoding="utf-8"?>
2
+<databaseChangeLog
3
+    xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
4
+    xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
5
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
6
+    xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd
7
+                        http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">
8
+
9
+    <property name="now" value="now()" dbms="h2"/>
10
+
11
+    <property name="now" value="current_timestamp" dbms="postgresql"/>
12
+
13
+    <property name="floatType" value="float4" dbms="postgresql, h2"/>
14
+    <property name="floatType" value="float" dbms="mysql, oracle, mssql"/>
15
+
16
+    <!--
17
+        Added the entity Comment.
18
+    -->
19
+    <changeSet id="20190102220103-1" author="jhipster">
20
+        <createTable tableName="comment">
21
+            <column name="id" type="bigint" autoIncrement="${autoIncrement}">
22
+                <constraints primaryKey="true" nullable="false"/>
23
+            </column>
24
+            <column name="content" type="varchar(255)">
25
+                <constraints nullable="true" />
26
+            </column>
27
+
28
+            <column name="likes" type="bigint">
29
+                <constraints nullable="true" />
30
+            </column>
31
+
32
+            <column name="dislikes" type="bigint">
33
+                <constraints nullable="true" />
34
+            </column>
35
+
36
+            <column name="commenter_id" type="bigint">
37
+                <constraints nullable="true" />
38
+            </column>
39
+
40
+            <column name="post_id" type="bigint">
41
+                <constraints nullable="true" />
42
+            </column>
43
+
44
+            <!-- jhipster-needle-liquibase-add-column - JHipster will add columns here, do not remove-->
45
+        </createTable>
46
+        
47
+    </changeSet>
48
+    <!-- jhipster-needle-liquibase-add-changeset - JHipster will add changesets here, do not remove-->
49
+</databaseChangeLog>

+ 24
- 0
src/main/resources/config/liquibase/changelog/20190102220103_added_entity_constraints_Comment.xml View File

1
+<?xml version="1.0" encoding="utf-8"?>
2
+<databaseChangeLog
3
+    xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
4
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5
+    xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd">
6
+    <!--
7
+        Added the constraints for entity Comment.
8
+    -->
9
+    <changeSet id="20190102220103-2" author="jhipster">
10
+        
11
+        <addForeignKeyConstraint baseColumnNames="commenter_id"
12
+                                 baseTableName="comment"
13
+                                 constraintName="fk_comment_commenter_id"
14
+                                 referencedColumnNames="id"
15
+                                 referencedTableName="jhi_user"/>
16
+
17
+        <addForeignKeyConstraint baseColumnNames="post_id"
18
+                                 baseTableName="comment"
19
+                                 constraintName="fk_comment_post_id"
20
+                                 referencedColumnNames="id"
21
+                                 referencedTableName="post"/>
22
+
23
+    </changeSet>
24
+</databaseChangeLog>

+ 16
- 0
src/main/resources/config/liquibase/master.xml View File

5
     xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd">
5
     xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd">
6
 
6
 
7
     <include file="config/liquibase/changelog/00000000000000_initial_schema.xml" relativeToChangelogFile="false"/>
7
     <include file="config/liquibase/changelog/00000000000000_initial_schema.xml" relativeToChangelogFile="false"/>
8
+    <include file="config/liquibase/changelog/20190102220056_added_entity_AccountDetails.xml" relativeToChangelogFile="false"/>
9
+    <include file="config/liquibase/changelog/20190102220057_added_entity_Profile.xml" relativeToChangelogFile="false"/>
10
+    <include file="config/liquibase/changelog/20190102220058_added_entity_Friend.xml" relativeToChangelogFile="false"/>
11
+    <include file="config/liquibase/changelog/20190102220059_added_entity_Album.xml" relativeToChangelogFile="false"/>
12
+    <include file="config/liquibase/changelog/20190102220100_added_entity_Photo.xml" relativeToChangelogFile="false"/>
13
+    <include file="config/liquibase/changelog/20190102220101_added_entity_Video.xml" relativeToChangelogFile="false"/>
14
+    <include file="config/liquibase/changelog/20190102220102_added_entity_Post.xml" relativeToChangelogFile="false"/>
15
+    <include file="config/liquibase/changelog/20190102220103_added_entity_Comment.xml" relativeToChangelogFile="false"/>
8
     <!-- jhipster-needle-liquibase-add-changelog - JHipster will add liquibase changelogs here -->
16
     <!-- jhipster-needle-liquibase-add-changelog - JHipster will add liquibase changelogs here -->
17
+    <include file="config/liquibase/changelog/20190102220056_added_entity_constraints_AccountDetails.xml" relativeToChangelogFile="false"/>
18
+    <include file="config/liquibase/changelog/20190102220057_added_entity_constraints_Profile.xml" relativeToChangelogFile="false"/>
19
+    <include file="config/liquibase/changelog/20190102220058_added_entity_constraints_Friend.xml" relativeToChangelogFile="false"/>
20
+    <include file="config/liquibase/changelog/20190102220059_added_entity_constraints_Album.xml" relativeToChangelogFile="false"/>
21
+    <include file="config/liquibase/changelog/20190102220100_added_entity_constraints_Photo.xml" relativeToChangelogFile="false"/>
22
+    <include file="config/liquibase/changelog/20190102220101_added_entity_constraints_Video.xml" relativeToChangelogFile="false"/>
23
+    <include file="config/liquibase/changelog/20190102220102_added_entity_constraints_Post.xml" relativeToChangelogFile="false"/>
24
+    <include file="config/liquibase/changelog/20190102220103_added_entity_constraints_Comment.xml" relativeToChangelogFile="false"/>
9
     <!-- jhipster-needle-liquibase-add-constraints-changelog - JHipster will add liquibase constraints changelogs here -->
25
     <!-- jhipster-needle-liquibase-add-constraints-changelog - JHipster will add liquibase constraints changelogs here -->
10
 </databaseChangeLog>
26
 </databaseChangeLog>

+ 79
- 0
src/main/webapp/app/FaeBoo/Profile-head/profile-head.component.html View File

1
+<div class="main-cont">
2
+
3
+    <div class = "friend-cont">
4
+
5
+        <div class="friend-pic friend4" id = "friend7">
6
+            <img class ="friend-photo friend4" src = "../../../content/images/defaultphoto.png">
7
+        </div>
8
+
9
+        <div class="friend-pic friend3" id = "friend5">
10
+            <img class ="friend-photo friend3" src = "../../../content/images/defaultphoto.png">
11
+        </div>
12
+
13
+        <div class="friend-pic friend2" id = "friend3">
14
+            <img class ="friend-photo" src = "../../../content/images/defaultphoto.png">
15
+        </div>
16
+
17
+        <div class="friend-pic friend1" id = "friend1">
18
+            <img class ="friend-photo" src = "../../../content/images/defaultphoto.png">
19
+        </div>
20
+
21
+        <div class = "profile-pic">
22
+            <img class ="friend-photo" src = "../../../content/images/defaultphoto.png">
23
+        </div>
24
+
25
+        <div class="friend-pic friend1" id = "friend2">
26
+            <img class ="friend-photo" src = "../../../content/images/defaultphoto.png">
27
+        </div>
28
+
29
+        <div class="friend-pic friend2" id = "friend4">
30
+            <img class ="friend-photo" src = "../../../content/images/defaultphoto.png">
31
+        </div>
32
+
33
+        <div class="friend-pic friend3" id = "friend6">
34
+            <img class ="friend-photo" src = "../../../content/images/defaultphoto.png">
35
+        </div>
36
+
37
+        <div class="friend-pic friend4" id = friend8>
38
+            <img class ="friend-photo" src = "../../../content/images/defaultphoto.png">
39
+        </div>
40
+
41
+    </div>
42
+
43
+
44
+    <div class = "settings-container">
45
+
46
+        <button>Settings</button>
47
+        <button>Change Profile</button>
48
+        <button>Change Bio</button>
49
+        <button>Friends</button>
50
+
51
+    </div>
52
+
53
+    <hr>
54
+
55
+    <div id = "bio-cont"></div>
56
+
57
+    <hr>
58
+
59
+    <div id = "feed">
60
+
61
+        <div class = "post">
62
+            <div>
63
+                <textarea id = "post-area" [(ngModel)]="str"></textarea>
64
+            </div>
65
+
66
+            <div id = "postButton-container">
67
+                <div class = "button-holder"><button class = "postBtn">Schedule</button></div>
68
+                <div class = "button-holder"><button class = "postBtn">Memo</button></div>
69
+                <div class = "button-holder"><button class = "postBtn">Photo</button></div>
70
+                <div class = "button-holder"><button class = "postBtn" (click)="submitPost();">Submit</button></div>
71
+            </div>
72
+
73
+            <p id = "msg">Create a post...</p>
74
+        </div>
75
+
76
+
77
+    </div>
78
+
79
+</div>

+ 57
- 0
src/main/webapp/app/FaeBoo/Profile-head/profile-head.component.ts View File

1
+import { Component } from '@angular/core';
2
+import { PostService } from 'app/entities/post';
3
+import { IPost } from 'app/shared/model/post.model';
4
+import { IUser } from 'app/core';
5
+import { Observable } from 'rxjs';
6
+import { HttpErrorResponse, HttpResponse } from '@angular/common/http';
7
+
8
+@Component({
9
+    selector: 'jhi-profile-head',
10
+    templateUrl: './profile-head.component.html',
11
+    styleUrls: ['profile-head.css']
12
+})
13
+export class ProfileHeadComponent {
14
+    str: string;
15
+    post: IPost;
16
+    user: IUser;
17
+    isSaving: boolean;
18
+    testPost: IPost;
19
+
20
+    constructor(private postService: PostService) {}
21
+
22
+    submitPost(): void {
23
+        this.post = new class implements IPost {
24
+            content: string;
25
+            dislikes: number;
26
+            id: number;
27
+            likes: number;
28
+            numberOfComments: number;
29
+            owner: IUser;
30
+        }();
31
+        this.post.content = this.str;
32
+        this.post.dislikes = 0;
33
+        this.post.likes = 0;
34
+        this.post.numberOfComments = 0;
35
+        if (this.post.content.length > 1) {
36
+            this.save(this.post);
37
+        }
38
+    }
39
+
40
+    save(post: IPost) {
41
+        this.isSaving = true;
42
+        this.subscribeToSaveResponse(this.postService.create(post));
43
+        console.log('post created');
44
+    }
45
+
46
+    private subscribeToSaveResponse(result: Observable<HttpResponse<IPost>>) {
47
+        result.subscribe((res: HttpResponse<IPost>) => this.onSaveSuccess(), (res: HttpErrorResponse) => this.onSaveError());
48
+    }
49
+
50
+    private onSaveSuccess() {
51
+        this.isSaving = false;
52
+    }
53
+
54
+    private onSaveError() {
55
+        this.isSaving = false;
56
+    }
57
+}

+ 160
- 0
src/main/webapp/app/FaeBoo/Profile-head/profile-head.css View File

1
+.main-cont {
2
+    width: 100%;
3
+    height: 1fr;
4
+    box-sizing: border-box;
5
+    padding: 8px;
6
+    position: relative;
7
+}
8
+
9
+.friend-cont {
10
+    display: grid;
11
+    justify-items: center;
12
+    grid-template-columns: calc(10%) calc(10%) calc(10%) calc(10%) calc(20%) calc(10%) calc(10%) calc(10%) calc(10%);
13
+    /*grid-column-gap: 5px;*/
14
+    grid-template-rows: auto;
15
+    width: 100%;
16
+    height: 100%;
17
+    box-sizing: border-box;
18
+    position: relative;
19
+    overflow-y: auto;
20
+    overflow-x: scroll;
21
+    margin: auto;
22
+}
23
+
24
+#bio-cont {
25
+    width: 100%;
26
+    height: 75px;
27
+    box-sizing: border-box;
28
+    padding: 8px;
29
+    margin-top: 8px;
30
+}
31
+
32
+.friend-pic {
33
+    width: 100px;
34
+    height: 100px;
35
+    position: relative;
36
+    border-radius: 50%;
37
+    margin: auto;
38
+    overflow-x: hidden;
39
+}
40
+
41
+.friend-photo {
42
+    width: 100%;
43
+    height: 100%;
44
+    object-fit: cover;
45
+}
46
+
47
+.profile-pic {
48
+    width: 200px;
49
+    height: 200px;
50
+    position: relative;
51
+    overflow: hidden;
52
+    border-radius: 50%;
53
+    grid-column-start: 5;
54
+    grid-row-start: 1;
55
+    margin: auto;
56
+    z-index: 5;
57
+}
58
+
59
+.friend1 {
60
+    z-index: 1;
61
+}
62
+
63
+.friend2 {
64
+    z-index: 2;
65
+}
66
+
67
+.friend3 {
68
+    z-index: 3;
69
+}
70
+
71
+.friend4 {
72
+    z-index: 4;
73
+}
74
+
75
+.settings-container {
76
+    width: 100%;
77
+    text-align: center;
78
+    padding: 10px;
79
+}
80
+
81
+.settings-container button {
82
+    display: inline-block;
83
+    width: 20%;
84
+    text-align: center;
85
+    border: none;
86
+    background-color: #e2e6eb;
87
+    padding: 5px;
88
+    color: #969a9f;
89
+    margin-right: 10px;
90
+    margin-top: 10px;
91
+}
92
+
93
+hr {
94
+    border: 1px solid #d1d5da;
95
+}
96
+
97
+#feed {
98
+    width: 65%;
99
+    min-height: 250px;
100
+    margin: auto;
101
+    padding: 10px;
102
+    box-sizing: border-box;
103
+}
104
+
105
+.post {
106
+    width: 100%;
107
+    height: 245px;
108
+    padding: 15px;
109
+    box-sizing: border-box;
110
+    display: grid;
111
+    grid-template-columns: calc(85% - 5px) 15%;
112
+    grid-template-rows: 195px 20px;
113
+    grid-column-gap: 5px;
114
+    color: #969a9f;
115
+    border-radius: 5px;
116
+    background-color: #e2e6eb;
117
+}
118
+
119
+#post-area {
120
+    resize: none;
121
+    width: 100%;
122
+    height: 100%;
123
+    grid-row-start: 1;
124
+    grid-column-start: 1;
125
+    border: none;
126
+    border-radius: 5px;
127
+    padding: 10px;
128
+}
129
+
130
+#postButton-container {
131
+    width: 100%;
132
+    height: 100%;
133
+    display: grid;
134
+    grid-template-rows: 25% 25% 25% 25%;
135
+    grid-template-columns: 100%;
136
+    box-sizing: border-box;
137
+    grid-row-start: 1;
138
+    grid-column-start: 2;
139
+}
140
+
141
+.postBtn {
142
+    width: 100%;
143
+    height: 100%;
144
+    font-size: 10px;
145
+    border: none;
146
+    background-color: white;
147
+    color: #969a9f;
148
+}
149
+
150
+.button-holder {
151
+    width: 100%;
152
+    height: 100%;
153
+    box-sizing: border-box;
154
+    padding: 5px;
155
+}
156
+
157
+#msg {
158
+    grid-column-start: 1;
159
+    grid-row-start: 2;
160
+}

+ 1
- 0
src/main/webapp/app/FaeBoo/Profile-temp/profile-temp.component.html View File

1
+<jhi-profile-head></jhi-profile-head>

+ 9
- 0
src/main/webapp/app/FaeBoo/Profile-temp/profile-temp.component.ts View File

1
+import { Component } from '@angular/core';
2
+import { ProfileHeadComponent } from 'app/FaeBoo/Profile-head/profile-head.component';
3
+
4
+@Component({
5
+    selector: 'jhi-profile-temp',
6
+    templateUrl: './profile-temp.component.html',
7
+    styleUrls: ['profile-temp.scss']
8
+})
9
+export class ProfileTempComponent {}

+ 14
- 0
src/main/webapp/app/FaeBoo/Profile-temp/profile-temp.module.ts View File

1
+import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
2
+import { RouterModule } from '@angular/router';
3
+
4
+import { FaeBooSharedModule } from 'app/shared';
5
+import { PROFILE_ROUTE } from 'app/FaeBoo/Profile-temp/profile-temp.route';
6
+import { ProfileTempComponent } from 'app/FaeBoo/Profile-temp/profile-temp.component';
7
+import { ProfileHeadComponent } from 'app/FaeBoo/Profile-head/profile-head.component';
8
+
9
+@NgModule({
10
+    imports: [FaeBooSharedModule, RouterModule.forChild([PROFILE_ROUTE])],
11
+    declarations: [ProfileTempComponent, ProfileHeadComponent],
12
+    schemas: [CUSTOM_ELEMENTS_SCHEMA]
13
+})
14
+export class ProfileTempModule {}

+ 12
- 0
src/main/webapp/app/FaeBoo/Profile-temp/profile-temp.route.ts View File

1
+import { Route } from '@angular/router';
2
+
3
+import { ProfileTempComponent } from 'app/FaeBoo/Profile-temp/profile-temp.component';
4
+
5
+export const PROFILE_ROUTE: Route = {
6
+    path: 'profile-head',
7
+    component: ProfileTempComponent,
8
+    data: {
9
+        authorities: [],
10
+        pageTitle: 'profile.title'
11
+    }
12
+};

+ 0
- 0
src/main/webapp/app/FaeBoo/Profile-temp/profile-temp.scss View File


+ 39
- 0
src/main/webapp/app/FaeBoo/Services/post.service.ts View File

1
+import { Injectable } from '@angular/core';
2
+import { HttpClient, HttpResponse } from '@angular/common/http';
3
+import { Observable } from 'rxjs';
4
+
5
+import { SERVER_API_URL } from 'app/app.constants';
6
+import { createRequestOption } from 'app/shared/util/request-util';
7
+import { IPost } from 'app/shared/model/post.model';
8
+
9
+@Injectable({ providedIn: 'root' })
10
+export class PostService {
11
+    public resourceUrl = SERVER_API_URL + 'api/users';
12
+
13
+    constructor(private http: HttpClient) {}
14
+
15
+    create(post: IPost): Observable<HttpResponse<IPost>> {
16
+        return this.http.post<IPost>(this.resourceUrl, post, { observe: 'response' });
17
+    }
18
+
19
+    update(post: IPost): Observable<HttpResponse<IPost>> {
20
+        return this.http.put<IPost>(this.resourceUrl, post, { observe: 'response' });
21
+    }
22
+
23
+    find(login: string): Observable<HttpResponse<IPost>> {
24
+        return this.http.get<IPost>(`${this.resourceUrl}/${login}`, { observe: 'response' });
25
+    }
26
+
27
+    query(req?: any): Observable<HttpResponse<IPost[]>> {
28
+        const options = createRequestOption(req);
29
+        return this.http.get<IPost[]>(this.resourceUrl, { params: options, observe: 'response' });
30
+    }
31
+
32
+    delete(login: string): Observable<HttpResponse<any>> {
33
+        return this.http.delete(`${this.resourceUrl}/${login}`, { observe: 'response' });
34
+    }
35
+
36
+    authorities(): Observable<string[]> {
37
+        return this.http.get<string[]>(SERVER_API_URL + 'api/users/authorities');
38
+    }
39
+}

+ 10
- 1
src/main/webapp/app/account/account.route.ts View File

1
 import { Routes } from '@angular/router';
1
 import { Routes } from '@angular/router';
2
 
2
 
3
+import { loginRoute } from 'app/shared/login/login.route';
3
 import { activateRoute, passwordRoute, passwordResetFinishRoute, passwordResetInitRoute, registerRoute, settingsRoute } from './';
4
 import { activateRoute, passwordRoute, passwordResetFinishRoute, passwordResetInitRoute, registerRoute, settingsRoute } from './';
4
 
5
 
5
-const ACCOUNT_ROUTES = [activateRoute, passwordRoute, passwordResetFinishRoute, passwordResetInitRoute, registerRoute, settingsRoute];
6
+const ACCOUNT_ROUTES = [
7
+    activateRoute,
8
+    passwordRoute,
9
+    passwordResetFinishRoute,
10
+    passwordResetInitRoute,
11
+    registerRoute,
12
+    settingsRoute,
13
+    loginRoute
14
+];
6
 
15
 
7
 export const accountState: Routes = [
16
 export const accountState: Routes = [
8
     {
17
     {

+ 1
- 1
src/main/webapp/app/account/register/register.component.html View File

12
             </div>
12
             </div>
13
 
13
 
14
             <div class="alert alert-danger" *ngIf="errorUserExists" jhiTranslate="register.messages.error.userexists">
14
             <div class="alert alert-danger" *ngIf="errorUserExists" jhiTranslate="register.messages.error.userexists">
15
-                <strong>Login name already registered!</strong> Please choose another one.
15
+                <strong>Login name already registered!</strong> Please, choose another one.
16
             </div>
16
             </div>
17
 
17
 
18
             <div class="alert alert-danger" *ngIf="errorEmailExists" jhiTranslate="register.messages.error.emailexists">
18
             <div class="alert alert-danger" *ngIf="errorEmailExists" jhiTranslate="register.messages.error.emailexists">

+ 1
- 0
src/main/webapp/app/account/register/register.component.ts View File

39
     }
39
     }
40
 
40
 
41
     register() {
41
     register() {
42
+        console.log('Register');
42
         if (this.registerAccount.password !== this.confirmPassword) {
43
         if (this.registerAccount.password !== this.confirmPassword) {
43
             this.doNotMatch = 'ERROR';
44
             this.doNotMatch = 'ERROR';
44
         } else {
45
         } else {

+ 14
- 1
src/main/webapp/app/app.module.ts View File

7
 import { Ng2Webstorage } from 'ngx-webstorage';
7
 import { Ng2Webstorage } from 'ngx-webstorage';
8
 import { NgJhipsterModule } from 'ng-jhipster';
8
 import { NgJhipsterModule } from 'ng-jhipster';
9
 
9
 
10
+// import { ProfileHeadComponent } from 'app/FaeBoo/Profile-head/profile-head.component';
11
+import { ProfileTempComponent } from 'app/FaeBoo/Profile-temp/profile-temp.component';
12
+import { ProfileTempModule } from 'app/FaeBoo/Profile-temp/profile-temp.module';
13
+
10
 import { AuthInterceptor } from './blocks/interceptor/auth.interceptor';
14
 import { AuthInterceptor } from './blocks/interceptor/auth.interceptor';
11
 import { AuthExpiredInterceptor } from './blocks/interceptor/auth-expired.interceptor';
15
 import { AuthExpiredInterceptor } from './blocks/interceptor/auth-expired.interceptor';
12
 import { ErrorHandlerInterceptor } from './blocks/interceptor/errorhandler.interceptor';
16
 import { ErrorHandlerInterceptor } from './blocks/interceptor/errorhandler.interceptor';
36
         FaeBooSharedModule.forRoot(),
40
         FaeBooSharedModule.forRoot(),
37
         FaeBooCoreModule,
41
         FaeBooCoreModule,
38
         FaeBooHomeModule,
42
         FaeBooHomeModule,
43
+        ProfileTempModule,
39
         FaeBooAccountModule,
44
         FaeBooAccountModule,
40
         // jhipster-needle-angular-add-module JHipster will add new module here
45
         // jhipster-needle-angular-add-module JHipster will add new module here
41
         FaeBooEntityModule
46
         FaeBooEntityModule
42
     ],
47
     ],
43
-    declarations: [JhiMainComponent, NavbarComponent, ErrorComponent, PageRibbonComponent, ActiveMenuDirective, FooterComponent],
48
+    declarations: [
49
+        JhiMainComponent,
50
+        NavbarComponent,
51
+        ErrorComponent,
52
+        PageRibbonComponent,
53
+        ActiveMenuDirective,
54
+        FooterComponent
55
+        // ProfileHeadComponent,
56
+    ],
44
     providers: [
57
     providers: [
45
         {
58
         {
46
             provide: HTTP_INTERCEPTORS,
59
             provide: HTTP_INTERCEPTORS,

+ 19
- 0
src/main/webapp/app/entities/account-details/account-details-delete-dialog.component.html View File

1
+<form name="deleteForm" (ngSubmit)="confirmDelete(accountDetails.id)">
2
+    <div class="modal-header">
3
+        <h4 class="modal-title" jhiTranslate="entity.delete.title">Confirm delete operation</h4>
4
+        <button type="button" class="close" data-dismiss="modal" aria-hidden="true"
5
+                (click)="clear()">&times;</button>
6
+    </div>
7
+    <div class="modal-body">
8
+        <jhi-alert-error></jhi-alert-error>
9
+        <p id="jhi-delete-accountDetails-heading" jhiTranslate="faeBooApp.accountDetails.delete.question" translateValues="{id: '{{accountDetails.id}}'}">Are you sure you want to delete this Account Details?</p>
10
+    </div>
11
+    <div class="modal-footer">
12
+        <button type="button" class="btn btn-secondary" data-dismiss="modal" (click)="clear()">
13
+            <fa-icon [icon]="'ban'"></fa-icon>&nbsp;<span jhiTranslate="entity.action.cancel">Cancel</span>
14
+        </button>
15
+        <button id="jhi-confirm-delete-accountDetails" type="submit" class="btn btn-danger">
16
+            <fa-icon [icon]="'times'"></fa-icon>&nbsp;<span jhiTranslate="entity.action.delete">Delete</span>
17
+        </button>
18
+    </div>
19
+</form>

+ 72
- 0
src/main/webapp/app/entities/account-details/account-details-delete-dialog.component.ts View File

1
+import { Component, OnInit, OnDestroy } from '@angular/core';
2
+import { ActivatedRoute, Router } from '@angular/router';
3
+
4
+import { NgbActiveModal, NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap';
5
+import { JhiEventManager } from 'ng-jhipster';
6
+
7
+import { IAccountDetails } from 'app/shared/model/account-details.model';
8
+import { AccountDetailsService } from './account-details.service';
9
+
10
+@Component({
11
+    selector: 'jhi-account-details-delete-dialog',
12
+    templateUrl: './account-details-delete-dialog.component.html'
13
+})
14
+export class AccountDetailsDeleteDialogComponent {
15
+    accountDetails: IAccountDetails;
16
+
17
+    constructor(
18
+        private accountDetailsService: AccountDetailsService,
19
+        public activeModal: NgbActiveModal,
20
+        private eventManager: JhiEventManager
21
+    ) {}
22
+
23
+    clear() {
24
+        this.activeModal.dismiss('cancel');
25
+    }
26
+
27
+    confirmDelete(id: number) {
28
+        this.accountDetailsService.delete(id).subscribe(response => {
29
+            this.eventManager.broadcast({
30
+                name: 'accountDetailsListModification',
31
+                content: 'Deleted an accountDetails'
32
+            });
33
+            this.activeModal.dismiss(true);
34
+        });
35
+    }
36
+}
37
+
38
+@Component({
39
+    selector: 'jhi-account-details-delete-popup',
40
+    template: ''
41
+})
42
+export class AccountDetailsDeletePopupComponent implements OnInit, OnDestroy {
43
+    private ngbModalRef: NgbModalRef;
44
+
45
+    constructor(private activatedRoute: ActivatedRoute, private router: Router, private modalService: NgbModal) {}
46
+
47
+    ngOnInit() {
48
+        this.activatedRoute.data.subscribe(({ accountDetails }) => {
49
+            setTimeout(() => {
50
+                this.ngbModalRef = this.modalService.open(AccountDetailsDeleteDialogComponent as Component, {
51
+                    size: 'lg',
52
+                    backdrop: 'static'
53
+                });
54
+                this.ngbModalRef.componentInstance.accountDetails = accountDetails;
55
+                this.ngbModalRef.result.then(
56
+                    result => {
57
+                        this.router.navigate([{ outlets: { popup: null } }], { replaceUrl: true, queryParamsHandling: 'merge' });
58
+                        this.ngbModalRef = null;
59
+                    },
60
+                    reason => {
61
+                        this.router.navigate([{ outlets: { popup: null } }], { replaceUrl: true, queryParamsHandling: 'merge' });
62
+                        this.ngbModalRef = null;
63
+                    }
64
+                );
65
+            }, 0);
66
+        });
67
+    }
68
+
69
+    ngOnDestroy() {
70
+        this.ngbModalRef = null;
71
+    }
72
+}

+ 39
- 0
src/main/webapp/app/entities/account-details/account-details-detail.component.html View File

1
+<div class="row justify-content-center">
2
+    <div class="col-8">
3
+        <div *ngIf="accountDetails">
4
+            <h2><span jhiTranslate="faeBooApp.accountDetails.detail.title">Account Details</span> {{accountDetails.id}}</h2>
5
+            <hr>
6
+            <jhi-alert-error></jhi-alert-error>
7
+            <dl class="row-md jh-entity-details">
8
+                <dt><span jhiTranslate="faeBooApp.accountDetails.securityQuestion">Security Question</span></dt>
9
+                <dd>
10
+                    <span>{{accountDetails.securityQuestion}}</span>
11
+                </dd>
12
+                <dt><span jhiTranslate="faeBooApp.accountDetails.securityAnswer">Security Answer</span></dt>
13
+                <dd>
14
+                    <span>{{accountDetails.securityAnswer}}</span>
15
+                </dd>
16
+                <dt><span jhiTranslate="faeBooApp.accountDetails.phoneNumber">Phone Number</span></dt>
17
+                <dd>
18
+                    <span>{{accountDetails.phoneNumber}}</span>
19
+                </dd>
20
+                <dt><span jhiTranslate="faeBooApp.accountDetails.userAccount">User Account</span></dt>
21
+                <dd>
22
+                    {{accountDetails.userAccount?.email}}
23
+                </dd>
24
+            </dl>
25
+
26
+            <button type="submit"
27
+                    (click)="previousState()"
28
+                    class="btn btn-info">
29
+                <fa-icon [icon]="'arrow-left'"></fa-icon>&nbsp;<span jhiTranslate="entity.action.back"> Back</span>
30
+            </button>
31
+
32
+            <button type="button"
33
+                    [routerLink]="['/account-details', accountDetails.id, 'edit']"
34
+                    class="btn btn-primary">
35
+                <fa-icon [icon]="'pencil-alt'"></fa-icon>&nbsp;<span jhiTranslate="entity.action.edit"> Edit</span>
36
+            </button>
37
+        </div>
38
+    </div>
39
+</div>

+ 24
- 0
src/main/webapp/app/entities/account-details/account-details-detail.component.ts View File

1
+import { Component, OnInit } from '@angular/core';
2
+import { ActivatedRoute } from '@angular/router';
3
+
4
+import { IAccountDetails } from 'app/shared/model/account-details.model';
5
+
6
+@Component({
7
+    selector: 'jhi-account-details-detail',
8
+    templateUrl: './account-details-detail.component.html'
9
+})
10
+export class AccountDetailsDetailComponent implements OnInit {
11
+    accountDetails: IAccountDetails;
12
+
13
+    constructor(private activatedRoute: ActivatedRoute) {}
14
+
15
+    ngOnInit() {
16
+        this.activatedRoute.data.subscribe(({ accountDetails }) => {
17
+            this.accountDetails = accountDetails;
18
+        });
19
+    }
20
+
21
+    previousState() {
22
+        window.history.back();
23
+    }
24
+}

+ 46
- 0
src/main/webapp/app/entities/account-details/account-details-update.component.html View File

1
+<div class="row justify-content-center">
2
+    <div class="col-8">
3
+        <form name="editForm" role="form" novalidate (ngSubmit)="save()" #editForm="ngForm">
4
+            <h2 id="jhi-account-details-heading" jhiTranslate="faeBooApp.accountDetails.home.createOrEditLabel">Create or edit a Account Details</h2>
5
+            <div>
6
+                <jhi-alert-error></jhi-alert-error>
7
+                <div class="form-group" [hidden]="!accountDetails.id">
8
+                    <label for="id" jhiTranslate="global.field.id">ID</label>
9
+                    <input type="text" class="form-control" id="id" name="id"
10
+                        [(ngModel)]="accountDetails.id" readonly />
11
+                </div>
12
+                <div class="form-group">
13
+                    <label class="form-control-label" jhiTranslate="faeBooApp.accountDetails.securityQuestion" for="field_securityQuestion">Security Question</label>
14
+                    <input type="text" class="form-control" name="securityQuestion" id="field_securityQuestion"
15
+                        [(ngModel)]="accountDetails.securityQuestion" />
16
+                </div>
17
+                <div class="form-group">
18
+                    <label class="form-control-label" jhiTranslate="faeBooApp.accountDetails.securityAnswer" for="field_securityAnswer">Security Answer</label>
19
+                    <input type="text" class="form-control" name="securityAnswer" id="field_securityAnswer"
20
+                        [(ngModel)]="accountDetails.securityAnswer" />
21
+                </div>
22
+                <div class="form-group">
23
+                    <label class="form-control-label" jhiTranslate="faeBooApp.accountDetails.phoneNumber" for="field_phoneNumber">Phone Number</label>
24
+                    <input type="text" class="form-control" name="phoneNumber" id="field_phoneNumber"
25
+                        [(ngModel)]="accountDetails.phoneNumber" />
26
+                </div>
27
+
28
+                <div class="form-group">
29
+                    <label class="form-control-label" jhiTranslate="faeBooApp.accountDetails.userAccount" for="field_userAccount">User Account</label>
30
+                    <select class="form-control" id="field_userAccount" name="userAccount" [(ngModel)]="accountDetails.userAccount" >
31
+                        <option [ngValue]="null"></option>
32
+                        <option [ngValue]="userOption.id === accountDetails.userAccount?.id ? accountDetails.userAccount : userOption" *ngFor="let userOption of users; trackBy: trackUserById">{{userOption.email}}</option>
33
+                    </select>
34
+                </div>
35
+            </div>
36
+            <div>
37
+                <button type="button" id="cancel-save" class="btn btn-secondary"  (click)="previousState()">
38
+                    <fa-icon [icon]="'ban'"></fa-icon>&nbsp;<span jhiTranslate="entity.action.cancel">Cancel</span>
39
+                </button>
40
+                <button type="submit" id="save-entity" [disabled]="editForm.form.invalid || isSaving" class="btn btn-primary">
41
+                    <fa-icon [icon]="'save'"></fa-icon>&nbsp;<span jhiTranslate="entity.action.save">Save</span>
42
+                </button>
43
+            </div>
44
+        </form>
45
+    </div>
46
+</div>

+ 74
- 0
src/main/webapp/app/entities/account-details/account-details-update.component.ts View File

1
+import { Component, OnInit } from '@angular/core';
2
+import { ActivatedRoute } from '@angular/router';
3
+import { HttpResponse, HttpErrorResponse } from '@angular/common/http';
4
+import { Observable } from 'rxjs';
5
+import { JhiAlertService } from 'ng-jhipster';
6
+
7
+import { IAccountDetails } from 'app/shared/model/account-details.model';
8
+import { AccountDetailsService } from './account-details.service';
9
+import { IUser, UserService } from 'app/core';
10
+
11
+@Component({
12
+    selector: 'jhi-account-details-update',
13
+    templateUrl: './account-details-update.component.html'
14
+})
15
+export class AccountDetailsUpdateComponent implements OnInit {
16
+    accountDetails: IAccountDetails;
17
+    isSaving: boolean;
18
+
19
+    users: IUser[];
20
+
21
+    constructor(
22
+        private jhiAlertService: JhiAlertService,
23
+        private accountDetailsService: AccountDetailsService,
24
+        private userService: UserService,
25
+        private activatedRoute: ActivatedRoute
26
+    ) {}
27
+
28
+    ngOnInit() {
29
+        this.isSaving = false;
30
+        this.activatedRoute.data.subscribe(({ accountDetails }) => {
31
+            this.accountDetails = accountDetails;
32
+        });
33
+        this.userService.query().subscribe(
34
+            (res: HttpResponse<IUser[]>) => {
35
+                this.users = res.body;
36
+            },
37
+            (res: HttpErrorResponse) => this.onError(res.message)
38
+        );
39
+    }
40
+
41
+    previousState() {
42
+        window.history.back();
43
+    }
44
+
45
+    save() {
46
+        this.isSaving = true;
47
+        if (this.accountDetails.id !== undefined) {
48
+            this.subscribeToSaveResponse(this.accountDetailsService.update(this.accountDetails));
49
+        } else {
50
+            this.subscribeToSaveResponse(this.accountDetailsService.create(this.accountDetails));
51
+        }
52
+    }
53
+
54
+    private subscribeToSaveResponse(result: Observable<HttpResponse<IAccountDetails>>) {
55
+        result.subscribe((res: HttpResponse<IAccountDetails>) => this.onSaveSuccess(), (res: HttpErrorResponse) => this.onSaveError());
56
+    }
57
+
58
+    private onSaveSuccess() {
59
+        this.isSaving = false;
60
+        this.previousState();
61
+    }
62
+
63
+    private onSaveError() {
64
+        this.isSaving = false;
65
+    }
66
+
67
+    private onError(errorMessage: string) {
68
+        this.jhiAlertService.error(errorMessage, null, null);
69
+    }
70
+
71
+    trackUserById(index: number, item: IUser) {
72
+        return item.id;
73
+    }
74
+}

+ 62
- 0
src/main/webapp/app/entities/account-details/account-details.component.html View File

1
+<div>
2
+    <h2 id="page-heading">
3
+        <span jhiTranslate="faeBooApp.accountDetails.home.title">Account Details</span>
4
+        <button id="jh-create-entity" class="btn btn-primary float-right jh-create-entity create-account-details" [routerLink]="['/account-details/new']">
5
+            <fa-icon [icon]="'plus'"></fa-icon>
6
+            <span  jhiTranslate="faeBooApp.accountDetails.home.createLabel">
7
+            Create new Account Details
8
+            </span>
9
+        </button>
10
+    </h2>
11
+    <jhi-alert></jhi-alert>
12
+    <br/>
13
+    <div class="table-responsive" *ngIf="accountDetails">
14
+        <table class="table table-striped">
15
+            <thead>
16
+            <tr>
17
+            <th><span jhiTranslate="global.field.id">ID</span></th>
18
+            <th><span jhiTranslate="faeBooApp.accountDetails.securityQuestion">Security Question</span></th>
19
+            <th><span jhiTranslate="faeBooApp.accountDetails.securityAnswer">Security Answer</span></th>
20
+            <th><span jhiTranslate="faeBooApp.accountDetails.phoneNumber">Phone Number</span></th>
21
+            <th><span jhiTranslate="faeBooApp.accountDetails.userAccount">User Account</span></th>
22
+            <th></th>
23
+            </tr>
24
+            </thead>
25
+            <tbody>
26
+            <tr *ngFor="let accountDetails of accountDetails ;trackBy: trackId">
27
+                <td><a [routerLink]="['/account-details', accountDetails.id, 'view' ]">{{accountDetails.id}}</a></td>
28
+                <td>{{accountDetails.securityQuestion}}</td>
29
+                <td>{{accountDetails.securityAnswer}}</td>
30
+                <td>{{accountDetails.phoneNumber}}</td>
31
+                <td>
32
+                    {{accountDetails.userAccount?.email}}
33
+                </td>
34
+                <td class="text-right">
35
+                    <div class="btn-group flex-btn-group-container">
36
+                        <button type="submit"
37
+                                [routerLink]="['/account-details', accountDetails.id, 'view' ]"
38
+                                class="btn btn-info btn-sm">
39
+                            <fa-icon [icon]="'eye'"></fa-icon>
40
+                            <span class="d-none d-md-inline" jhiTranslate="entity.action.view">View</span>
41
+                        </button>
42
+                        <button type="submit"
43
+                                [routerLink]="['/account-details', accountDetails.id, 'edit']"
44
+                                class="btn btn-primary btn-sm">
45
+                            <fa-icon [icon]="'pencil-alt'"></fa-icon>
46
+                            <span class="d-none d-md-inline" jhiTranslate="entity.action.edit">Edit</span>
47
+                        </button>
48
+                        <button type="submit"
49
+                                [routerLink]="['/', { outlets: { popup: 'account-details/'+ accountDetails.id + '/delete'} }]"
50
+                                replaceUrl="true"
51
+                                queryParamsHandling="merge"
52
+                                class="btn btn-danger btn-sm">
53
+                            <fa-icon [icon]="'times'"></fa-icon>
54
+                            <span class="d-none d-md-inline" jhiTranslate="entity.action.delete">Delete</span>
55
+                        </button>
56
+                    </div>
57
+                </td>
58
+            </tr>
59
+            </tbody>
60
+        </table>
61
+    </div>
62
+</div>

+ 58
- 0
src/main/webapp/app/entities/account-details/account-details.component.ts View File

1
+import { Component, OnInit, OnDestroy } from '@angular/core';
2
+import { HttpErrorResponse, HttpResponse } from '@angular/common/http';
3
+import { Subscription } from 'rxjs';
4
+import { JhiEventManager, JhiAlertService } from 'ng-jhipster';
5
+
6
+import { IAccountDetails } from 'app/shared/model/account-details.model';
7
+import { Principal } from 'app/core';
8
+import { AccountDetailsService } from './account-details.service';
9
+
10
+@Component({
11
+    selector: 'jhi-account-details',
12
+    templateUrl: './account-details.component.html'
13
+})
14
+export class AccountDetailsComponent implements OnInit, OnDestroy {
15
+    accountDetails: IAccountDetails[];
16
+    currentAccount: any;
17
+    eventSubscriber: Subscription;
18
+
19
+    constructor(
20
+        private accountDetailsService: AccountDetailsService,
21
+        private jhiAlertService: JhiAlertService,
22
+        private eventManager: JhiEventManager,
23
+        private principal: Principal
24
+    ) {}
25
+
26
+    loadAll() {
27
+        this.accountDetailsService.query().subscribe(
28
+            (res: HttpResponse<IAccountDetails[]>) => {
29
+                this.accountDetails = res.body;
30
+            },
31
+            (res: HttpErrorResponse) => this.onError(res.message)
32
+        );
33
+    }
34
+
35
+    ngOnInit() {
36
+        this.loadAll();
37
+        this.principal.identity().then(account => {
38
+            this.currentAccount = account;
39
+        });
40
+        this.registerChangeInAccountDetails();
41
+    }
42
+
43
+    ngOnDestroy() {
44
+        this.eventManager.destroy(this.eventSubscriber);
45
+    }
46
+
47
+    trackId(index: number, item: IAccountDetails) {
48
+        return item.id;
49
+    }
50
+
51
+    registerChangeInAccountDetails() {
52
+        this.eventSubscriber = this.eventManager.subscribe('accountDetailsListModification', response => this.loadAll());
53
+    }
54
+
55
+    private onError(errorMessage: string) {
56
+        this.jhiAlertService.error(errorMessage, null, null);
57
+    }
58
+}

+ 35
- 0
src/main/webapp/app/entities/account-details/account-details.module.ts View File

1
+import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
2
+import { RouterModule } from '@angular/router';
3
+
4
+import { FaeBooSharedModule } from 'app/shared';
5
+import { FaeBooAdminModule } from 'app/admin/admin.module';
6
+import {
7
+    AccountDetailsComponent,
8
+    AccountDetailsDetailComponent,
9
+    AccountDetailsUpdateComponent,
10
+    AccountDetailsDeletePopupComponent,
11
+    AccountDetailsDeleteDialogComponent,
12
+    accountDetailsRoute,
13
+    accountDetailsPopupRoute
14
+} from './';
15
+
16
+const ENTITY_STATES = [...accountDetailsRoute, ...accountDetailsPopupRoute];
17
+
18
+@NgModule({
19
+    imports: [FaeBooSharedModule, FaeBooAdminModule, RouterModule.forChild(ENTITY_STATES)],
20
+    declarations: [
21
+        AccountDetailsComponent,
22
+        AccountDetailsDetailComponent,
23
+        AccountDetailsUpdateComponent,
24
+        AccountDetailsDeleteDialogComponent,
25
+        AccountDetailsDeletePopupComponent
26
+    ],
27
+    entryComponents: [
28
+        AccountDetailsComponent,
29
+        AccountDetailsUpdateComponent,
30
+        AccountDetailsDeleteDialogComponent,
31
+        AccountDetailsDeletePopupComponent
32
+    ],
33
+    schemas: [CUSTOM_ELEMENTS_SCHEMA]
34
+})
35
+export class FaeBooAccountDetailsModule {}

+ 93
- 0
src/main/webapp/app/entities/account-details/account-details.route.ts View File

1
+import { Injectable } from '@angular/core';
2
+import { HttpResponse } from '@angular/common/http';
3
+import { Resolve, ActivatedRouteSnapshot, RouterStateSnapshot, Routes } from '@angular/router';
4
+import { UserRouteAccessService } from 'app/core';
5
+import { Observable, of } from 'rxjs';
6
+import { filter, map } from 'rxjs/operators';
7
+import { AccountDetails } from 'app/shared/model/account-details.model';
8
+import { AccountDetailsService } from './account-details.service';
9
+import { AccountDetailsComponent } from './account-details.component';
10
+import { AccountDetailsDetailComponent } from './account-details-detail.component';
11
+import { AccountDetailsUpdateComponent } from './account-details-update.component';
12
+import { AccountDetailsDeletePopupComponent } from './account-details-delete-dialog.component';
13
+import { IAccountDetails } from 'app/shared/model/account-details.model';
14
+
15
+@Injectable({ providedIn: 'root' })
16
+export class AccountDetailsResolve implements Resolve<IAccountDetails> {
17
+    constructor(private service: AccountDetailsService) {}
18
+
19
+    resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<AccountDetails> {
20
+        const id = route.params['id'] ? route.params['id'] : null;
21
+        if (id) {
22
+            return this.service.find(id).pipe(
23
+                filter((response: HttpResponse<AccountDetails>) => response.ok),
24
+                map((accountDetails: HttpResponse<AccountDetails>) => accountDetails.body)
25
+            );
26
+        }
27
+        return of(new AccountDetails());
28
+    }
29
+}
30
+
31
+export const accountDetailsRoute: Routes = [
32
+    {
33
+        path: 'account-details',
34
+        component: AccountDetailsComponent,
35
+        data: {
36
+            authorities: ['ROLE_USER'],
37
+            pageTitle: 'faeBooApp.accountDetails.home.title'
38
+        },
39
+        canActivate: [UserRouteAccessService]
40
+    },
41
+    {
42
+        path: 'account-details/:id/view',
43
+        component: AccountDetailsDetailComponent,
44
+        resolve: {
45
+            accountDetails: AccountDetailsResolve
46
+        },
47
+        data: {
48
+            authorities: ['ROLE_USER'],
49
+            pageTitle: 'faeBooApp.accountDetails.home.title'
50
+        },
51
+        canActivate: [UserRouteAccessService]
52
+    },
53
+    {
54
+        path: 'account-details/new',
55
+        component: AccountDetailsUpdateComponent,
56
+        resolve: {
57
+            accountDetails: AccountDetailsResolve
58
+        },
59
+        data: {
60
+            authorities: ['ROLE_USER'],
61
+            pageTitle: 'faeBooApp.accountDetails.home.title'
62
+        },
63
+        canActivate: [UserRouteAccessService]
64
+    },
65
+    {
66
+        path: 'account-details/:id/edit',
67
+        component: AccountDetailsUpdateComponent,
68
+        resolve: {
69
+            accountDetails: AccountDetailsResolve
70
+        },
71
+        data: {
72
+            authorities: ['ROLE_USER'],
73
+            pageTitle: 'faeBooApp.accountDetails.home.title'
74
+        },
75
+        canActivate: [UserRouteAccessService]
76
+    }
77
+];
78
+
79
+export const accountDetailsPopupRoute: Routes = [
80
+    {
81
+        path: 'account-details/:id/delete',
82
+        component: AccountDetailsDeletePopupComponent,
83
+        resolve: {
84
+            accountDetails: AccountDetailsResolve
85
+        },
86
+        data: {
87
+            authorities: ['ROLE_USER'],
88
+            pageTitle: 'faeBooApp.accountDetails.home.title'
89
+        },
90
+        canActivate: [UserRouteAccessService],
91
+        outlet: 'popup'
92
+    }
93
+];

+ 38
- 0
src/main/webapp/app/entities/account-details/account-details.service.ts View File

1
+import { Injectable } from '@angular/core';
2
+import { HttpClient, HttpResponse } from '@angular/common/http';
3
+import { Observable } from 'rxjs';
4
+
5
+import { SERVER_API_URL } from 'app/app.constants';
6
+import { createRequestOption } from 'app/shared';
7
+import { IAccountDetails } from 'app/shared/model/account-details.model';
8
+
9
+type EntityResponseType = HttpResponse<IAccountDetails>;
10
+type EntityArrayResponseType = HttpResponse<IAccountDetails[]>;
11
+
12
+@Injectable({ providedIn: 'root' })
13
+export class AccountDetailsService {
14
+    public resourceUrl = SERVER_API_URL + 'api/account-details';
15
+
16
+    constructor(private http: HttpClient) {}
17
+
18
+    create(accountDetails: IAccountDetails): Observable<EntityResponseType> {
19
+        return this.http.post<IAccountDetails>(this.resourceUrl, accountDetails, { observe: 'response' });
20
+    }
21
+
22
+    update(accountDetails: IAccountDetails): Observable<EntityResponseType> {
23
+        return this.http.put<IAccountDetails>(this.resourceUrl, accountDetails, { observe: 'response' });
24
+    }
25
+
26
+    find(id: number): Observable<EntityResponseType> {
27
+        return this.http.get<IAccountDetails>(`${this.resourceUrl}/${id}`, { observe: 'response' });
28
+    }
29
+
30
+    query(req?: any): Observable<EntityArrayResponseType> {
31
+        const options = createRequestOption(req);
32
+        return this.http.get<IAccountDetails[]>(this.resourceUrl, { params: options, observe: 'response' });
33
+    }
34
+
35
+    delete(id: number): Observable<HttpResponse<any>> {
36
+        return this.http.delete<any>(`${this.resourceUrl}/${id}`, { observe: 'response' });
37
+    }
38
+}

+ 6
- 0
src/main/webapp/app/entities/account-details/index.ts View File

1
+export * from './account-details.service';
2
+export * from './account-details-update.component';
3
+export * from './account-details-delete-dialog.component';
4
+export * from './account-details-detail.component';
5
+export * from './account-details.component';
6
+export * from './account-details.route';

+ 19
- 0
src/main/webapp/app/entities/album/album-delete-dialog.component.html View File

1
+<form name="deleteForm" (ngSubmit)="confirmDelete(album.id)">
2
+    <div class="modal-header">
3
+        <h4 class="modal-title" jhiTranslate="entity.delete.title">Confirm delete operation</h4>
4
+        <button type="button" class="close" data-dismiss="modal" aria-hidden="true"
5
+                (click)="clear()">&times;</button>
6
+    </div>
7
+    <div class="modal-body">
8
+        <jhi-alert-error></jhi-alert-error>
9
+        <p id="jhi-delete-album-heading" jhiTranslate="faeBooApp.album.delete.question" translateValues="{id: '{{album.id}}'}">Are you sure you want to delete this Album?</p>
10
+    </div>
11
+    <div class="modal-footer">
12
+        <button type="button" class="btn btn-secondary" data-dismiss="modal" (click)="clear()">
13
+            <fa-icon [icon]="'ban'"></fa-icon>&nbsp;<span jhiTranslate="entity.action.cancel">Cancel</span>
14
+        </button>
15
+        <button id="jhi-confirm-delete-album" type="submit" class="btn btn-danger">
16
+            <fa-icon [icon]="'times'"></fa-icon>&nbsp;<span jhiTranslate="entity.action.delete">Delete</span>
17
+        </button>
18
+    </div>
19
+</form>

+ 65
- 0
src/main/webapp/app/entities/album/album-delete-dialog.component.ts View File

1
+import { Component, OnInit, OnDestroy } from '@angular/core';
2
+import { ActivatedRoute, Router } from '@angular/router';
3
+
4
+import { NgbActiveModal, NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap';
5
+import { JhiEventManager } from 'ng-jhipster';
6
+
7
+import { IAlbum } from 'app/shared/model/album.model';
8
+import { AlbumService } from './album.service';
9
+
10
+@Component({
11
+    selector: 'jhi-album-delete-dialog',
12
+    templateUrl: './album-delete-dialog.component.html'
13
+})
14
+export class AlbumDeleteDialogComponent {
15
+    album: IAlbum;
16
+
17
+    constructor(private albumService: AlbumService, public activeModal: NgbActiveModal, private eventManager: JhiEventManager) {}
18
+
19
+    clear() {
20
+        this.activeModal.dismiss('cancel');
21
+    }
22
+
23
+    confirmDelete(id: number) {
24
+        this.albumService.delete(id).subscribe(response => {
25
+            this.eventManager.broadcast({
26
+                name: 'albumListModification',
27
+                content: 'Deleted an album'
28
+            });
29
+            this.activeModal.dismiss(true);
30
+        });
31
+    }
32
+}
33
+
34
+@Component({
35
+    selector: 'jhi-album-delete-popup',
36
+    template: ''
37
+})
38
+export class AlbumDeletePopupComponent implements OnInit, OnDestroy {
39
+    private ngbModalRef: NgbModalRef;
40
+
41
+    constructor(private activatedRoute: ActivatedRoute, private router: Router, private modalService: NgbModal) {}
42
+
43
+    ngOnInit() {
44
+        this.activatedRoute.data.subscribe(({ album }) => {
45
+            setTimeout(() => {
46
+                this.ngbModalRef = this.modalService.open(AlbumDeleteDialogComponent as Component, { size: 'lg', backdrop: 'static' });
47
+                this.ngbModalRef.componentInstance.album = album;
48
+                this.ngbModalRef.result.then(
49
+                    result => {
50
+                        this.router.navigate([{ outlets: { popup: null } }], { replaceUrl: true, queryParamsHandling: 'merge' });
51
+                        this.ngbModalRef = null;
52
+                    },
53
+                    reason => {
54
+                        this.router.navigate([{ outlets: { popup: null } }], { replaceUrl: true, queryParamsHandling: 'merge' });
55
+                        this.ngbModalRef = null;
56
+                    }
57
+                );
58
+            }, 0);
59
+        });
60
+    }
61
+
62
+    ngOnDestroy() {
63
+        this.ngbModalRef = null;
64
+    }
65
+}

+ 35
- 0
src/main/webapp/app/entities/album/album-detail.component.html View File

1
+<div class="row justify-content-center">
2
+    <div class="col-8">
3
+        <div *ngIf="album">
4
+            <h2><span jhiTranslate="faeBooApp.album.detail.title">Album</span> {{album.id}}</h2>
5
+            <hr>
6
+            <jhi-alert-error></jhi-alert-error>
7
+            <dl class="row-md jh-entity-details">
8
+                <dt><span jhiTranslate="faeBooApp.album.name">Name</span></dt>
9
+                <dd>
10
+                    <span>{{album.name}}</span>
11
+                </dd>
12
+                <dt><span jhiTranslate="faeBooApp.album.description">Description</span></dt>
13
+                <dd>
14
+                    <span>{{album.description}}</span>
15
+                </dd>
16
+                <dt><span jhiTranslate="faeBooApp.album.owner">Owner</span></dt>
17
+                <dd>
18
+                    {{album.owner?.email}}
19
+                </dd>
20
+            </dl>
21
+
22
+            <button type="submit"
23
+                    (click)="previousState()"
24
+                    class="btn btn-info">
25
+                <fa-icon [icon]="'arrow-left'"></fa-icon>&nbsp;<span jhiTranslate="entity.action.back"> Back</span>
26
+            </button>
27
+
28
+            <button type="button"
29
+                    [routerLink]="['/album', album.id, 'edit']"
30
+                    class="btn btn-primary">
31
+                <fa-icon [icon]="'pencil-alt'"></fa-icon>&nbsp;<span jhiTranslate="entity.action.edit"> Edit</span>
32
+            </button>
33
+        </div>
34
+    </div>
35
+</div>

+ 24
- 0
src/main/webapp/app/entities/album/album-detail.component.ts View File

1
+import { Component, OnInit } from '@angular/core';
2
+import { ActivatedRoute } from '@angular/router';
3
+
4
+import { IAlbum } from 'app/shared/model/album.model';
5
+
6
+@Component({
7
+    selector: 'jhi-album-detail',
8
+    templateUrl: './album-detail.component.html'
9
+})
10
+export class AlbumDetailComponent implements OnInit {
11
+    album: IAlbum;
12
+
13
+    constructor(private activatedRoute: ActivatedRoute) {}
14
+
15
+    ngOnInit() {
16
+        this.activatedRoute.data.subscribe(({ album }) => {
17
+            this.album = album;
18
+        });
19
+    }
20
+
21
+    previousState() {
22
+        window.history.back();
23
+    }
24
+}

+ 41
- 0
src/main/webapp/app/entities/album/album-update.component.html View File

1
+<div class="row justify-content-center">
2
+    <div class="col-8">
3
+        <form name="editForm" role="form" novalidate (ngSubmit)="save()" #editForm="ngForm">
4
+            <h2 id="jhi-album-heading" jhiTranslate="faeBooApp.album.home.createOrEditLabel">Create or edit a Album</h2>
5
+            <div>
6
+                <jhi-alert-error></jhi-alert-error>
7
+                <div class="form-group" [hidden]="!album.id">
8
+                    <label for="id" jhiTranslate="global.field.id">ID</label>
9
+                    <input type="text" class="form-control" id="id" name="id"
10
+                        [(ngModel)]="album.id" readonly />
11
+                </div>
12
+                <div class="form-group">
13
+                    <label class="form-control-label" jhiTranslate="faeBooApp.album.name" for="field_name">Name</label>
14
+                    <input type="text" class="form-control" name="name" id="field_name"
15
+                        [(ngModel)]="album.name" />
16
+                </div>
17
+                <div class="form-group">
18
+                    <label class="form-control-label" jhiTranslate="faeBooApp.album.description" for="field_description">Description</label>
19
+                    <input type="text" class="form-control" name="description" id="field_description"
20
+                        [(ngModel)]="album.description" />
21
+                </div>
22
+
23
+                <div class="form-group">
24
+                    <label class="form-control-label" jhiTranslate="faeBooApp.album.owner" for="field_owner">Owner</label>
25
+                    <select class="form-control" id="field_owner" name="owner" [(ngModel)]="album.owner" >
26
+                        <option [ngValue]="null"></option>
27
+                        <option [ngValue]="userOption.id === album.owner?.id ? album.owner : userOption" *ngFor="let userOption of users; trackBy: trackUserById">{{userOption.email}}</option>
28
+                    </select>
29
+                </div>
30
+            </div>
31
+            <div>
32
+                <button type="button" id="cancel-save" class="btn btn-secondary"  (click)="previousState()">
33
+                    <fa-icon [icon]="'ban'"></fa-icon>&nbsp;<span jhiTranslate="entity.action.cancel">Cancel</span>
34
+                </button>
35
+                <button type="submit" id="save-entity" [disabled]="editForm.form.invalid || isSaving" class="btn btn-primary">
36
+                    <fa-icon [icon]="'save'"></fa-icon>&nbsp;<span jhiTranslate="entity.action.save">Save</span>
37
+                </button>
38
+            </div>
39
+        </form>
40
+    </div>
41
+</div>

+ 74
- 0
src/main/webapp/app/entities/album/album-update.component.ts View File

1
+import { Component, OnInit } from '@angular/core';
2
+import { ActivatedRoute } from '@angular/router';
3
+import { HttpResponse, HttpErrorResponse } from '@angular/common/http';
4
+import { Observable } from 'rxjs';
5
+import { JhiAlertService } from 'ng-jhipster';
6
+
7
+import { IAlbum } from 'app/shared/model/album.model';
8
+import { AlbumService } from './album.service';
9
+import { IUser, UserService } from 'app/core';
10
+
11
+@Component({
12
+    selector: 'jhi-album-update',
13
+    templateUrl: './album-update.component.html'
14
+})
15
+export class AlbumUpdateComponent implements OnInit {
16
+    album: IAlbum;
17
+    isSaving: boolean;
18
+
19
+    users: IUser[];
20
+
21
+    constructor(
22
+        private jhiAlertService: JhiAlertService,
23
+        private albumService: AlbumService,
24
+        private userService: UserService,
25
+        private activatedRoute: ActivatedRoute
26
+    ) {}
27
+
28
+    ngOnInit() {
29
+        this.isSaving = false;
30
+        this.activatedRoute.data.subscribe(({ album }) => {
31
+            this.album = album;
32
+        });
33
+        this.userService.query().subscribe(
34
+            (res: HttpResponse<IUser[]>) => {
35
+                this.users = res.body;
36
+            },
37
+            (res: HttpErrorResponse) => this.onError(res.message)
38
+        );
39
+    }
40
+
41
+    previousState() {
42
+        window.history.back();
43
+    }
44
+
45
+    save() {
46
+        this.isSaving = true;
47
+        if (this.album.id !== undefined) {
48
+            this.subscribeToSaveResponse(this.albumService.update(this.album));
49
+        } else {
50
+            this.subscribeToSaveResponse(this.albumService.create(this.album));
51
+        }
52
+    }
53
+
54
+    private subscribeToSaveResponse(result: Observable<HttpResponse<IAlbum>>) {
55
+        result.subscribe((res: HttpResponse<IAlbum>) => this.onSaveSuccess(), (res: HttpErrorResponse) => this.onSaveError());
56
+    }
57
+
58
+    private onSaveSuccess() {
59
+        this.isSaving = false;
60
+        this.previousState();
61
+    }
62
+
63
+    private onSaveError() {
64
+        this.isSaving = false;
65
+    }
66
+
67
+    private onError(errorMessage: string) {
68
+        this.jhiAlertService.error(errorMessage, null, null);
69
+    }
70
+
71
+    trackUserById(index: number, item: IUser) {
72
+        return item.id;
73
+    }
74
+}

+ 60
- 0
src/main/webapp/app/entities/album/album.component.html View File

1
+<div>
2
+    <h2 id="page-heading">
3
+        <span jhiTranslate="faeBooApp.album.home.title">Albums</span>
4
+        <button id="jh-create-entity" class="btn btn-primary float-right jh-create-entity create-album" [routerLink]="['/album/new']">
5
+            <fa-icon [icon]="'plus'"></fa-icon>
6
+            <span  jhiTranslate="faeBooApp.album.home.createLabel">
7
+            Create new Album
8
+            </span>
9
+        </button>
10
+    </h2>
11
+    <jhi-alert></jhi-alert>
12
+    <br/>
13
+    <div class="table-responsive" *ngIf="albums">
14
+        <table class="table table-striped">
15
+            <thead>
16
+            <tr>
17
+            <th><span jhiTranslate="global.field.id">ID</span></th>
18
+            <th><span jhiTranslate="faeBooApp.album.name">Name</span></th>
19
+            <th><span jhiTranslate="faeBooApp.album.description">Description</span></th>
20
+            <th><span jhiTranslate="faeBooApp.album.owner">Owner</span></th>
21
+            <th></th>
22
+            </tr>
23
+            </thead>
24
+            <tbody>
25
+            <tr *ngFor="let album of albums ;trackBy: trackId">
26
+                <td><a [routerLink]="['/album', album.id, 'view' ]">{{album.id}}</a></td>
27
+                <td>{{album.name}}</td>
28
+                <td>{{album.description}}</td>
29
+                <td>
30
+                    {{album.owner?.email}}
31
+                </td>
32
+                <td class="text-right">
33
+                    <div class="btn-group flex-btn-group-container">
34
+                        <button type="submit"
35
+                                [routerLink]="['/album', album.id, 'view' ]"
36
+                                class="btn btn-info btn-sm">
37
+                            <fa-icon [icon]="'eye'"></fa-icon>
38
+                            <span class="d-none d-md-inline" jhiTranslate="entity.action.view">View</span>
39
+                        </button>
40
+                        <button type="submit"
41
+                                [routerLink]="['/album', album.id, 'edit']"
42
+                                class="btn btn-primary btn-sm">
43
+                            <fa-icon [icon]="'pencil-alt'"></fa-icon>
44
+                            <span class="d-none d-md-inline" jhiTranslate="entity.action.edit">Edit</span>
45
+                        </button>
46
+                        <button type="submit"
47
+                                [routerLink]="['/', { outlets: { popup: 'album/'+ album.id + '/delete'} }]"
48
+                                replaceUrl="true"
49
+                                queryParamsHandling="merge"
50
+                                class="btn btn-danger btn-sm">
51
+                            <fa-icon [icon]="'times'"></fa-icon>
52
+                            <span class="d-none d-md-inline" jhiTranslate="entity.action.delete">Delete</span>
53
+                        </button>
54
+                    </div>
55
+                </td>
56
+            </tr>
57
+            </tbody>
58
+        </table>
59
+    </div>
60
+</div>

+ 58
- 0
src/main/webapp/app/entities/album/album.component.ts View File

1
+import { Component, OnInit, OnDestroy } from '@angular/core';
2
+import { HttpErrorResponse, HttpResponse } from '@angular/common/http';
3
+import { Subscription } from 'rxjs';
4
+import { JhiEventManager, JhiAlertService } from 'ng-jhipster';
5
+
6
+import { IAlbum } from 'app/shared/model/album.model';
7
+import { Principal } from 'app/core';
8
+import { AlbumService } from './album.service';
9
+
10
+@Component({
11
+    selector: 'jhi-album',
12
+    templateUrl: './album.component.html'
13
+})
14
+export class AlbumComponent implements OnInit, OnDestroy {
15
+    albums: IAlbum[];
16
+    currentAccount: any;
17
+    eventSubscriber: Subscription;
18
+
19
+    constructor(
20
+        private albumService: AlbumService,
21
+        private jhiAlertService: JhiAlertService,
22
+        private eventManager: JhiEventManager,
23
+        private principal: Principal
24
+    ) {}
25
+
26
+    loadAll() {
27
+        this.albumService.query().subscribe(
28
+            (res: HttpResponse<IAlbum[]>) => {
29
+                this.albums = res.body;
30
+            },
31
+            (res: HttpErrorResponse) => this.onError(res.message)
32
+        );
33
+    }
34
+
35
+    ngOnInit() {
36
+        this.loadAll();
37
+        this.principal.identity().then(account => {
38
+            this.currentAccount = account;
39
+        });
40
+        this.registerChangeInAlbums();
41
+    }
42
+
43
+    ngOnDestroy() {
44
+        this.eventManager.destroy(this.eventSubscriber);
45
+    }
46
+
47
+    trackId(index: number, item: IAlbum) {
48
+        return item.id;
49
+    }
50
+
51
+    registerChangeInAlbums() {
52
+        this.eventSubscriber = this.eventManager.subscribe('albumListModification', response => this.loadAll());
53
+    }
54
+
55
+    private onError(errorMessage: string) {
56
+        this.jhiAlertService.error(errorMessage, null, null);
57
+    }
58
+}

+ 24
- 0
src/main/webapp/app/entities/album/album.module.ts View File

1
+import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
2
+import { RouterModule } from '@angular/router';
3
+
4
+import { FaeBooSharedModule } from 'app/shared';
5
+import { FaeBooAdminModule } from 'app/admin/admin.module';
6
+import {
7
+    AlbumComponent,
8
+    AlbumDetailComponent,
9
+    AlbumUpdateComponent,
10
+    AlbumDeletePopupComponent,
11
+    AlbumDeleteDialogComponent,
12
+    albumRoute,
13
+    albumPopupRoute
14
+} from './';
15
+
16
+const ENTITY_STATES = [...albumRoute, ...albumPopupRoute];
17
+
18
+@NgModule({
19
+    imports: [FaeBooSharedModule, FaeBooAdminModule, RouterModule.forChild(ENTITY_STATES)],
20
+    declarations: [AlbumComponent, AlbumDetailComponent, AlbumUpdateComponent, AlbumDeleteDialogComponent, AlbumDeletePopupComponent],
21
+    entryComponents: [AlbumComponent, AlbumUpdateComponent, AlbumDeleteDialogComponent, AlbumDeletePopupComponent],
22
+    schemas: [CUSTOM_ELEMENTS_SCHEMA]
23
+})
24
+export class FaeBooAlbumModule {}

+ 93
- 0
src/main/webapp/app/entities/album/album.route.ts View File

1
+import { Injectable } from '@angular/core';
2
+import { HttpResponse } from '@angular/common/http';
3
+import { Resolve, ActivatedRouteSnapshot, RouterStateSnapshot, Routes } from '@angular/router';
4
+import { UserRouteAccessService } from 'app/core';
5
+import { Observable, of } from 'rxjs';
6
+import { filter, map } from 'rxjs/operators';
7
+import { Album } from 'app/shared/model/album.model';
8
+import { AlbumService } from './album.service';
9
+import { AlbumComponent } from './album.component';
10
+import { AlbumDetailComponent } from './album-detail.component';
11
+import { AlbumUpdateComponent } from './album-update.component';
12
+import { AlbumDeletePopupComponent } from './album-delete-dialog.component';
13
+import { IAlbum } from 'app/shared/model/album.model';
14
+
15
+@Injectable({ providedIn: 'root' })
16
+export class AlbumResolve implements Resolve<IAlbum> {
17
+    constructor(private service: AlbumService) {}
18
+
19
+    resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<Album> {
20
+        const id = route.params['id'] ? route.params['id'] : null;
21
+        if (id) {
22
+            return this.service.find(id).pipe(
23
+                filter((response: HttpResponse<Album>) => response.ok),
24
+                map((album: HttpResponse<Album>) => album.body)
25
+            );
26
+        }
27
+        return of(new Album());
28
+    }
29
+}
30
+
31
+export const albumRoute: Routes = [
32
+    {
33
+        path: 'album',
34
+        component: AlbumComponent,
35
+        data: {
36
+            authorities: ['ROLE_USER'],
37
+            pageTitle: 'faeBooApp.album.home.title'
38
+        },
39
+        canActivate: [UserRouteAccessService]
40
+    },
41
+    {
42
+        path: 'album/:id/view',
43
+        component: AlbumDetailComponent,
44
+        resolve: {
45
+            album: AlbumResolve
46
+        },
47
+        data: {
48
+            authorities: ['ROLE_USER'],
49
+            pageTitle: 'faeBooApp.album.home.title'
50
+        },
51
+        canActivate: [UserRouteAccessService]
52
+    },
53
+    {
54
+        path: 'album/new',
55
+        component: AlbumUpdateComponent,
56
+        resolve: {
57
+            album: AlbumResolve
58
+        },
59
+        data: {
60
+            authorities: ['ROLE_USER'],
61
+            pageTitle: 'faeBooApp.album.home.title'
62
+        },
63
+        canActivate: [UserRouteAccessService]
64
+    },
65
+    {
66
+        path: 'album/:id/edit',
67
+        component: AlbumUpdateComponent,
68
+        resolve: {
69
+            album: AlbumResolve
70
+        },
71
+        data: {
72
+            authorities: ['ROLE_USER'],
73
+            pageTitle: 'faeBooApp.album.home.title'
74
+        },
75
+        canActivate: [UserRouteAccessService]
76
+    }
77
+];
78
+
79
+export const albumPopupRoute: Routes = [
80
+    {
81
+        path: 'album/:id/delete',
82
+        component: AlbumDeletePopupComponent,
83
+        resolve: {
84
+            album: AlbumResolve
85
+        },
86
+        data: {
87
+            authorities: ['ROLE_USER'],
88
+            pageTitle: 'faeBooApp.album.home.title'
89
+        },
90
+        canActivate: [UserRouteAccessService],
91
+        outlet: 'popup'
92
+    }
93
+];

+ 38
- 0
src/main/webapp/app/entities/album/album.service.ts View File

1
+import { Injectable } from '@angular/core';
2
+import { HttpClient, HttpResponse } from '@angular/common/http';
3
+import { Observable } from 'rxjs';
4
+
5
+import { SERVER_API_URL } from 'app/app.constants';
6
+import { createRequestOption } from 'app/shared';
7
+import { IAlbum } from 'app/shared/model/album.model';
8
+
9
+type EntityResponseType = HttpResponse<IAlbum>;
10
+type EntityArrayResponseType = HttpResponse<IAlbum[]>;
11
+
12
+@Injectable({ providedIn: 'root' })
13
+export class AlbumService {
14
+    public resourceUrl = SERVER_API_URL + 'api/albums';
15
+
16
+    constructor(private http: HttpClient) {}
17
+
18
+    create(album: IAlbum): Observable<EntityResponseType> {
19
+        return this.http.post<IAlbum>(this.resourceUrl, album, { observe: 'response' });
20
+    }
21
+
22
+    update(album: IAlbum): Observable<EntityResponseType> {
23
+        return this.http.put<IAlbum>(this.resourceUrl, album, { observe: 'response' });
24
+    }
25
+
26
+    find(id: number): Observable<EntityResponseType> {
27
+        return this.http.get<IAlbum>(`${this.resourceUrl}/${id}`, { observe: 'response' });
28
+    }
29
+
30
+    query(req?: any): Observable<EntityArrayResponseType> {
31
+        const options = createRequestOption(req);
32
+        return this.http.get<IAlbum[]>(this.resourceUrl, { params: options, observe: 'response' });
33
+    }
34
+
35
+    delete(id: number): Observable<HttpResponse<any>> {
36
+        return this.http.delete<any>(`${this.resourceUrl}/${id}`, { observe: 'response' });
37
+    }
38
+}

+ 6
- 0
src/main/webapp/app/entities/album/index.ts View File

1
+export * from './album.service';
2
+export * from './album-update.component';
3
+export * from './album-delete-dialog.component';
4
+export * from './album-detail.component';
5
+export * from './album.component';
6
+export * from './album.route';

+ 19
- 0
src/main/webapp/app/entities/comment/comment-delete-dialog.component.html View File

1
+<form name="deleteForm" (ngSubmit)="confirmDelete(comment.id)">
2
+    <div class="modal-header">
3
+        <h4 class="modal-title" jhiTranslate="entity.delete.title">Confirm delete operation</h4>
4
+        <button type="button" class="close" data-dismiss="modal" aria-hidden="true"
5
+                (click)="clear()">&times;</button>
6
+    </div>
7
+    <div class="modal-body">
8
+        <jhi-alert-error></jhi-alert-error>
9
+        <p id="jhi-delete-comment-heading" jhiTranslate="faeBooApp.comment.delete.question" translateValues="{id: '{{comment.id}}'}">Are you sure you want to delete this Comment?</p>
10
+    </div>
11
+    <div class="modal-footer">
12
+        <button type="button" class="btn btn-secondary" data-dismiss="modal" (click)="clear()">
13
+            <fa-icon [icon]="'ban'"></fa-icon>&nbsp;<span jhiTranslate="entity.action.cancel">Cancel</span>
14
+        </button>
15
+        <button id="jhi-confirm-delete-comment" type="submit" class="btn btn-danger">
16
+            <fa-icon [icon]="'times'"></fa-icon>&nbsp;<span jhiTranslate="entity.action.delete">Delete</span>
17
+        </button>
18
+    </div>
19
+</form>

+ 65
- 0
src/main/webapp/app/entities/comment/comment-delete-dialog.component.ts View File

1
+import { Component, OnInit, OnDestroy } from '@angular/core';
2
+import { ActivatedRoute, Router } from '@angular/router';
3
+
4
+import { NgbActiveModal, NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap';
5
+import { JhiEventManager } from 'ng-jhipster';
6
+
7
+import { IComment } from 'app/shared/model/comment.model';
8
+import { CommentService } from './comment.service';
9
+
10
+@Component({
11
+    selector: 'jhi-comment-delete-dialog',
12
+    templateUrl: './comment-delete-dialog.component.html'
13
+})
14
+export class CommentDeleteDialogComponent {
15
+    comment: IComment;
16
+
17
+    constructor(private commentService: CommentService, public activeModal: NgbActiveModal, private eventManager: JhiEventManager) {}
18
+
19
+    clear() {
20
+        this.activeModal.dismiss('cancel');
21
+    }
22
+
23
+    confirmDelete(id: number) {
24
+        this.commentService.delete(id).subscribe(response => {
25
+            this.eventManager.broadcast({
26
+                name: 'commentListModification',
27
+                content: 'Deleted an comment'
28
+            });
29
+            this.activeModal.dismiss(true);
30
+        });
31
+    }
32
+}
33
+
34
+@Component({
35
+    selector: 'jhi-comment-delete-popup',
36
+    template: ''
37
+})
38
+export class CommentDeletePopupComponent implements OnInit, OnDestroy {
39
+    private ngbModalRef: NgbModalRef;
40
+
41
+    constructor(private activatedRoute: ActivatedRoute, private router: Router, private modalService: NgbModal) {}
42
+
43
+    ngOnInit() {
44
+        this.activatedRoute.data.subscribe(({ comment }) => {
45
+            setTimeout(() => {
46
+                this.ngbModalRef = this.modalService.open(CommentDeleteDialogComponent as Component, { size: 'lg', backdrop: 'static' });
47
+                this.ngbModalRef.componentInstance.comment = comment;
48
+                this.ngbModalRef.result.then(
49
+                    result => {
50
+                        this.router.navigate([{ outlets: { popup: null } }], { replaceUrl: true, queryParamsHandling: 'merge' });
51
+                        this.ngbModalRef = null;
52
+                    },
53
+                    reason => {
54
+                        this.router.navigate([{ outlets: { popup: null } }], { replaceUrl: true, queryParamsHandling: 'merge' });
55
+                        this.ngbModalRef = null;
56
+                    }
57
+                );
58
+            }, 0);
59
+        });
60
+    }
61
+
62
+    ngOnDestroy() {
63
+        this.ngbModalRef = null;
64
+    }
65
+}

+ 45
- 0
src/main/webapp/app/entities/comment/comment-detail.component.html View File

1
+<div class="row justify-content-center">
2
+    <div class="col-8">
3
+        <div *ngIf="comment">
4
+            <h2><span jhiTranslate="faeBooApp.comment.detail.title">Comment</span> {{comment.id}}</h2>
5
+            <hr>
6
+            <jhi-alert-error></jhi-alert-error>
7
+            <dl class="row-md jh-entity-details">
8
+                <dt><span jhiTranslate="faeBooApp.comment.content">Content</span></dt>
9
+                <dd>
10
+                    <span>{{comment.content}}</span>
11
+                </dd>
12
+                <dt><span jhiTranslate="faeBooApp.comment.likes">Likes</span></dt>
13
+                <dd>
14
+                    <span>{{comment.likes}}</span>
15
+                </dd>
16
+                <dt><span jhiTranslate="faeBooApp.comment.dislikes">Dislikes</span></dt>
17
+                <dd>
18
+                    <span>{{comment.dislikes}}</span>
19
+                </dd>
20
+                <dt><span jhiTranslate="faeBooApp.comment.commenter">Commenter</span></dt>
21
+                <dd>
22
+                    {{comment.commenter?.email}}
23
+                </dd>
24
+                <dt><span jhiTranslate="faeBooApp.comment.post">Post</span></dt>
25
+                <dd>
26
+                    <div *ngIf="comment.post">
27
+                        <a [routerLink]="['/post', comment.post?.id, 'view']">{{comment.post?.id}}</a>
28
+                    </div>
29
+                </dd>
30
+            </dl>
31
+
32
+            <button type="submit"
33
+                    (click)="previousState()"
34
+                    class="btn btn-info">
35
+                <fa-icon [icon]="'arrow-left'"></fa-icon>&nbsp;<span jhiTranslate="entity.action.back"> Back</span>
36
+            </button>
37
+
38
+            <button type="button"
39
+                    [routerLink]="['/comment', comment.id, 'edit']"
40
+                    class="btn btn-primary">
41
+                <fa-icon [icon]="'pencil-alt'"></fa-icon>&nbsp;<span jhiTranslate="entity.action.edit"> Edit</span>
42
+            </button>
43
+        </div>
44
+    </div>
45
+</div>

+ 0
- 0
src/main/webapp/app/entities/comment/comment-detail.component.ts View File


Some files were not shown because too many files changed in this diff