Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/new.html #208

Open
wants to merge 241 commits into
base: main
Choose a base branch
from
Open
Changes from 8 commits
Commits
Show all changes
241 commits
Select commit Hold shift + click to select a range
0acc267
Setting up project
Umi007 Jun 17, 2024
709f08e
Update README.md
Umi007 Jun 17, 2024
d9870f6
Created Dockerfile
Umi007 Jun 18, 2024
91f21eb
Merge remote-tracking branch 'refs/remotes/origin/main'
Umi007 Jun 18, 2024
40a901f
Create ci.yml
Umi007 Jun 18, 2024
dbbd359
Connected to cloud db
Umi007 Jun 18, 2024
6688319
commented out singuptest for pipeline
Umi007 Jun 18, 2024
405120c
Merge pull request #1 from The-Socialites/Umi007-ci/cd
Umi007 Jun 18, 2024
5b53565
Create cd.yml
Umi007 Jun 18, 2024
2656c81
Merge pull request #2 from The-Socialites/Umi007-cd
Umi007 Jun 18, 2024
2f158e6
Update cd.yml
Umi007 Jun 18, 2024
8fe9186
Update cd.yml
Umi007 Jun 18, 2024
5191218
reset up cloud db
Umi007 Jun 18, 2024
e8a03d1
Merge remote-tracking branch 'refs/remotes/origin/main'
Umi007 Jun 18, 2024
8b67d17
test
Umi007 Jun 18, 2024
83ec66b
Update cd.yml
Umi007 Jun 18, 2024
97412eb
updated index.html
Umi007 Jun 18, 2024
d902e39
testing
Umi007 Jun 18, 2024
c5a6c4f
updated git ignore
Umi007 Jun 19, 2024
7cc2c33
Delete AWSCLIV2.pkg
Umi007 Jun 19, 2024
2cf332c
db migrations
EthanDunwiddie Jun 19, 2024
0e3a541
add user login form and google login
liuyuanmeng Jun 20, 2024
14a053a
Merge pull request #4 from The-Socialites/feature_google
Umi007 Jun 20, 2024
410d4eb
added events
EthanDunwiddie Jun 20, 2024
fe3a295
reseolved merge conflicts
EthanDunwiddie Jun 20, 2024
c0ee5da
update properties
Umi007 Jun 20, 2024
bec5774
updated aws db
EthanDunwiddie Jun 20, 2024
3ecdb3a
Merge pull request #5 from The-Socialites/events
Umi007 Jun 20, 2024
9ec364c
removed extra input
EthanDunwiddie Jun 20, 2024
ed92f5c
fixed bugs
EthanDunwiddie Jun 20, 2024
b3e57fa
add login-signup css
liuyuanmeng Jun 20, 2024
0e70776
add nav
liuyuanmeng Jun 20, 2024
f19fbb2
dedicated events page
EthanDunwiddie Jun 20, 2024
8683770
sorting out properties
Umi007 Jun 20, 2024
ec12a3e
Merge remote-tracking branch 'refs/remotes/origin/main'
Umi007 Jun 20, 2024
e38a832
add movie api
liuyuanmeng Jun 21, 2024
ec556c8
Merge pull request #6 from The-Socialites/feature_google
Rachel853 Jun 21, 2024
f004880
Styling
Hakim-Kay Jun 21, 2024
ca5b709
Added navbar links work
Hakim-Kay Jun 21, 2024
b5f14d7
Change UserController to LandingPageController
Hakim-Kay Jun 21, 2024
a404e96
add events to the landing page
liuyuanmeng Jun 21, 2024
39d3634
basics working with events API with data coming through to frontend
Jun 21, 2024
c7fc96f
updated events
EthanDunwiddie Jun 21, 2024
4b9702b
link fixed, thumbnail added, date formatted, API key env.var utilised
Jun 21, 2024
57c837b
Merge pull request #7 from The-Socialites/thirdPartyAPI
Rachel853 Jun 21, 2024
99631fe
Update Dockerfile
Umi007 Jun 21, 2024
4ae4f2d
Update Dockerfile
Umi007 Jun 21, 2024
0a6d68a
Update ci.yml
Umi007 Jun 21, 2024
d9275e3
Update Dockerfile
Umi007 Jun 21, 2024
3ac4f72
Update ci.yml
Umi007 Jun 21, 2024
438e654
Update Dockerfile
Umi007 Jun 21, 2024
166fc39
Update Dockerfile
Umi007 Jun 21, 2024
4ec16f4
Update Dockerfile
Umi007 Jun 21, 2024
d958ddd
Update pom.xml
Umi007 Jun 21, 2024
9aae3a6
Update pom.xml
Umi007 Jun 21, 2024
1751a1f
Update Dockerfile
Umi007 Jun 21, 2024
910e5e6
Update pom.xml
Umi007 Jun 21, 2024
fad1810
Update Dockerfile
Umi007 Jun 21, 2024
416fb35
Update pom.xml
Umi007 Jun 21, 2024
3d8023b
Update pom.xml
Umi007 Jun 21, 2024
cd4601c
Update Dockerfile
Umi007 Jun 21, 2024
70b5cd0
Update Dockerfile
Umi007 Jun 21, 2024
e66a703
Update pom.xml
Umi007 Jun 21, 2024
b475983
Update pom.xml
Umi007 Jun 21, 2024
5cfdb6f
Update Dockerfile
Umi007 Jun 21, 2024
f7e6226
Update pom.xml
Umi007 Jun 21, 2024
439744c
Update Dockerfile
Umi007 Jun 21, 2024
ea95951
Update cd.yml
Umi007 Jun 21, 2024
fb50098
Update Dockerfile
Umi007 Jun 21, 2024
3d7f234
Update ThirdPartyEventController.java
Umi007 Jun 21, 2024
d3fea3d
Update pom.xml
Umi007 Jun 21, 2024
45792e3
new db
Umi007 Jun 21, 2024
a388acb
Merge remote-tracking branch 'refs/remotes/origin/main'
Umi007 Jun 21, 2024
9f6af84
dealing with CORS error
Umi007 Jun 21, 2024
c03581d
first commit
Umi007 Jun 23, 2024
af80217
second commit
Umi007 Jun 23, 2024
c7c000e
Integrated filter for events
Umi007 Jun 23, 2024
793ee80
Merge pull request #8 from The-Socialites/uh-branch
Umi007 Jun 23, 2024
83b5a00
sorting out properties
Umi007 Jun 20, 2024
239367d
fixed bugs
EthanDunwiddie Jun 20, 2024
9bc46ae
add login-signup css
liuyuanmeng Jun 20, 2024
05d2901
add movie api
liuyuanmeng Jun 21, 2024
e392966
basics working with events API with data coming through to frontend
Jun 21, 2024
48cdd28
link fixed, thumbnail added, date formatted, API key env.var utilised
Jun 21, 2024
69b596f
Update Dockerfile
Umi007 Jun 21, 2024
2f36d01
Update Dockerfile
Umi007 Jun 21, 2024
b983db4
Update ci.yml
Umi007 Jun 21, 2024
d85e338
Update Dockerfile
Umi007 Jun 21, 2024
bb08d24
Update ci.yml
Umi007 Jun 21, 2024
7d971ba
Update Dockerfile
Umi007 Jun 21, 2024
2249e92
Update Dockerfile
Umi007 Jun 21, 2024
5c0c88c
Update Dockerfile
Umi007 Jun 21, 2024
6303b43
Update pom.xml
Umi007 Jun 21, 2024
7a57cdb
Update pom.xml
Umi007 Jun 21, 2024
a45fdcd
Update Dockerfile
Umi007 Jun 21, 2024
74d35e6
Update pom.xml
Umi007 Jun 21, 2024
b4b1336
Update Dockerfile
Umi007 Jun 21, 2024
acb75ca
Update pom.xml
Umi007 Jun 21, 2024
d65a5fe
Update pom.xml
Umi007 Jun 21, 2024
bde42f0
Update Dockerfile
Umi007 Jun 21, 2024
e96dc22
Update Dockerfile
Umi007 Jun 21, 2024
9d2b95e
Update pom.xml
Umi007 Jun 21, 2024
b519c4f
Update pom.xml
Umi007 Jun 21, 2024
40366e0
Update Dockerfile
Umi007 Jun 21, 2024
4e69b10
Update pom.xml
Umi007 Jun 21, 2024
393533f
Update Dockerfile
Umi007 Jun 21, 2024
b5d0c48
Update cd.yml
Umi007 Jun 21, 2024
8208876
Update Dockerfile
Umi007 Jun 21, 2024
e6baae7
Update ThirdPartyEventController.java
Umi007 Jun 21, 2024
d971531
Update pom.xml
Umi007 Jun 21, 2024
076fc3f
dealing with CORS error
Umi007 Jun 21, 2024
0e25c8c
Fixed merge conflicts
EthanDunwiddie Jun 20, 2024
8f71ece
fixed merge conflicts
EthanDunwiddie Jun 21, 2024
ed94eb8
add page for each event
EthanDunwiddie Jun 24, 2024
e7040df
add user account
liuyuanmeng Jun 24, 2024
605d047
Merge branch 'main' into events
Umi007 Jun 24, 2024
47641aa
Merge pull request #9 from The-Socialites/events
Umi007 Jun 24, 2024
2be4176
fixed indexing
Umi007 Jun 24, 2024
e40a872
fixed db routing
Umi007 Jun 24, 2024
2028945
Updated app-dev properties
Umi007 Jun 24, 2024
065dbf1
create and view comments functionality all created
Jun 24, 2024
dfd170f
create and view comments functionality all created
Jun 24, 2024
5dc6e73
merged with Ethan and Umi's work
Jun 24, 2024
ae8b7ef
fixed routing
Umi007 Jun 24, 2024
1392496
Merge pull request #10 from The-Socialites/Fixing-routing
Umi007 Jun 24, 2024
07ac19f
removed debugging lines
Umi007 Jun 24, 2024
a7b548f
sec config
Umi007 Jun 24, 2024
56d4811
update config
Umi007 Jun 24, 2024
05df8df
sec config
Umi007 Jun 24, 2024
cad4465
updated application properties
Umi007 Jun 24, 2024
a132165
add account and events show on landing page
liuyuanmeng Jun 24, 2024
9c0c4b1
Update Dockerfile
Umi007 Jun 24, 2024
b219844
Update Dockerfile
Umi007 Jun 24, 2024
6f2bde5
Update Dockerfile
Umi007 Jun 24, 2024
a7c5d27
change endpoint
liuyuanmeng Jun 24, 2024
44b46b5
Update Dockerfile
Umi007 Jun 24, 2024
bbfe632
fix conflicts
liuyuanmeng Jun 24, 2024
1fb53cd
Update cd.yml
Umi007 Jun 24, 2024
6f07be1
bugs fixed after merging
Jun 24, 2024
e75aeee
Update cd.yml
Umi007 Jun 24, 2024
84778e6
move events filert to landling page
liuyuanmeng Jun 24, 2024
73d57ea
Update Dockerfile
Umi007 Jun 24, 2024
3e62a4f
Merge pull request #14 from The-Socialites/feature/account
Umi007 Jun 24, 2024
8b17530
Merge branch 'main' into backendComments
Umi007 Jun 24, 2024
b25ee20
Merge pull request #13 from The-Socialites/backendComments
Umi007 Jun 24, 2024
95d457a
debugging
Umi007 Jun 24, 2024
ea378bf
Update cd.yml
Umi007 Jun 24, 2024
2aae54c
Update cd.yml
Umi007 Jun 24, 2024
a9f66de
Update cd.yml
Umi007 Jun 24, 2024
64f76ce
Update cd.yml
Umi007 Jun 24, 2024
e153a48
Update cd.yml
Umi007 Jun 24, 2024
6ac58a8
Update cd.yml
Umi007 Jun 24, 2024
030915a
Update cd.yml
Umi007 Jun 24, 2024
0227bdf
added request mapping
Umi007 Jun 24, 2024
c7b6972
added request mapping
Umi007 Jun 24, 2024
be31edd
third-party events now searchable by date
Jun 24, 2024
f717b91
Merge branch 'main' into backendComments
Jun 24, 2024
c82ae05
fix nav
liuyuanmeng Jun 24, 2024
7b8dba9
Debugging
Umi007 Jun 24, 2024
757ce31
debug
Umi007 Jun 24, 2024
9aeb804
fix nav bar and add api events css
liuyuanmeng Jun 24, 2024
b1f0b26
pom.xml bugs fixed from Daisy's code
Jun 24, 2024
2b248da
Merge branch 'main' into backendComments
Rachel853 Jun 24, 2024
fa7d813
integrated s3
Umi007 Jun 24, 2024
2e666c4
Merge pull request #15 from The-Socialites/backendComments
Umi007 Jun 24, 2024
3008793
Merge pull request #17 from The-Socialites/actual-s3-integration
Umi007 Jun 24, 2024
daa3697
push again
liuyuanmeng Jun 24, 2024
7f1fa8d
Merge branch 'main' into feature/account
liuyuanmeng Jun 24, 2024
38ec389
Merge pull request #18 from The-Socialites/feature/account
liuyuanmeng Jun 24, 2024
bb0d443
fix account css and add search for api events
liuyuanmeng Jun 24, 2024
0f4f703
add link to events list
liuyuanmeng Jun 25, 2024
1e5c09d
Merge pull request #19 from The-Socialites/feature/account
Umi007 Jun 25, 2024
fee2c68
add search for event's location, owner, title, add logo
liuyuanmeng Jun 25, 2024
437ca45
Merge pull request #20 from The-Socialites/feature/account
Umi007 Jun 25, 2024
1864193
added db migration
Umi007 Jun 25, 2024
35d40c5
test in google
liuyuanmeng Jun 25, 2024
36e51e3
Merge remote-tracking branch 'origin/main' into feature/account
liuyuanmeng Jun 25, 2024
337dc9a
cleverly created frontend and backend 'Attending' functionality in Ma…
Jun 25, 2024
7ce4cbe
Merge branch 'main' into AttendingFunctionality
Rachel853 Jun 25, 2024
ba86f75
allow google login user to see account page
liuyuanmeng Jun 25, 2024
d60c85d
Merge pull request #21 from The-Socialites/AttendingFunctionality
Umi007 Jun 25, 2024
f34b687
imports for landingPageController
Jun 25, 2024
13941b6
merged with main
Jun 25, 2024
c599654
events/attend/** removed from authorizeReqs in Security Config
Jun 25, 2024
d030f82
Merge pull request #22 from The-Socialites/bug/non-logged-in-users-se…
Umi007 Jun 25, 2024
d61800c
changed user journey after logging in
Umi007 Jun 25, 2024
74019b0
add isAuthenticated checker
liuyuanmeng Jun 26, 2024
d325a0f
Merge remote-tracking branch 'origin/main' into feature/account
liuyuanmeng Jun 26, 2024
c4e85d6
added encryption, updated update account feature
EthanDunwiddie Jun 26, 2024
bfa0f6e
add logout
liuyuanmeng Jun 26, 2024
7925f43
Merge pull request #23 from The-Socialites/feature/account
Umi007 Jun 26, 2024
b770bb6
dealing with CORS issue
Umi007 Jun 26, 2024
d870e18
Merge remote-tracking branch 'refs/remotes/origin/main'
Umi007 Jun 26, 2024
a42dc3a
Update README.md
Umi007 Jun 26, 2024
5b787eb
fixed mapping issue
Umi007 Jun 26, 2024
dd840ac
updated password check for google login users
EthanDunwiddie Jun 26, 2024
e9edf77
A whole load of styling
Hakim-Kay Jun 26, 2024
3d741c2
Merge pull request #24 from The-Socialites/feature/new.html
Hakim-Kay Jun 26, 2024
990314f
imports for landingPageController
Jun 25, 2024
f72e0b9
changed user journey after logging in
Umi007 Jun 25, 2024
a3f287e
dealing with CORS issue
Umi007 Jun 26, 2024
3e81fe8
fixed event details
Umi007 Jun 26, 2024
f2d2d42
nothing to commit
liuyuanmeng Jun 26, 2024
d0e0344
test in google
liuyuanmeng Jun 25, 2024
fcf590d
allow google login user to see account page
liuyuanmeng Jun 25, 2024
5b2ac54
add isAuthenticated checker
liuyuanmeng Jun 26, 2024
568805d
add logout
liuyuanmeng Jun 26, 2024
6db5e80
Update README.md
Umi007 Jun 26, 2024
da2fde0
fixed mapping issue
Umi007 Jun 26, 2024
d18f875
fix conflicts
liuyuanmeng Jun 26, 2024
4703fa2
added encryption, updated update account feature
EthanDunwiddie Jun 26, 2024
d5bee05
updated account details for OAuth2 users
EthanDunwiddie Jun 26, 2024
d67d63d
adjusted app-dev-properties comments
EthanDunwiddie Jun 26, 2024
e3cbcc0
imports for landingPageController
Jun 25, 2024
f6bd42c
events/attend/** removed from authorizeReqs in Security Config
Jun 25, 2024
cb9bd3d
test in google
liuyuanmeng Jun 25, 2024
bdf84ca
allow google login user to see account page
liuyuanmeng Jun 25, 2024
1f9a183
A whole load of styling
Hakim-Kay Jun 26, 2024
7c6f461
fixed event details
Umi007 Jun 26, 2024
722aa64
added encryption, updated update account feature
EthanDunwiddie Jun 26, 2024
28c8d82
test in google
liuyuanmeng Jun 25, 2024
60198b2
allow google login user to see account page
liuyuanmeng Jun 25, 2024
b94f7e3
added encryption, updated update account feature
EthanDunwiddie Jun 26, 2024
8bad661
fixed merge conflicts
EthanDunwiddie Jun 26, 2024
d7d37fe
Merge branch 'main' into password_encoding
EthanDunwiddie Jun 26, 2024
23f91de
Merge pull request #25 from The-Socialites/password_encoding
EthanDunwiddie Jun 26, 2024
2b5dd5f
save my work
liuyuanmeng Jun 26, 2024
6208ab7
fix
liuyuanmeng Jun 26, 2024
2242649
fixed id
EthanDunwiddie Jun 26, 2024
c71195f
updated user controller
EthanDunwiddie Jun 26, 2024
bc3f9e0
add external links
liuyuanmeng Jun 26, 2024
ee8ebc8
Merge pull request #26 from The-Socialites/feature/landingPage
EthanDunwiddie Jun 26, 2024
57321d6
nothing
Umi007 Jun 26, 2024
17013c9
Merge remote-tracking branch 'refs/remotes/origin/main'
Umi007 Jun 26, 2024
02aabf8
custom error handler
EthanDunwiddie Jun 26, 2024
fc3aae6
Merge pull request #28 from The-Socialites/errorHandling
Umi007 Jun 26, 2024
59396e8
reverted to before password encoding
Umi007 Jun 26, 2024
64ef403
Merge pull request #29 from The-Socialites/fixing-account-page
Umi007 Jun 26, 2024
c35f070
Update UserController.java
Umi007 Jun 26, 2024
db9c844
A whole load of styling
Hakim-Kay Jun 26, 2024
2b158c9
old details page
Hakim-Kay Jun 27, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -12,6 +12,8 @@
import org.springframework.security.web.SecurityFilterChain;

@EnableWebSecurity


@Configuration
public class SecurityConfig {

@@ -30,7 +32,7 @@ public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Excepti
.cors().and()
.authorizeRequests(authorizeRequests ->
authorizeRequests
.antMatchers("/", "/login", "/register","/images/**", "/users","/error/**", "/styles/**", "/search", "/events", "/events/attend/**", "/oauth2/**", "/assets/**", "/events/details/**").permitAll()
.antMatchers("/", "/login", "/register","/images/**", "/users","/error/**", "/styles/**", "/search", "/events", "/oauth2/**", "/assets/**","/events/details/**","/events/third-party-events").permitAll()
.anyRequest().authenticated()
)
.formLogin(formLogin ->
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
package com.makersacademy.acebook.controller;

import com.makersacademy.acebook.model.Attendee;
import com.makersacademy.acebook.model.Event;
import com.makersacademy.acebook.model.User;
import com.makersacademy.acebook.repository.AttendeesRepository;
import com.makersacademy.acebook.repository.EventRepository;
import com.makersacademy.acebook.repository.UserRepository;
import com.makersacademy.acebook.service.AttendeesService;
import com.makersacademy.acebook.service.SearchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.oauth2.core.user.OAuth2User;
@@ -20,12 +21,8 @@
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.view.RedirectView;

import com.makersacademy.acebook.model.Attendee;
import com.makersacademy.acebook.service.AttendeesService;

import java.util.Date;
import java.util.List;
import java.util.Optional;

@CrossOrigin
@Controller
@@ -74,14 +71,14 @@ public String userEvents(Model model,
} else if (minScheduledDate != null && maxScheduledDate != null) {
events = eventRepository.findByScheduledDateBetween(minScheduledDate, maxScheduledDate);
} else {
events = eventRepository.findAllByOrderByScheduledDate();
events = eventRepository.findAllByOrderByScheduledDateDesc();
}

User user = userRepository.findByUsername(username);
for (Event event: events) {
event.setAttendees(attendeesRepository.countByEvent(event));
Attendee userAttendee = attendeesRepository.findByUserAndEvent(user, event);
event.setUserAttending(userAttendee != null);
List<Attendee> userAttendees = attendeesRepository.findByUserAndEvent(user, event);
event.setUserAttending(!userAttendees.isEmpty());
}

List<User> users = userRepository.findAll();
Original file line number Diff line number Diff line change
@@ -13,6 +13,6 @@ public String login() {

@GetMapping("/loginSuccess")
public String loginSuccess() {
return "redirect:/ ";
return "redirect:/";
}
}
Original file line number Diff line number Diff line change
@@ -15,34 +15,42 @@
import org.springframework.web.servlet.mvc.support.RedirectAttributes;

@Controller
@RequestMapping("/account")
public class UserController {

@Autowired
private UserService userService;


@GetMapping
@GetMapping("/account")
public String accountPage(@AuthenticationPrincipal Object principal, Model model) {
User user = null;
// boolean isAuthenticated = false;


if (principal instanceof UserDetails) {
UserDetails currentUser = (UserDetails) principal;
user = userService.findByUsername(currentUser.getUsername());
// isAuthenticated = true;

} else if (principal instanceof OAuth2User) {
OAuth2User oauthUser = (OAuth2User) principal;
String email = oauthUser.getAttribute("email");
user = userService.findByEmail(email);
// isAuthenticated = true;

}

if (user != null) {
model.addAttribute("user", user);
// model.addAttribute("isAuthenticated", isAuthenticated);

return "/account";
} else {
return "redirect:/login";
}
}

@PostMapping
@PostMapping("/account")
public String updateAccount(@AuthenticationPrincipal Object principal, User updatedUser, RedirectAttributes redirectAttributes) {
User user = null;

@@ -93,7 +101,7 @@ public String updateAccount(@AuthenticationPrincipal Object principal, User upda
return "redirect:/account";
}

@GetMapping("/password")
@GetMapping("/account/password")
public String passwordPage(@AuthenticationPrincipal Object principal, RedirectAttributes redirectAttributes, Model model) {
User user = null;

@@ -121,7 +129,7 @@ public String passwordPage(@AuthenticationPrincipal Object principal, RedirectAt
return "updatePassword";
}

@PostMapping("/password")
@PostMapping("/account/password")
public String changePassword(@AuthenticationPrincipal Object principal, String newPassword, String confirmPassword, RedirectAttributes redirectAttributes) {
User user = null;

@@ -155,7 +163,7 @@ public String changePassword(@AuthenticationPrincipal Object principal, String n
return "redirect:/account";
}

@GetMapping("/login/oauth2/code/google")
@GetMapping("/account/login/oauth2/code/google")
public String handleGoogleLogin(OAuth2AuthenticationToken token, RedirectAttributes redirectAttributes) {
OAuth2User oauthUser = token.getPrincipal();
String email = oauthUser.getAttribute("email");
Original file line number Diff line number Diff line change
@@ -9,5 +9,6 @@

public interface AttendeesRepository extends CrudRepository<Attendee, Long> {
public Long countByEvent (Event event);
public Attendee findByUserAndEvent(User user, Event event);
// Modify this method to return a List of attendees
List<Attendee> findByUserAndEvent(User user, Event event);
}
Original file line number Diff line number Diff line change
@@ -10,12 +10,12 @@

public interface EventRepository extends CrudRepository<Event, Long> {

// Method to fetch all events ordered by scheduledDate
List<Event> findAllByOrderByScheduledDate();


// Method to find events by a specific scheduledDate
List<Event> findByScheduledDateBetween(Date minScheduledDate, Date maxScheduledDate);

// Searching term
@Query("SELECT e FROM Event e WHERE LOWER(e.title) LIKE LOWER(CONCAT('%', :keyword, '%')) OR LOWER(e.user.username) LIKE LOWER(CONCAT('%', :keyword, '%')) OR LOWER(e.location) LIKE LOWER(CONCAT('%', :keyword, '%'))")
List<Event> searchEventsByTitleOrUsernameOrLocation(@Param("keyword") String keyword);
}
// Method to fetch all events ordered by scheduledDate in descending order
List<Event> findAllByOrderByScheduledDateDesc();}
Original file line number Diff line number Diff line change
@@ -4,13 +4,10 @@
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface UserRepository extends JpaRepository<User, Long> {
User findByUsername(String username);
User findIdByUsername(String name);
User findByEmail(String email);
List<User> findByUsernameContaining(String username);

}
12 changes: 0 additions & 12 deletions src/main/resources/templates/events/details.html
Original file line number Diff line number Diff line change
@@ -28,19 +28,7 @@ <h1>Event Details</h1>
<strong>Host:</strong> <span th:text="${event.user.username}"></span>
</div>

<form action="#" th:action="@{/events/details/{id}/comments/new(id=${{event.id}})}" th:object="${comment}" method="post">
<p>Comment: <input type="text" th:field="*{content}" /></p>
<p><input type="submit" value="Submit" /> <input type="reset" value="Reset" /></p>
</form>

<h5 th:text="${comments.isEmpty}? 'No comments yet' : 'Comments'"></h5>
<ul>
<li th:each="comment : ${comments}">
<p th:text="${comment.user.username}"></p>
<p th:text="${comment.formattedCreatedAt}"></p>
<p th:text="${comment.content}"></p>
</li>
</ul>


</body>
70 changes: 70 additions & 0 deletions src/main/resources/templates/fragments/dark-mode.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<style>
/* Light Mode Styles */
.light-mode {
background-color: #f7fafc; /* Tailwind light mode bg-gray-100 */
color: #1a202c; /* Tailwind light mode text-gray-900 */
}

