three fields in log-in and race card reordering

This commit is contained in:
MathewFrancis 2025-08-17 14:16:14 +05:30
parent 8e9f84a2cf
commit 4c23c00df7
5 changed files with 34 additions and 15 deletions

View File

@ -1,4 +1,4 @@
package com.example.cezenBTC.DTO.user; package com.example.cezenBTC.DTO.user;
public record UserDataDTO(String userIdNumber, String userName) { public record UserDataDTO(String userIdNumber, String userName, String btId) {
} }

View File

@ -29,7 +29,9 @@ public class CezenCustomAuthenticationProviderForBTC implements AuthenticationPr
public Authentication authenticate(Authentication authentication) throws AuthenticationException { public Authentication authenticate(Authentication authentication) throws AuthenticationException {
//get credentials from login form //get credentials from login form
String userStringId = authentication.getName(); String[] karthickHamu = authentication.getName().split(",");
String userStringId = karthickHamu[0];
String btId = karthickHamu[1];
String pwd = authentication.getCredentials().toString(); String pwd = authentication.getCredentials().toString();
System.out.println("user Id " + userStringId + " password " + pwd); System.out.println("user Id " + userStringId + " password " + pwd);
@ -84,7 +86,7 @@ public class CezenCustomAuthenticationProviderForBTC implements AuthenticationPr
} }
System.out.println("Auth DONE"); System.out.println("Auth DONE");
return new UsernamePasswordAuthenticationToken(user.getUserIdNumber(), pwd, authorities); return new UsernamePasswordAuthenticationToken(user.getUserIdNumber()+","+btId, pwd, authorities);
} else { } else {
throw new BadCredentialsException("Invalid password!"); throw new BadCredentialsException("Invalid password!");
} }

View File

@ -73,6 +73,8 @@ public class CezenRoutsSecurityChain {
"http://172.16.11.60:4200", "http://172.16.11.60:4200",
"http://192.168.0.103:4200", "http://192.168.0.103:4200",
"http://192.168.1.110:4200", "http://192.168.1.110:4200",
"http://10.74.231.61:4200",
"http://192.168.0.103:4200",
dbIpAddress dbIpAddress
)); ));
//config.setAllowedOrigins(Collections.singletonList("*")); //config.setAllowedOrigins(Collections.singletonList("*"));

View File

@ -35,11 +35,14 @@ public class SignUpController {
Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
System.out.println("User name is " + authentication.getName()); // this is to venerate karthik garu and hamu
String[] garuHamu = authentication.getName().split(",");
UserEntity userEntity = this.btcUserService.getUserByUserId(authentication.getName()); System.out.println("User Id is " + garuHamu[0] + "the betting terminal id is " + garuHamu[1]);
return new UserDataDTO(userEntity.getUserIdNumber(), userEntity.getUserName()); UserEntity userEntity = this.btcUserService.getUserByUserId(garuHamu[0]);
return new UserDataDTO(userEntity.getUserIdNumber(), userEntity.getUserName(), garuHamu[1]);
} }

View File

@ -89,8 +89,12 @@ public class BtcRaceService {
//create race numbers //create race numbers
Set<Integer> races1 = new LinkedHashSet<>(List.of(1,2,3,4,5,6,7,8,10)); Set<Integer> races1 = new LinkedHashSet<>(List.of(1,2,3,4,5,6,7,8,10));
Set<Integer> races2 = new LinkedHashSet<>(List.of(2,4,6,8,10,12)); Set<Integer> races2 = new LinkedHashSet<>(List.of(2,4,6,8,10,12));
Set<Integer> races3 = new LinkedHashSet<>(List.of(1,2,3,5,7,8,9,10,11)); Set<Integer> races3 = new LinkedHashSet<>(List.of(1,2,3,4,5,6,7,8,9,10,11,12));
Set<Integer> races4 = new LinkedHashSet<>(List.of(1,2,3,4,5,6,7,8,10,12,13)); Set<Integer> races4 = new LinkedHashSet<>(List.of(1,2,3,4,5,6,7,8,10,12,13));
Set<Integer> races5 = new LinkedHashSet<>(List.of(1,2,3,4,5,6,7,8,10,11,12));
Set<Integer> races6 = new LinkedHashSet<>(List.of(2,4,6,8,10,12,13));
Set<Integer> races7 = new LinkedHashSet<>(List.of(1,2,3,5,7,8,9,10,11));
Set<Integer> races8 = new LinkedHashSet<>(List.of(1,2,3,4,5));
// create a Venue // create a Venue
Set<Set<Integer>> mysRaces = new LinkedHashSet<>(); Set<Set<Integer>> mysRaces = new LinkedHashSet<>();
@ -98,16 +102,24 @@ public class BtcRaceService {
mysRaces.add(races2); mysRaces.add(races2);
mysRaces.add(races3); mysRaces.add(races3);
mysRaces.add(races4); mysRaces.add(races4);
mysRaces.add(races5);
mysRaces.add(races6);
mysRaces.add(races7);
mysRaces.add(races8);
RaceVenueRaces raceVenueMYS = new RaceVenueRaces(mysRaces); RaceVenueRaces raceVenueMYS = new RaceVenueRaces(mysRaces);
//create a Pool combination //create a Pool combination
Set<Integer> pool1 = new LinkedHashSet<>(List.of(5, 6, 7)); Set<Integer> pool1 = new LinkedHashSet<>(List.of(5, 6, 7));
Set<Integer> pool2 = new LinkedHashSet<>(List.of(1, 2, 3)); Set<Integer> pool2 = new LinkedHashSet<>(List.of(1, 2, 3, 4));
Set<Integer> pool3 = new LinkedHashSet<>(List.of(2, 3, 4));
Set<Integer> pool4 = new LinkedHashSet<>(List.of(3, 4, 5, 6, 7));
// pole id to pool combo // pole id to pool combo
Map<String, Set<Integer>> mysPools = new LinkedHashMap<>(); Map<String, Set<Integer>> mysPools = new LinkedHashMap<>();
mysPools.put("TRB1", pool3);
mysPools.put("TRB2", pool1); mysPools.put("TRB2", pool1);
mysPools.put("MJP1", pool2); mysPools.put("MJP1", pool2);
mysPools.put("JPPI", pool4);
Pools mysPool = new Pools(mysPools); Pools mysPool = new Pools(mysPools);
RaceCard raceCard = new RaceCard("MYS", date, raceVenueMYS, mysPool); RaceCard raceCard = new RaceCard("MYS", date, raceVenueMYS, mysPool);