瀏覽代碼

working branch with entities added

Jonathan Hinds 5 年之前
父節點
當前提交
0610195eb7
共有 100 個文件被更改,包括 5257 次插入4 次删除
  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. 68
    3
      jdl.jh
  10. 129
    0
      src/main/java/rocks/zipcode/io/domain/AccountDetails.java
  11. 114
    0
      src/main/java/rocks/zipcode/io/domain/Album.java
  12. 148
    0
      src/main/java/rocks/zipcode/io/domain/Comment.java
  13. 114
    0
      src/main/java/rocks/zipcode/io/domain/Friend.java
  14. 146
    0
      src/main/java/rocks/zipcode/io/domain/Photo.java
  15. 148
    0
      src/main/java/rocks/zipcode/io/domain/Post.java
  16. 112
    0
      src/main/java/rocks/zipcode/io/domain/Profile.java
  17. 114
    0
      src/main/java/rocks/zipcode/io/domain/Video.java
  18. 15
    0
      src/main/java/rocks/zipcode/io/repository/AccountDetailsRepository.java
  19. 19
    0
      src/main/java/rocks/zipcode/io/repository/AlbumRepository.java
  20. 19
    0
      src/main/java/rocks/zipcode/io/repository/CommentRepository.java
  21. 22
    0
      src/main/java/rocks/zipcode/io/repository/FriendRepository.java
  22. 30
    0
      src/main/java/rocks/zipcode/io/repository/PhotoRepository.java
  23. 19
    0
      src/main/java/rocks/zipcode/io/repository/PostRepository.java
  24. 15
    0
      src/main/java/rocks/zipcode/io/repository/ProfileRepository.java
  25. 15
    0
      src/main/java/rocks/zipcode/io/repository/VideoRepository.java
  26. 119
    0
      src/main/java/rocks/zipcode/io/web/rest/AccountDetailsResource.java
  27. 119
    0
      src/main/java/rocks/zipcode/io/web/rest/AlbumResource.java
  28. 119
    0
      src/main/java/rocks/zipcode/io/web/rest/CommentResource.java
  29. 119
    0
      src/main/java/rocks/zipcode/io/web/rest/FriendResource.java
  30. 120
    0
      src/main/java/rocks/zipcode/io/web/rest/PhotoResource.java
  31. 119
    0
      src/main/java/rocks/zipcode/io/web/rest/PostResource.java
  32. 119
    0
      src/main/java/rocks/zipcode/io/web/rest/ProfileResource.java
  33. 119
    0
      src/main/java/rocks/zipcode/io/web/rest/VideoResource.java
  34. 43
    0
      src/main/resources/config/liquibase/changelog/20190102220056_added_entity_AccountDetails.xml
  35. 18
    0
      src/main/resources/config/liquibase/changelog/20190102220056_added_entity_constraints_AccountDetails.xml
  36. 39
    0
      src/main/resources/config/liquibase/changelog/20190102220057_added_entity_Profile.xml
  37. 18
    0
      src/main/resources/config/liquibase/changelog/20190102220057_added_entity_constraints_Profile.xml
  38. 41
    0
      src/main/resources/config/liquibase/changelog/20190102220058_added_entity_Friend.xml
  39. 24
    0
      src/main/resources/config/liquibase/changelog/20190102220058_added_entity_constraints_Friend.xml
  40. 41
    0
      src/main/resources/config/liquibase/changelog/20190102220059_added_entity_Album.xml
  41. 18
    0
      src/main/resources/config/liquibase/changelog/20190102220059_added_entity_constraints_Album.xml
  42. 52
    0
      src/main/resources/config/liquibase/changelog/20190102220100_added_entity_Photo.xml
  43. 29
    0
      src/main/resources/config/liquibase/changelog/20190102220100_added_entity_constraints_Photo.xml
  44. 41
    0
      src/main/resources/config/liquibase/changelog/20190102220101_added_entity_Video.xml
  45. 18
    0
      src/main/resources/config/liquibase/changelog/20190102220101_added_entity_constraints_Video.xml
  46. 49
    0
      src/main/resources/config/liquibase/changelog/20190102220102_added_entity_Post.xml
  47. 18
    0
      src/main/resources/config/liquibase/changelog/20190102220102_added_entity_constraints_Post.xml
  48. 49
    0
      src/main/resources/config/liquibase/changelog/20190102220103_added_entity_Comment.xml
  49. 24
    0
      src/main/resources/config/liquibase/changelog/20190102220103_added_entity_constraints_Comment.xml
  50. 16
    0
      src/main/resources/config/liquibase/master.xml
  51. 1
    1
      src/main/webapp/app/FaeBoo/Profile-temp/profile-temp.route.ts
  52. 19
    0
      src/main/webapp/app/entities/account-details/account-details-delete-dialog.component.html
  53. 72
    0
      src/main/webapp/app/entities/account-details/account-details-delete-dialog.component.ts
  54. 39
    0
      src/main/webapp/app/entities/account-details/account-details-detail.component.html
  55. 24
    0
      src/main/webapp/app/entities/account-details/account-details-detail.component.ts
  56. 46
    0
      src/main/webapp/app/entities/account-details/account-details-update.component.html
  57. 74
    0
      src/main/webapp/app/entities/account-details/account-details-update.component.ts
  58. 62
    0
      src/main/webapp/app/entities/account-details/account-details.component.html
  59. 58
    0
      src/main/webapp/app/entities/account-details/account-details.component.ts
  60. 35
    0
      src/main/webapp/app/entities/account-details/account-details.module.ts
  61. 93
    0
      src/main/webapp/app/entities/account-details/account-details.route.ts
  62. 38
    0
      src/main/webapp/app/entities/account-details/account-details.service.ts
  63. 6
    0
      src/main/webapp/app/entities/account-details/index.ts
  64. 19
    0
      src/main/webapp/app/entities/album/album-delete-dialog.component.html
  65. 65
    0
      src/main/webapp/app/entities/album/album-delete-dialog.component.ts
  66. 35
    0
      src/main/webapp/app/entities/album/album-detail.component.html
  67. 24
    0
      src/main/webapp/app/entities/album/album-detail.component.ts
  68. 41
    0
      src/main/webapp/app/entities/album/album-update.component.html
  69. 74
    0
      src/main/webapp/app/entities/album/album-update.component.ts
  70. 60
    0
      src/main/webapp/app/entities/album/album.component.html
  71. 58
    0
      src/main/webapp/app/entities/album/album.component.ts
  72. 24
    0
      src/main/webapp/app/entities/album/album.module.ts
  73. 93
    0
      src/main/webapp/app/entities/album/album.route.ts
  74. 38
    0
      src/main/webapp/app/entities/album/album.service.ts
  75. 6
    0
      src/main/webapp/app/entities/album/index.ts
  76. 19
    0
      src/main/webapp/app/entities/comment/comment-delete-dialog.component.html
  77. 65
    0
      src/main/webapp/app/entities/comment/comment-delete-dialog.component.ts
  78. 45
    0
      src/main/webapp/app/entities/comment/comment-detail.component.html
  79. 24
    0
      src/main/webapp/app/entities/comment/comment-detail.component.ts
  80. 53
    0
      src/main/webapp/app/entities/comment/comment-update.component.html
  81. 89
    0
      src/main/webapp/app/entities/comment/comment-update.component.ts
  82. 68
    0
      src/main/webapp/app/entities/comment/comment.component.html
  83. 58
    0
      src/main/webapp/app/entities/comment/comment.component.ts
  84. 30
    0
      src/main/webapp/app/entities/comment/comment.module.ts
  85. 93
    0
      src/main/webapp/app/entities/comment/comment.route.ts
  86. 38
    0
      src/main/webapp/app/entities/comment/comment.service.ts
  87. 6
    0
      src/main/webapp/app/entities/comment/index.ts
  88. 16
    0
      src/main/webapp/app/entities/entity.module.ts
  89. 19
    0
      src/main/webapp/app/entities/friend/friend-delete-dialog.component.html
  90. 65
    0
      src/main/webapp/app/entities/friend/friend-delete-dialog.component.ts
  91. 35
    0
      src/main/webapp/app/entities/friend/friend-detail.component.html
  92. 24
    0
      src/main/webapp/app/entities/friend/friend-detail.component.ts
  93. 43
    0
      src/main/webapp/app/entities/friend/friend-update.component.html
  94. 74
    0
      src/main/webapp/app/entities/friend/friend-update.component.ts
  95. 62
    0
      src/main/webapp/app/entities/friend/friend.component.html
  96. 58
    0
      src/main/webapp/app/entities/friend/friend.component.ts
  97. 24
    0
      src/main/webapp/app/entities/friend/friend.module.ts
  98. 93
    0
      src/main/webapp/app/entities/friend/friend.route.ts
  99. 38
    0
      src/main/webapp/app/entities/friend/friend.service.ts
  100. 0
    0
      src/main/webapp/app/entities/friend/index.ts