/* Dark Mode Styles */
.dark-mode {
background-color: #1a202c; /* Tailwind dark mode bg-gray-900 */
color: #cbd5e0; /* Tailwind dark mode text-gray-300 */
}

/* Additional Styles for Body Element */
body.light-mode {
background-color: #f7fafc;
color: #1a202c;
}

body.dark-mode {
background-color: #1a202c;
color: #cbd5e0;
}
</style>
</head>
<body>
<div th:fragment="dark-mode">
<!-- Dark Mode Toggle Button -->
<button id="dark-mode-toggle" class="p-2 bg-gray-200 dark:bg-gray-800 rounded ml-4 text-gray-800 dark:text-gray-200">
<i id="dark-mode-icon" class="fas fa-moon"></i>
</button>

<!-- Dark Mode Script -->
<script>
document.addEventListener("DOMContentLoaded", function() {
const toggleButton = document.getElementById('dark-mode-toggle');
const darkModeIcon = document.getElementById('dark-mode-icon');
const bodyElement = document.body;
const currentTheme = localStorage.getItem('theme');

if (currentTheme === 'dark') {
bodyElement.classList.remove('light-mode');
bodyElement.classList.add('dark-mode');
darkModeIcon.classList.remove('fa-moon');
darkModeIcon.classList.add('fa-sun');
}

toggleButton.addEventListener('click', function() {
if (bodyElement.classList.contains('dark-mode')) {
bodyElement.classList.remove('dark-mode');
bodyElement.classList.add('light-mode');
localStorage.setItem('theme', 'light');
darkModeIcon.classList.remove('fa-sun');
darkModeIcon.classList.add('fa-moon');
} else {
bodyElement.classList.remove('light-mode');
bodyElement.classList.add('dark-mode');
localStorage.setItem('theme', 'dark');
darkModeIcon.classList.remove('fa-moon');
darkModeIcon.classList.add('fa-sun');
}
});
});
</script>
</div>
</body>
</html>
20 changes: 7 additions & 13 deletions src/main/resources/templates/fragments/loyout.html
Original file line number Diff line number Diff line change
@@ -1,21 +1,15 @@
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My Application</title>
<link rel="stylesheet" th:href="@{/css/styles.css}">
<title th:fragment="title">My Website</title>
<link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet">
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://kit.fontawesome.com/a076d05399.js" crossorigin="anonymous"></script>
</head>
<body>
<!-- Navigation Bar -->
<body class="light-mode">
<!-- Include Navbar -->
<div th:replace="fragments/navbar :: navbar"></div>

