diff --git a/BE/.idea/uiDesigner.xml b/BE/.idea/uiDesigner.xml
new file mode 100644
index 0000000..2b63946
--- /dev/null
+++ b/BE/.idea/uiDesigner.xml
@@ -0,0 +1,124 @@
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+
\ No newline at end of file
diff --git a/BE/images/0399943a-8183-4c4a-8389-314d94f58cf8_test+img.jpg b/BE/images/0399943a-8183-4c4a-8389-314d94f58cf8_test+img.jpg
new file mode 100644
index 0000000..586b49d
Binary files /dev/null and b/BE/images/0399943a-8183-4c4a-8389-314d94f58cf8_test+img.jpg differ
diff --git a/BE/src/main/java/org/example/config/SecurityConfig.java b/BE/src/main/java/org/example/config/SecurityConfig.java
index 9492342..06c25d7 100644
--- a/BE/src/main/java/org/example/config/SecurityConfig.java
+++ b/BE/src/main/java/org/example/config/SecurityConfig.java
@@ -53,7 +53,7 @@ public class SecurityConfig {
CorsConfiguration configuration = new CorsConfiguration();
// TODO: make sure that the origin list comes from an environment file.
- configuration.setAllowedOrigins(Arrays.asList("http://localhost:3001", "http://127.0.0.1:3000"));
+ configuration.setAllowedOrigins(Arrays.asList("http://localhost:3000", "http://127.0.0.1:3000"));
configuration.setAllowedMethods(Arrays.asList("GET","POST","PATCH", "PUT", "DELETE", "OPTIONS", "HEAD"));
configuration.setAllowCredentials(true);
configuration.setAllowedHeaders(Arrays.asList("Authorization", "Requestor-Type", "Content-Type"));
diff --git a/BE/src/main/java/org/example/controllers/PostController.java b/BE/src/main/java/org/example/controllers/PostController.java
new file mode 100644
index 0000000..9f93f82
--- /dev/null
+++ b/BE/src/main/java/org/example/controllers/PostController.java
@@ -0,0 +1,44 @@
+package org.example.controllers;
+
+//import org.example.models.Author;
+import org.example.models.Post;
+import org.example.models.User;
+import org.example.repositories.PostRepository;
+import org.example.services.PostService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.IOException;
+import java.util.List;
+
+@RestController
+@RequestMapping("/posts")
+public class PostController {
+
+ private final PostService postService;
+ private final PostRepository postRepository;
+
+ @Autowired
+ public PostController(PostService postService, PostRepository postRepository) {
+ this.postService = postService;
+ this.postRepository = postRepository;
+ }
+
+ @GetMapping("/getAllPosts")
+ public List getAllPost(){
+ return postService.getAllPost();
+ }
+
+ @PostMapping
+ public Post createPost(
+
+ @RequestParam("title") String title,
+ @RequestParam("content") String content,
+ @RequestParam(value = "imageFile", required = false) MultipartFile imageFile,
+ @RequestParam(value = "videoFile", required = false) MultipartFile videoFile) throws IOException {
+
+ return postService.createPost(title, content, imageFile, videoFile);
+ }
+
+}
diff --git a/BE/src/main/java/org/example/controllers/UserController.java b/BE/src/main/java/org/example/controllers/UserController.java
index b6e201c..4044a11 100644
--- a/BE/src/main/java/org/example/controllers/UserController.java
+++ b/BE/src/main/java/org/example/controllers/UserController.java
@@ -2,6 +2,7 @@ package org.example.controllers;
import org.example.models.User;
import org.example.objects.UserDTO;
+import org.example.repositories.UserRepository;
import org.example.requests.CreateUserRequest;
import org.example.services.UserService;
import org.springframework.http.HttpStatus;
@@ -13,13 +14,17 @@ import java.security.Principal;
@RequestMapping("/api/v1/auth")
public class UserController {
private final UserService userService;
+ private final UserRepository userRepository;
+ public String username;
- public UserController(UserService userService) {
+ public UserController(UserService userService, UserRepository userRepository) {
this.userService = userService;
+ this.userRepository = userRepository;
}
@GetMapping("/me")
public String loggedInUserDetails(Principal principal) {
+ username=principal.getName();
return principal.getName();
}
diff --git a/BE/src/main/java/org/example/models/Author.java b/BE/src/main/java/org/example/models/Author.java
new file mode 100644
index 0000000..e69de29
diff --git a/BE/src/main/java/org/example/models/Image.java b/BE/src/main/java/org/example/models/Image.java
new file mode 100644
index 0000000..c9aa7b3
--- /dev/null
+++ b/BE/src/main/java/org/example/models/Image.java
@@ -0,0 +1,37 @@
+package org.example.models;
+
+import org.springframework.data.neo4j.core.schema.GeneratedValue;
+import org.springframework.data.neo4j.core.schema.Id;
+import org.springframework.data.neo4j.core.schema.Node;
+
+@Node
+public class Image {
+ @Id
+ private Long id;
+ private String filename;
+ private String contentType;
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getFilename() {
+ return filename;
+ }
+
+ public void setFilename(String filename) {
+ this.filename = filename;
+ }
+
+ public String getContentType() {
+ return contentType;
+ }
+
+ public void setContentType(String contentType) {
+ this.contentType = contentType;
+ }
+}
\ No newline at end of file
diff --git a/BE/src/main/java/org/example/models/Post.java b/BE/src/main/java/org/example/models/Post.java
new file mode 100644
index 0000000..542a483
--- /dev/null
+++ b/BE/src/main/java/org/example/models/Post.java
@@ -0,0 +1,81 @@
+package org.example.models;
+
+
+import lombok.Getter;
+import org.springframework.data.neo4j.core.schema.GeneratedValue;
+import org.springframework.data.neo4j.core.schema.Id;
+import org.springframework.data.neo4j.core.schema.Node;
+import org.springframework.data.neo4j.core.schema.Relationship;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.UUID;
+
+@Getter
+@Node
+public class Post {
+ @Id
+ @GeneratedValue
+ private Long id;
+ private String title;
+ private String content;
+
+
+ @Relationship(type = "HAS_IMAGE", direction = Relationship.Direction.OUTGOING)
+ private List images = new ArrayList<>();
+
+ @Relationship(type = "HAS_VIDEO", direction = Relationship.Direction.OUTGOING)
+ private List