+ 36
- 0
.jhipster/AccountDetails.json 查看文件

@@ -0,0 +1,36 @@
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 查看文件

@@ -0,0 +1,30 @@
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 查看文件

@@ -0,0 +1,40 @@
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 查看文件

@@ -0,0 +1,32 @@
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 查看文件

@@ -0,0 +1,38 @@
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 查看文件

@@ -0,0 +1,38 @@
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 查看文件

@@ -0,0 +1,32 @@
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 查看文件

@@ -0,0 +1,30 @@
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
+}

+ 68
- 3
jdl.jh 查看文件

@@ -13,6 +13,62 @@ entity Friend{
13 13
     topFriend Boolean
14 14
 }
15 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
+
16 72
 relationship OneToOne {
17 73
 	AccountDetails{userAccount(email)} to User
18 74
 }
@@ -21,10 +77,19 @@ relationship OneToOne {
21 77
 	Profile{userProfile(email)} to User
22 78
 }
23 79
 
24
-relationship OneToMany{
25
-	Profile{friendProfile} to Friend{userProfile}
80
+relationship ManyToOne{
81
+	Friend{user(email)} to User
26 82
 }
27 83
 
28 84
 relationship ManyToOne{
29
-	Friend{friendProfile} to Profile{user}
85
+	Friend{friend(email)} to User
30 86
 }
87
+
88
+
89
+
90
+
91
+
92
+
93
+
94
+
95
+

+ 129
- 0
src/main/java/rocks/zipcode/io/domain/AccountDetails.java 查看文件

@@ -0,0 +1,129 @@
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 查看文件

@@ -0,0 +1,114 @@
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 查看文件

@@ -0,0 +1,148 @@
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 查看文件

@@ -0,0 +1,114 @@
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 查看文件

@@ -0,0 +1,146 @@
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 查看文件

@@ -0,0 +1,148 @@
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 查看文件

@@ -0,0 +1,112 @@
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 查看文件

@@ -0,0 +1,114 @@
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 查看文件

@@ -0,0 +1,15 @@
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 查看文件

@@ -0,0 +1,19 @@
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 查看文件

@@ -0,0 +1,19 @@
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 查看文件

@@ -0,0 +1,22 @@
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 查看文件

@@ -0,0 +1,30 @@
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 查看文件

@@ -0,0 +1,19 @@
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 查看文件

@@ -0,0 +1,15 @@
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
+}

+ 15
- 0
src/main/java/rocks/zipcode/io/repository/VideoRepository.java 查看文件

@@ -0,0 +1,15 @@
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
+}

+ 119
- 0
src/main/java/rocks/zipcode/io/web/rest/AccountDetailsResource.java 查看文件

@@ -0,0 +1,119 @@
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
+}

+ 119
- 0
src/main/java/rocks/zipcode/io/web/rest/AlbumResource.java 查看文件

@@ -0,0 +1,119 @@
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 查看文件

@@ -0,0 +1,119 @@
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 查看文件