<!-- Main Content -->
<div th:fragment="content">
<p>Content goes here...</p>
</div>

<!-- Footer -->
<div th:replace="fragments/footer :: footer"></div>
</body>
</html>
<!-- Page-specific content
7 changes: 5 additions & 2 deletions src/main/resources/templates/fragments/navbar.html
Original file line number Diff line number Diff line change
@@ -3,6 +3,8 @@
<head>
<link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet">
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://kit.fontawesome.com/a076d05399.js" crossorigin="anonymous"></script>

<style>
.rounded-circle {
border-radius: 9999px;
@@ -17,7 +19,6 @@
}
</style>
</head>

<body>
<div th:fragment="navbar">
<nav class="flex w-full items-center border-b border-border-primary bg-background-primary lg:min-h-18 lg:px-[5%]">
@@ -56,10 +57,12 @@
<a href="/register" class="block py-3 text-md focus-visible:outline-none lg:px-4 lg:py-2 lg:text-base">Signup</a>
</button>
</div>
<!-- Include Dark Mode Fragment -->
<div th:replace="fragments/dark-mode :: dark-mode"></div>
</div>
</div>
</div>
</nav>
</div>
</body>
</html>
</html>
95 changes: 87 additions & 8 deletions src/main/resources/templates/landingpage.html
Original file line number Diff line number Diff line change
@@ -3,9 +3,13 @@
<head>
<title>Website-Hosted Events</title>
<link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet">
<script src="https://cdn.tailwindcss.com"></script></head>
<body>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css">
</head>
<body class="light-mode">
<div th:replace="fragments/navbar :: navbar"></div>


