A Low Stakes Social Media Development Blog

Table of Contents:

January 22nd, 2021 : "Humble Beginnings"

It's just past midnight and I think it is almost time to call it quits! Yesterday was my last day of official instruction at Codeup and it was so nice to see the projects that my classmates had created. I am right now barreling towards completing a social media site on my own by about mid-February. Today marks the first day that finishing my website and finding my job is completely in my own hands, so I felt like it would be appropriate to start a dev blog and maybe even transfer this blog to my own portfolio site one day.

So far, the home page is where most of the action is; From there, users can do many of the essential functions of a social media site in a very elementary way. And below is what that homepage looks like after my work today.

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/b2c0631c-6733-40d1-88d0-e8d84b3b7599/Untitled.png

What I worked on today is the "view your friends posts" button, which shows all your friends' posts, and creating comments on those posts.

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/54a67166-f1d0-4230-86ce-b57929381d44/Untitled.png

My favorite moment today was what code I used to finally get the list of posts made by friends that the user has accepted, and here is the code!

@GetMapping("/{username}/stories")
public String showNewsFeed(@PathVariable String username,
                                 Model model){
    User user = userRepo.findByUsername(username);
    List<UserFriend> userFriends = userFriendRepo.findAllByUserAndStatus(user, Status.ACCEPTED);
    List<Post> posts = new ArrayList<>();
    for (UserFriend userFriend : userFriends){
        posts.addAll(postRepo.findAllByUser(userFriend.getFriend()));
    }

    model.addAttribute("posts", posts);

    return "userFriend/stories";
}

January 23rd, 2021 : "It's the little things"