@@ -0,0 +1,119 @@
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 查看文件

@@ -0,0 +1,120 @@
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
+}

+ 119
- 0
src/main/java/rocks/zipcode/io/web/rest/PostResource.java 查看文件

@@ -0,0 +1,119 @@
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.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 Post.
22
+ */
23
+@RestController
24
+@RequestMapping("/api")
25
+public class PostResource {
26
+
27
+    private final Logger log = LoggerFactory.getLogger(PostResource.class);
28
+
29
+    private static final String ENTITY_NAME = "post";
30
+
31
+    private final PostRepository postRepository;
32
+
33
+    public PostResource(PostRepository postRepository) {
34
+        this.postRepository = postRepository;
35
+    }
36
+
37
+    /**
38
+     * POST  /posts : Create a new post.
39
+     *
40
+     * @param post the post to create
41
+     * @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
42
+     * @throws URISyntaxException if the Location URI syntax is incorrect
43
+     */
44
+    @PostMapping("/posts")
45
+    @Timed
46
+    public ResponseEntity<Post> createPost(@RequestBody Post post) throws URISyntaxException {
47
+        log.debug("REST request to save Post : {}", post);
48
+        if (post.getId() != null) {
49
+            throw new BadRequestAlertException("A new post cannot already have an ID", ENTITY_NAME, "idexists");
50
+        }
51
+        Post result = postRepository.save(post);
52
+        return ResponseEntity.created(new URI("/api/posts/" + result.getId()))
53
+            .headers(HeaderUtil.createEntityCreationAlert(ENTITY_NAME, result.getId().toString()))
54
+            .body(result);
55
+    }
56
+
57
+    /**
58
+     * PUT  /posts : Updates an existing post.
59
+     *
60
+     * @param post the post to update
61
+     * @return the ResponseEntity with status 200 (OK) and with body the updated post,
62
+     * or with status 400 (Bad Request) if the post is not valid,
63
+     * or with status 500 (Internal Server Error) if the post couldn't be updated
64
+     * @throws URISyntaxException if the Location URI syntax is incorrect
65
+     */
66
+    @PutMapping("/posts")
67
+    @Timed
68
+    public ResponseEntity<Post> updatePost(@RequestBody Post post) throws URISyntaxException {
69
+        log.debug("REST request to update Post : {}", post);
70
+        if (post.getId() == null) {
71
+            throw new BadRequestAlertException("Invalid id", ENTITY_NAME, "idnull");
72
+        }
73
+        Post result = postRepository.save(post);
74
+        return ResponseEntity.ok()
75
+            .headers(HeaderUtil.createEntityUpdateAlert(ENTITY_NAME, post.getId().toString()))
76
+            .body(result);
77
+    }
78
+
79
+    /**
80
+     * GET  /posts : get all the posts.
81
+     *
82
+     * @return the ResponseEntity with status 200 (OK) and the list of posts in body
83
+     */
84
+    @GetMapping("/posts")
85
+    @Timed
86
+    public List<Post> getAllPosts() {
87
+        log.debug("REST request to get all Posts");
88
+        return postRepository.findAll();
89
+    }
90
+
91
+    /**
92
+     * GET  /posts/:id : get the "id" post.
93
+     *
94
+     * @param id the id of the post to retrieve
95
+     * @return the ResponseEntity with status 200 (OK) and with body the post, or with status 404 (Not Found)
96
+     */
97
+    @GetMapping("/posts/{id}")
98
+    @Timed
99
+    public ResponseEntity<Post> getPost(@PathVariable Long id) {
100
+        log.debug("REST request to get Post : {}", id);
101
+        Optional<Post> post = postRepository.findById(id);
102
+        return ResponseUtil.wrapOrNotFound(post);
103
+    }
104
+
105
+    /**
106
+     * DELETE  /posts/:id : delete the "id" post.
107
+     *
108
+     * @param id the id of the post to delete
109
+     * @return the ResponseEntity with status 200 (OK)
110
+     */
111
+    @DeleteMapping("/posts/{id}")
112
+    @Timed
113
+    public ResponseEntity<Void> deletePost(@PathVariable Long id) {
114
+        log.debug("REST request to delete Post : {}", id);
115
+
116
+        postRepository.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/ProfileResource.java 查看文件

@@ -0,0 +1,119 @@
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
+}

+ 119
- 0
src/main/java/rocks/zipcode/io/web/rest/VideoResource.java 查看文件

@@ -0,0 +1,119 @@
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
+}

+ 43
- 0
src/main/resources/config/liquibase/changelog/20190102220056_added_entity_AccountDetails.xml 查看文件

@@ -0,0 +1,43 @@
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 查看文件

@@ -0,0 +1,18 @@
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 查看文件

@@ -0,0 +1,39 @@
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 查看文件

@@ -0,0 +1,18 @@
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 查看文件

@@ -0,0 +1,41 @@
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 查看文件

@@ -0,0 +1,24 @@
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 查看文件

@@ -0,0 +1,41 @@
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 查看文件

@@ -0,0 +1,18 @@
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 查看文件

@@ -0,0 +1,52 @@
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 查看文件

@@ -0,0 +1,29 @@
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 查看文件

@@ -0,0 +1,41 @@
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 查看文件

@@ -0,0 +1,18 @@
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 查看文件

@@ -0,0 +1,49 @@
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 查看文件

@@ -0,0 +1,18 @@
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 查看文件

@@ -0,0 +1,49 @@
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 查看文件

@@ -0,0 +1,24 @@
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 查看文件

@@ -5,6 +5,22 @@
5 5
     xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd">
6 6
 
7 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 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 25
     <!-- jhipster-needle-liquibase-add-constraints-changelog - JHipster will add liquibase constraints changelogs here -->
10 26
 </databaseChangeLog>

+ 1
- 1
src/main/webapp/app/FaeBoo/Profile-temp/profile-temp.route.ts 查看文件

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

+ 19
- 0
src/main/webapp/app/entities/account-details/account-details-delete-dialog.component.html 查看文件