<form action="/" method="get" class="p-4 bg-gray-100 rounded-lg mb-8">
<div class="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-4 gap-4">
<div>
@@ -16,36 +20,111 @@
<label for="maxScheduledDate" class="block text-lg font-medium text-gray-700">End Date</label>
<input type="date" id="maxScheduledDate" name="maxScheduledDate" placeholder="End Date" class="mt-1 p-2 border border-gray-300 rounded-md w-full">
</div>
<!-- searching keyword-->
<div>
<label for="keyword" class="block text-lg font-medium text-gray-700">Search Keyword</label>
<input type="text" id="keyword" name="keyword" placeholder="Search events by title, location, or username" class="mt-1 p-2 border border-gray-300 rounded-md w-full">
</div>

<div class="flex items-end">
<button type="submit" class="px-4 py-2 bg-gray-500 text-white font-bold rounded-md hover:bg-gray-700">Search</button> </div>
<button type="submit" class="px-4 py-2 bg-gray-500 text-white font-bold rounded-md hover:bg-gray-700">Search</button>
</div>
</div>
</form>

<section class="px-[5%] py-8 md:py-12 lg:py-16">
<div class="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-8 lg:grid-cols-8 gap-8 text-center">
<div>
<a href="https://open.spotify.com/" class="block text-gray-700 hover:text-blue-500 flex flex-col items-center">
<div class="flex items-center justify-center w-16 h-16 rounded-full border-2 border-gray-300 mt-4 mb-4">
<i class="fas fa-music text-4xl"></i>
</div>
<p>Music</p>
</a>
</div>
<div>
<a href="https://www.timeout.com/london/nightlife" class="block text-gray-700 hover:text-blue-500 flex flex-col items-center">
<div class="flex items-center justify-center w-16 h-16 rounded-full border-2 border-gray-300 mt-4 mb-4">
<i class="fas fa-glass-cheers text-4xl"></i>
</div>
<p>Nightlife</p>
</a>
</div>
<div>
<a href="https://tinder.com/en-GB" class="block text-gray-700 hover:text-blue-500 flex flex-col items-center">
<div class="flex items-center justify-center w-16 h-16 rounded-full border-2 border-gray-300 mt-4 mb-4">
<i class="fas fa-heart text-4xl"></i>
</div>
<p>Dating</p>
</a>
</div>
<div>
<a href="https://www.burlapandblue.com/list-of-hobbies/" class="block text-gray-700 hover:text-blue-500 flex flex-col items-center">
<div class="flex items-center justify-center w-16 h-16 rounded-full border-2 border-gray-300 mt-4 mb-4">
<i class="fas fa-gamepad text-4xl"></i>
</div>
<p>Hobbies</p>
</a>
</div>
<div>
<a href="https://www.eventbrite.co.uk/d/united-kingdom--london/free--business--events/" class="block text-gray-700 hover:text-blue-500 flex flex-col items-center">
<div class="flex items-center justify-center w-16 h-16 rounded-full border-2 border-gray-300 mt-4 mb-4">
<i class="fas fa-briefcase text-4xl"></i>
</div>
<p>Business</p>
</a>
</div>
<div>
<a href="https://www.timeout.com/london/food-drink" class="block text-gray-700 hover:text-blue-500 flex flex-col items-center">
<div class="flex items-center justify-center w-16 h-16 rounded-full border-2 border-gray-300 mt-4 mb-4">
<i class="fas fa-utensils text-4xl"></i>
</div>
<p>Food & Drink</p>
</a>
</div>
<div>
<a href="https://www.battersea.org.uk/" class="block text-gray-700 hover:text-blue-500 flex flex-col items-center">
<div class="flex items-center justify-center w-16 h-16 rounded-full border-2 border-gray-300 mt-4 mb-4">
<i class="fas fa-paw text-4xl"></i>
</div>
<p>Pets</p>
</a>
</div>
<div>
<a href="https://www.houseplant.co.uk/collections/house-plants-indoor-plants" class="block text-gray-700 hover:text-blue-500 flex flex-col items-center">
<div class="flex items-center justify-center w-16 h-16 rounded-full border-2 border-gray-300 mt-4 mb-4">
<i class="fas fa-seedling text-4xl"></i>
</div>
<p>Plants</p>
</a>
</div>
</div>
</section>