@@ -0,0 +1,19 @@
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 查看文件

@@ -0,0 +1,72 @@
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 查看文件

@@ -0,0 +1,39 @@
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 查看文件

@@ -0,0 +1,24 @@
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 查看文件

@@ -0,0 +1,46 @@
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 查看文件

@@ -0,0 +1,74 @@
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 查看文件

@@ -0,0 +1,62 @@
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 查看文件

@@ -0,0 +1,58 @@
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 查看文件

@@ -0,0 +1,35 @@
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 查看文件

@@ -0,0 +1,93 @@
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 查看文件

@@ -0,0 +1,38 @@
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 查看文件

@@ -0,0 +1,6 @@
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 查看文件

@@ -0,0 +1,19 @@
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 查看文件

@@ -0,0 +1,65 @@
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 查看文件

@@ -0,0 +1,35 @@
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 查看文件

@@ -0,0 +1,24 @@
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 查看文件

@@ -0,0 +1,41 @@
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 查看文件

@@ -0,0 +1,74 @@
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 查看文件

@@ -0,0 +1,60 @@
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 查看文件

@@ -0,0 +1,58 @@
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 查看文件

@@ -0,0 +1,24 @@
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 查看文件

@@ -0,0 +1,93 @@
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 查看文件

@@ -0,0 +1,38 @@
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 查看文件

@@ -0,0 +1,6 @@
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 查看文件

@@ -0,0 +1,19 @@
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 查看文件

@@ -0,0 +1,65 @@
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 查看文件

@@ -0,0 +1,45 @@
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>

+ 24
- 0
src/main/webapp/app/entities/comment/comment-detail.component.ts 查看文件

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

+ 53
- 0
src/main/webapp/app/entities/comment/comment-update.component.html 查看文件

@@ -0,0 +1,53 @@
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-comment-heading" jhiTranslate="faeBooApp.comment.home.createOrEditLabel">Create or edit a Comment</h2>
5
+            <div>
6
+                <jhi-alert-error></jhi-alert-error>
7
+                <div class="form-group" [hidden]="!comment.id">
8
+                    <label for="id" jhiTranslate="global.field.id">ID</label>
9
+                    <input type="text" class="form-control" id="id" name="id"
10
+                        [(ngModel)]="comment.id" readonly />
11
+                </div>
12
+                <div class="form-group">
13
+                    <label class="form-control-label" jhiTranslate="faeBooApp.comment.content" for="field_content">Content</label>
14
+                    <input type="text" class="form-control" name="content" id="field_content"
15
+                        [(ngModel)]="comment.content" />
16
+                </div>
17
+                <div class="form-group">
18
+                    <label class="form-control-label" jhiTranslate="faeBooApp.comment.likes" for="field_likes">Likes</label>
19
+                    <input type="number" class="form-control" name="likes" id="field_likes"
20
+                        [(ngModel)]="comment.likes" />
21
+                </div>
22
+                <div class="form-group">
23
+                    <label class="form-control-label" jhiTranslate="faeBooApp.comment.dislikes" for="field_dislikes">Dislikes</label>
24
+                    <input type="number" class="form-control" name="dislikes" id="field_dislikes"
25
+                        [(ngModel)]="comment.dislikes" />
26
+                </div>
27
+
28
+                <div class="form-group">
29
+                    <label class="form-control-label" jhiTranslate="faeBooApp.comment.commenter" for="field_commenter">Commenter</label>
30
+                    <select class="form-control" id="field_commenter" name="commenter" [(ngModel)]="comment.commenter" >
31
+                        <option [ngValue]="null"></option>
32
+                        <option [ngValue]="userOption.id === comment.commenter?.id ? comment.commenter : userOption" *ngFor="let userOption of users; trackBy: trackUserById">{{userOption.email}}</option>
33
+                    </select>
34
+                </div>
35
+                <div class="form-group">
36
+                    <label class="form-control-label" jhiTranslate="faeBooApp.comment.post" for="field_post">Post</label>
37
+                    <select class="form-control" id="field_post" name="post" [(ngModel)]="comment.post" >
38
+                        <option [ngValue]="null"></option>
39
+                        <option [ngValue]="postOption.id === comment.post?.id ? comment.post : postOption" *ngFor="let postOption of posts; trackBy: trackPostById">{{postOption.id}}</option>
40
+                    </select>
41
+                </div>
42
+            </div>
43
+            <div>
44
+                <button type="button" id="cancel-save" class="btn btn-secondary"  (click)="previousState()">
45
+                    <fa-icon [icon]="'ban'"></fa-icon>&nbsp;<span jhiTranslate="entity.action.cancel">Cancel</span>
46
+                </button>
47
+                <button type="submit" id="save-entity" [disabled]="editForm.form.invalid || isSaving" class="btn btn-primary">
48
+                    <fa-icon [icon]="'save'"></fa-icon>&nbsp;<span jhiTranslate="entity.action.save">Save</span>
49
+                </button>
50
+            </div>
51
+        </form>
52
+    </div>
53
+</div>

+ 89
- 0
src/main/webapp/app/entities/comment/comment-update.component.ts 查看文件

@@ -0,0 +1,89 @@
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 { IComment } from 'app/shared/model/comment.model';
8
+import { CommentService } from './comment.service';
9
+import { IUser, UserService } from 'app/core';
10
+import { IPost } from 'app/shared/model/post.model';
11
+import { PostService } from 'app/entities/post';
12
+
13
+@Component({
14
+    selector: 'jhi-comment-update',
15
+    templateUrl: './comment-update.component.html'
16
+})
17
+export class CommentUpdateComponent implements OnInit {
18
+    comment: IComment;
19
+    isSaving: boolean;
20
+
21
+    users: IUser[];
22
+
23
+    posts: IPost[];
24
+
25
+    constructor(
26
+        private jhiAlertService: JhiAlertService,
27
+        private commentService: CommentService,
28
+        private userService: UserService,
29
+        private postService: PostService,
30
+        private activatedRoute: ActivatedRoute
31
+    ) {}
32
+
33
+    ngOnInit() {
34
+        this.isSaving = false;
35
+        this.activatedRoute.data.subscribe(({ comment }) => {
36
+            this.comment = comment;
37
+        });
38
+        this.userService.query().subscribe(
39
+            (res: HttpResponse<IUser[]>) => {
40
+                this.users = res.body;
41
+            },
42
+            (res: HttpErrorResponse) => this.onError(res.message)
43
+        );
44
+        this.postService.query().subscribe(
45
+            (res: HttpResponse<IPost[]>) => {
46
+                this.posts = res.body;
47
+            },
48
+            (res: HttpErrorResponse) => this.onError(res.message)
49
+        );
50
+    }
51
+
52
+    previousState() {
53
+        window.history.back();
54
+    }
55
+
56
+    save() {
57
+        this.isSaving = true;
58
+        if (this.comment.id !== undefined) {
59
+            this.subscribeToSaveResponse(this.commentService.update(this.comment));
60
+        } else {
61
+            this.subscribeToSaveResponse(this.commentService.create(this.comment));
62
+        }
63
+    }
64
+
65
+    private subscribeToSaveResponse(result: Observable<HttpResponse<IComment>>) {
66
+        result.subscribe((res: HttpResponse<IComment>) => this.onSaveSuccess(), (res: HttpErrorResponse) => this.onSaveError());
67
+    }
68
+
69
+    private onSaveSuccess() {
70
+        this.isSaving = false;
71
+        this.previousState();
72
+    }
73
+
74
+    private onSaveError() {
75
+        this.isSaving = false;
76
+    }
77
+
78
+    private onError(errorMessage: string) {
79
+        this.jhiAlertService.error(errorMessage, null, null);
80
+    }
81
+
82
+    trackUserById(index: number, item: IUser) {
83
+        return item.id;
84
+    }
85
+
86
+    trackPostById(index: number, item: IPost) {
87
+        return item.id;
88
+    }
89
+}

+ 68
- 0
src/main/webapp/app/entities/comment/comment.component.html 查看文件

@@ -0,0 +1,68 @@
1
+<div>
2
+    <h2 id="page-heading">
3
+        <span jhiTranslate="faeBooApp.comment.home.title">Comments</span>
4
+        <button id="jh-create-entity" class="btn btn-primary float-right jh-create-entity create-comment" [routerLink]="['/comment/new']">
5
+            <fa-icon [icon]="'plus'"></fa-icon>
6
+            <span  jhiTranslate="faeBooApp.comment.home.createLabel">
7
+            Create new Comment
8
+            </span>
9
+        </button>
10
+    </h2>
11
+    <jhi-alert></jhi-alert>
12
+    <br/>
13
+    <div class="table-responsive" *ngIf="comments">
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.comment.content">Content</span></th>
19
+            <th><span jhiTranslate="faeBooApp.comment.likes">Likes</span></th>
20
+            <th><span jhiTranslate="faeBooApp.comment.dislikes">Dislikes</span></th>
21
+            <th><span jhiTranslate="faeBooApp.comment.commenter">Commenter</span></th>
22
+            <th><span jhiTranslate="faeBooApp.comment.post">Post</span></th>
23
+            <th></th>
24
+            </tr>
25
+            </thead>
26
+            <tbody>
27
+            <tr *ngFor="let comment of comments ;trackBy: trackId">
28
+                <td><a [routerLink]="['/comment', comment.id, 'view' ]">{{comment.id}}</a></td>
29
+                <td>{{comment.content}}</td>
30
+                <td>{{comment.likes}}</td>
31
+                <td>{{comment.dislikes}}</td>
32
+                <td>
33
+                    {{comment.commenter?.email}}
34
+                </td>
35
+                <td>
36
+                    <div *ngIf="comment.post">
37
+                        <a [routerLink]="['../post', comment.post?.id, 'view' ]" >{{comment.post?.id}}</a>
38
+                    </div>
39
+                </td>
40
+                <td class="text-right">
41
+                    <div class="btn-group flex-btn-group-container">
42
+                        <button type="submit"
43
+                                [routerLink]="['/comment', comment.id, 'view' ]"
44
+                                class="btn btn-info btn-sm">
45
+                            <fa-icon [icon]="'eye'"></fa-icon>
46
+                            <span class="d-none d-md-inline" jhiTranslate="entity.action.view">View</span>
47
+                        </button>
48
+                        <button type="submit"
49
+                                [routerLink]="['/comment', comment.id, 'edit']"
50
+                                class="btn btn-primary btn-sm">
51
+                            <fa-icon [icon]="'pencil-alt'"></fa-icon>
52
+                            <span class="d-none d-md-inline" jhiTranslate="entity.action.edit">Edit</span>
53
+                        </button>
54
+                        <button type="submit"
55
+                                [routerLink]="['/', { outlets: { popup: 'comment/'+ comment.id + '/delete'} }]"
56
+                                replaceUrl="true"
57
+                                queryParamsHandling="merge"
58
+                                class="btn btn-danger btn-sm">
59
+                            <fa-icon [icon]="'times'"></fa-icon>
60
+                            <span class="d-none d-md-inline" jhiTranslate="entity.action.delete">Delete</span>
61
+                        </button>
62
+                    </div>
63
+                </td>
64
+            </tr>
65
+            </tbody>
66
+        </table>
67
+    </div>
68
+</div>

+ 58
- 0
src/main/webapp/app/entities/comment/comment.component.ts 查看文件