<section class="px-[5%] py-16 md:py-24 lg:py-28">
<h1 class="text-3xl font-bold md:text-7xl lg:text-8xl mb-8">Events</h1>
<h3 class="text-3xl font-bold md:text-7xl lg:text-8xl mb-8">Events</h3>
<ul>
<div class="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-4 gap-4">
<li th:each="event : ${events}" class="mb-4 p-4 bg-white rounded-lg shadow-md">
<a th:href="@{/events/details/{eventId}(eventId=${event.id})}">
<div class="text-lg">
<img th:src="${event.eventImageUrl}" th:if="${event.eventImageUrl}" alt="Event Image" class="mt-2 rounded-lg w-full h-auto"/>
<img th:src="@{/images/default_image.jpeg}" th:unless="${event.eventImageUrl}" alt="Default Event Image" class="mt-2 rounded-lg w-full h-auto"/>
</div>
<div class="text-lg"><strong>Title:</strong> <span th:text="${event.title}"></span></div>
<div class="text-lg"><strong>Description:</strong> <span th:text="${event.description}"></span></div>
<div class="text-lg"><strong>Date:</strong> <span th:text="${#dates.format(event.scheduledDate, 'yyyy-MM-dd')}"></span></div>
<div class="text-lg"><strong>Time:</strong> <span th:text="${event.scheduledStartTime}"></span></div>
</a>
<form th:if="${!event.userAttending}" th:action="@{/events/attend/{id}(id=${event.id})}" method="post">
<p><input type="submit" value="I'm Attending!" /></p>
<button type="submit" class="mt-2 px-4 py-2 bg-gray-500 text-white rounded-lg hover:bg-blue-700">
Attend this Event
</button>
</form>
<p th:if="${event.userAttending}">You are attending this event!</p>
<p th:text="'Current number of attendees: ' + ${event.attendees}" ></p>
</li>
</div>
</ul>
</section>

</body>
</html>
</html>
6 changes: 3 additions & 3 deletions tailwind.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/** @type {import('tailwindcss').Config} */
module.exports = {
darkMode: 'class', // Enable class-based dark mode
content: [
"./pages/**/*.{js,ts,jsx,tsx,mdx}",
"./components/**/*.{js,ts,jsx,tsx,mdx}",
@@ -10,11 +11,10 @@ module.exports = {
extend: {
backgroundImage: {
"gradient-radial": "radial-gradient(var(--tw-gradient-stops))",
"gradient-conic":
"conic-gradient(from 180deg at 50% 50%, var(--tw-gradient-stops))",
"gradient-conic": "conic-gradient(from 180deg at 50% 50%, var(--tw-gradient-stops))",
},
},
},
presets: [require("@relume_io/relume-tailwind")],
plugins: [],
};
};