@@ -0,0 +1,58 @@
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 { IComment } from 'app/shared/model/comment.model';
7
+import { Principal } from 'app/core';
8
+import { CommentService } from './comment.service';
9
+
10
+@Component({
11
+    selector: 'jhi-comment',
12
+    templateUrl: './comment.component.html'
13
+})
14
+export class CommentComponent implements OnInit, OnDestroy {
15
+    comments: IComment[];
16
+    currentAccount: any;
17
+    eventSubscriber: Subscription;
18
+
19
+    constructor(
20
+        private commentService: CommentService,
21
+        private jhiAlertService: JhiAlertService,
22
+        private eventManager: JhiEventManager,
23
+        private principal: Principal
24
+    ) {}
25
+
26
+    loadAll() {
27
+        this.commentService.query().subscribe(
28
+            (res: HttpResponse<IComment[]>) => {
29
+                this.comments = 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.registerChangeInComments();
41
+    }
42
+
43
+    ngOnDestroy() {
44
+        this.eventManager.destroy(this.eventSubscriber);
45
+    }
46
+
47
+    trackId(index: number, item: IComment) {
48
+        return item.id;
49
+    }
50
+
51
+    registerChangeInComments() {
52
+        this.eventSubscriber = this.eventManager.subscribe('commentListModification', response => this.loadAll());
53
+    }
54
+
55
+    private onError(errorMessage: string) {
56
+        this.jhiAlertService.error(errorMessage, null, null);
57
+    }
58
+}

+ 30
- 0
src/main/webapp/app/entities/comment/comment.module.ts 查看文件

@@ -0,0 +1,30 @@
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
+    CommentComponent,
8
+    CommentDetailComponent,
9
+    CommentUpdateComponent,
10
+    CommentDeletePopupComponent,
11
+    CommentDeleteDialogComponent,
12
+    commentRoute,
13
+    commentPopupRoute
14
+} from './';
15
+
16
+const ENTITY_STATES = [...commentRoute, ...commentPopupRoute];
17
+
18
+@NgModule({
19
+    imports: [FaeBooSharedModule, FaeBooAdminModule, RouterModule.forChild(ENTITY_STATES)],
20
+    declarations: [
21
+        CommentComponent,
22
+        CommentDetailComponent,
23
+        CommentUpdateComponent,
24
+        CommentDeleteDialogComponent,
25
+        CommentDeletePopupComponent
26
+    ],
27
+    entryComponents: [CommentComponent, CommentUpdateComponent, CommentDeleteDialogComponent, CommentDeletePopupComponent],
28
+    schemas: [CUSTOM_ELEMENTS_SCHEMA]
29
+})
30
+export class FaeBooCommentModule {}

+ 93
- 0
src/main/webapp/app/entities/comment/comment.route.ts 查看文件

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

+ 38
- 0
src/main/webapp/app/entities/comment/comment.service.ts 查看文件

@@ -0,0 +1,38 @@
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 { IComment } from 'app/shared/model/comment.model';
8
+
9
+type EntityResponseType = HttpResponse<IComment>;
10
+type EntityArrayResponseType = HttpResponse<IComment[]>;
11
+
12
+@Injectable({ providedIn: 'root' })
13
+export class CommentService {
14
+    public resourceUrl = SERVER_API_URL + 'api/comments';
15
+
16
+    constructor(private http: HttpClient) {}
17
+
18
+    create(comment: IComment): Observable<EntityResponseType> {
19
+        return this.http.post<IComment>(this.resourceUrl, comment, { observe: 'response' });
20
+    }
21
+
22
+    update(comment: IComment): Observable<EntityResponseType> {
23
+        return this.http.put<IComment>(this.resourceUrl, comment, { observe: 'response' });
24
+    }
25
+
26
+    find(id: number): Observable<EntityResponseType> {
27
+        return this.http.get<IComment>(`${this.resourceUrl}/${id}`, { observe: 'response' });
28
+    }
29
+
30
+    query(req?: any): Observable<EntityArrayResponseType> {
31
+        const options = createRequestOption(req);
32
+        return this.http.get<IComment[]>(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/comment/index.ts 查看文件

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

+ 16
- 0
src/main/webapp/app/entities/entity.module.ts 查看文件

@@ -1,10 +1,26 @@
1 1
 import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
2 2
 
3
+import { FaeBooAccountDetailsModule } from './account-details/account-details.module';
4
+import { FaeBooProfileModule } from './profile/profile.module';
5
+import { FaeBooFriendModule } from './friend/friend.module';
6
+import { FaeBooAlbumModule } from './album/album.module';
7
+import { FaeBooPhotoModule } from './photo/photo.module';
8
+import { FaeBooVideoModule } from './video/video.module';
9
+import { FaeBooPostModule } from './post/post.module';
10
+import { FaeBooCommentModule } from './comment/comment.module';
3 11
 /* jhipster-needle-add-entity-module-import - JHipster will add entity modules imports here */
4 12
 
5 13
 @NgModule({
6 14
     // prettier-ignore
7 15
     imports: [
16
+        FaeBooAccountDetailsModule,
17
+        FaeBooProfileModule,
18
+        FaeBooFriendModule,
19
+        FaeBooAlbumModule,
20
+        FaeBooPhotoModule,
21
+        FaeBooVideoModule,
22
+        FaeBooPostModule,
23
+        FaeBooCommentModule,
8 24
         /* jhipster-needle-add-entity-module - JHipster will add entity modules here */
9 25
     ],
10 26
     declarations: [],

+ 19
- 0
src/main/webapp/app/entities/friend/friend-delete-dialog.component.html 查看文件

@@ -0,0 +1,19 @@
1
+<form name="deleteForm" (ngSubmit)="confirmDelete(friend.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-friend-heading" jhiTranslate="faeBooApp.friend.delete.question" translateValues="{id: '{{friend.id}}'}">Are you sure you want to delete this Friend?</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-friend" 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/friend/friend-delete-dialog.component.ts 查看文件

@@ -0,0 +1,65 @@
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 { IFriend } from 'app/shared/model/friend.model';
8
+import { FriendService } from './friend.service';
9
+
10
+@Component({
11
+    selector: 'jhi-friend-delete-dialog',
12
+    templateUrl: './friend-delete-dialog.component.html'
13
+})
14
+export class FriendDeleteDialogComponent {
15
+    friend: IFriend;
16
+
17
+    constructor(private friendService: FriendService, public activeModal: NgbActiveModal, private eventManager: JhiEventManager) {}
18
+
19
+    clear() {
20
+        this.activeModal.dismiss('cancel');
21
+    }
22
+
23
+    confirmDelete(id: number) {
24
+        this.friendService.delete(id).subscribe(response => {
25
+            this.eventManager.broadcast({
26
+                name: 'friendListModification',
27
+                content: 'Deleted an friend'
28
+            });
29
+            this.activeModal.dismiss(true);
30
+        });
31
+    }
32
+}
33
+
34
+@Component({
35
+    selector: 'jhi-friend-delete-popup',
36
+    template: ''
37
+})
38
+export class FriendDeletePopupComponent 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(({ friend }) => {
45
+            setTimeout(() => {
46
+                this.ngbModalRef = this.modalService.open(FriendDeleteDialogComponent as Component, { size: 'lg', backdrop: 'static' });
47
+                this.ngbModalRef.componentInstance.friend = friend;
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/friend/friend-detail.component.html 查看文件

@@ -0,0 +1,35 @@
1
+<div class="row justify-content-center">
2
+    <div class="col-8">
3
+        <div *ngIf="friend">
4
+            <h2><span jhiTranslate="faeBooApp.friend.detail.title">Friend</span> {{friend.id}}</h2>
5
+            <hr>
6
+            <jhi-alert-error></jhi-alert-error>
7
+            <dl class="row-md jh-entity-details">
8
+                <dt><span jhiTranslate="faeBooApp.friend.topFriend">Top Friend</span></dt>
9
+                <dd>
10
+                    <span>{{friend.topFriend}}</span>
11
+                </dd>
12
+                <dt><span jhiTranslate="faeBooApp.friend.user">User</span></dt>
13
+                <dd>
14
+                    {{friend.user?.email}}
15
+                </dd>
16
+                <dt><span jhiTranslate="faeBooApp.friend.friend">Friend</span></dt>
17
+                <dd>
18
+                    {{friend.friend?.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]="['/friend', friend.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/friend/friend-detail.component.ts 查看文件

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

+ 43
- 0
src/main/webapp/app/entities/friend/friend-update.component.html 查看文件

@@ -0,0 +1,43 @@
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-friend-heading" jhiTranslate="faeBooApp.friend.home.createOrEditLabel">Create or edit a Friend</h2>
5
+            <div>
6
+                <jhi-alert-error></jhi-alert-error>
7
+                <div class="form-group" [hidden]="!friend.id">
8
+                    <label for="id" jhiTranslate="global.field.id">ID</label>
9
+                    <input type="text" class="form-control" id="id" name="id"
10
+                        [(ngModel)]="friend.id" readonly />
11
+                </div>
12
+                <div class="form-group">
13
+                    <label class="form-control-label" jhiTranslate="faeBooApp.friend.topFriend" for="field_topFriend">Top Friend</label>
14
+                    <input type="checkbox" class="form-control" name="topFriend" id="field_topFriend"
15
+                        [(ngModel)]="friend.topFriend" />
16
+                </div>
17
+
18
+                <div class="form-group">
19
+                    <label class="form-control-label" jhiTranslate="faeBooApp.friend.user" for="field_user">User</label>
20
+                    <select class="form-control" id="field_user" name="user" [(ngModel)]="friend.user" >
21
+                        <option [ngValue]="null"></option>
22
+                        <option [ngValue]="userOption.id === friend.user?.id ? friend.user : userOption" *ngFor="let userOption of users; trackBy: trackUserById">{{userOption.email}}</option>
23
+                    </select>
24
+                </div>
25
+                <div class="form-group">
26
+                    <label class="form-control-label" jhiTranslate="faeBooApp.friend.friend" for="field_friend">Friend</label>
27
+                    <select class="form-control" id="field_friend" name="friend" [(ngModel)]="friend.friend" >
28
+                        <option [ngValue]="null"></option>
29
+                        <option [ngValue]="userOption.id === friend.friend?.id ? friend.friend : userOption" *ngFor="let userOption of users; trackBy: trackUserById">{{userOption.email}}</option>
30
+                    </select>
31
+                </div>
32
+            </div>
33
+            <div>
34
+                <button type="button" id="cancel-save" class="btn btn-secondary"  (click)="previousState()">
35
+                    <fa-icon [icon]="'ban'"></fa-icon>&nbsp;<span jhiTranslate="entity.action.cancel">Cancel</span>
36
+                </button>
37
+                <button type="submit" id="save-entity" [disabled]="editForm.form.invalid || isSaving" class="btn btn-primary">
38
+                    <fa-icon [icon]="'save'"></fa-icon>&nbsp;<span jhiTranslate="entity.action.save">Save</span>
39
+                </button>
40
+            </div>
41
+        </form>
42
+    </div>
43
+</div>

+ 74
- 0
src/main/webapp/app/entities/friend/friend-update.component.ts 查看文件

@@ -0,0 +1,74 @@
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 { IFriend } from 'app/shared/model/friend.model';
8
+import { FriendService } from './friend.service';
9
+import { IUser, UserService } from 'app/core';
10
+
11
+@Component({
12
+    selector: 'jhi-friend-update',
13
+    templateUrl: './friend-update.component.html'
14
+})
15
+export class FriendUpdateComponent implements OnInit {
16
+    friend: IFriend;
17
+    isSaving: boolean;
18
+
19
+    users: IUser[];
20
+
21
+    constructor(
22
+        private jhiAlertService: JhiAlertService,
23
+        private friendService: FriendService,
24
+        private userService: UserService,
25
+        private activatedRoute: ActivatedRoute
26
+    ) {}
27
+
28
+    ngOnInit() {
29
+        this.isSaving = false;
30
+        this.activatedRoute.data.subscribe(({ friend }) => {
31
+            this.friend = friend;
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.friend.id !== undefined) {
48
+            this.subscribeToSaveResponse(this.friendService.update(this.friend));
49
+        } else {
50
+            this.subscribeToSaveResponse(this.friendService.create(this.friend));
51
+        }
52
+    }
53
+
54
+    private subscribeToSaveResponse(result: Observable<HttpResponse<IFriend>>) {
55
+        result.subscribe((res: HttpResponse<IFriend>) => 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/friend/friend.component.html 查看文件

@@ -0,0 +1,62 @@
1
+<div>
2
+    <h2 id="page-heading">
3
+        <span jhiTranslate="faeBooApp.friend.home.title">Friends</span>
4
+        <button id="jh-create-entity" class="btn btn-primary float-right jh-create-entity create-friend" [routerLink]="['/friend/new']">
5
+            <fa-icon [icon]="'plus'"></fa-icon>
6
+            <span  jhiTranslate="faeBooApp.friend.home.createLabel">
7
+            Create new Friend
8
+            </span>
9
+        </button>
10
+    </h2>
11
+    <jhi-alert></jhi-alert>
12
+    <br/>
13
+    <div class="table-responsive" *ngIf="friends">
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.friend.topFriend">Top Friend</span></th>
19
+            <th><span jhiTranslate="faeBooApp.friend.user">User</span></th>
20
+            <th><span jhiTranslate="faeBooApp.friend.friend">Friend</span></th>
21
+            <th></th>
22
+            </tr>
23
+            </thead>
24
+            <tbody>
25
+            <tr *ngFor="let friend of friends ;trackBy: trackId">
26
+                <td><a [routerLink]="['/friend', friend.id, 'view' ]">{{friend.id}}</a></td>
27
+                <td>{{friend.topFriend}}</td>
28
+                <td>
29
+                    {{friend.user?.email}}
30
+                </td>
31
+                <td>
32
+                    {{friend.friend?.email}}
33
+                </td>
34
+                <td class="text-right">
35
+                    <div class="btn-group flex-btn-group-container">
36
+                        <button type="submit"
37
+                                [routerLink]="['/friend', friend.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]="['/friend', friend.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: 'friend/'+ friend.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/friend/friend.component.ts 查看文件

@@ -0,0 +1,58 @@
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 { IFriend } from 'app/shared/model/friend.model';
7
+import { Principal } from 'app/core';
8
+import { FriendService } from './friend.service';
9
+
10
+@Component({
11
+    selector: 'jhi-friend',
12
+    templateUrl: './friend.component.html'
13
+})
14
+export class FriendComponent implements OnInit, OnDestroy {
15
+    friends: IFriend[];
16
+    currentAccount: any;
17
+    eventSubscriber: Subscription;
18
+
19
+    constructor(
20
+        private friendService: FriendService,
21
+        private jhiAlertService: JhiAlertService,
22
+        private eventManager: JhiEventManager,
23
+        private principal: Principal
24
+    ) {}
25
+
26
+    loadAll() {
27
+        this.friendService.query().subscribe(
28
+            (res: HttpResponse<IFriend[]>) => {
29
+                this.friends = 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.registerChangeInFriends();
41
+    }
42
+
43
+    ngOnDestroy() {
44
+        this.eventManager.destroy(this.eventSubscriber);
45
+    }
46
+
47
+    trackId(index: number, item: IFriend) {
48
+        return item.id;
49
+    }
50
+
51
+    registerChangeInFriends() {
52
+        this.eventSubscriber = this.eventManager.subscribe('friendListModification', 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/friend/friend.module.ts 查看文件

@@ -0,0 +1,24 @@
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
+    FriendComponent,
8
+    FriendDetailComponent,
9
+    FriendUpdateComponent,
10
+    FriendDeletePopupComponent,
11
+    FriendDeleteDialogComponent,
12
+    friendRoute,
13
+    friendPopupRoute
14
+} from './';
15
+
16
+const ENTITY_STATES = [...friendRoute, ...friendPopupRoute];
17
+
18
+@NgModule({
19
+    imports: [FaeBooSharedModule, FaeBooAdminModule, RouterModule.forChild(ENTITY_STATES)],
20
+    declarations: [FriendComponent, FriendDetailComponent, FriendUpdateComponent, FriendDeleteDialogComponent, FriendDeletePopupComponent],
21
+    entryComponents: [FriendComponent, FriendUpdateComponent, FriendDeleteDialogComponent, FriendDeletePopupComponent],
22
+    schemas: [CUSTOM_ELEMENTS_SCHEMA]
23
+})
24
+export class FaeBooFriendModule {}

+ 93
- 0
src/main/webapp/app/entities/friend/friend.route.ts 查看文件

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

+ 38
- 0
src/main/webapp/app/entities/friend/friend.service.ts 查看文件

@@ -0,0 +1,38 @@
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 { IFriend } from 'app/shared/model/friend.model';
8
+
9
+type EntityResponseType = HttpResponse<IFriend>;
10
+type EntityArrayResponseType = HttpResponse<IFriend[]>;
11
+
12
+@Injectable({ providedIn: 'root' })
13
+export class FriendService {
14
+    public resourceUrl = SERVER_API_URL + 'api/friends';
15
+
16
+    constructor(private http: HttpClient) {}
17
+
18
+    create(friend: IFriend): Observable<EntityResponseType> {
19
+        return this.http.post<IFriend>(this.resourceUrl, friend, { observe: 'response' });
20
+    }
21
+
22
+    update(friend: IFriend): Observable<EntityResponseType> {
23
+        return this.http.put<IFriend>(this.resourceUrl, friend, { observe: 'response' });
24
+    }
25
+
26
+    find(id: number): Observable<EntityResponseType> {
27
+        return this.http.get<IFriend>(`${this.resourceUrl}/${id}`, { observe: 'response' });
28
+    }
29
+
30
+    query(req?: any): Observable<EntityArrayResponseType> {
31
+        const options = createRequestOption(req);
32
+        return this.http.get<IFriend[]>(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
+}

+ 0
- 0
src/main/webapp/app/entities/friend/index.ts 查看文件


部分文件因文件數量過多而無法顯示