Skip to content
Merged

done #81

Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions backend/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,6 @@ build/

### upload files ###
uploads/

# Local run script
run-backend.ps1
10 changes: 10 additions & 0 deletions backend/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,16 @@ spec:
secretKeyRef:
name: gemini-api-key
key: latest
- name: GROQ_API_KEY
valueFrom:
secretKeyRef:
name: groq-api-key
key: latest
- name: OPENROUTER_API_KEY
valueFrom:
secretKeyRef:
name: openrouter-api-key
key: latest

- name: JWT_SECRET
valueFrom:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.thughari.jobtrackerpro.config;

import com.thughari.jobtrackerpro.repo.UserRepository;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class StartupInitializer implements CommandLineRunner {

private final UserRepository userRepository;

public StartupInitializer(UserRepository userRepository) {
this.userRepository = userRepository;
}

@Override
public void run(String... args) throws Exception {
log.info("System Startup: Resetting all active Gmail sync locks.");
userRepository.resetAllSyncLocks();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public ResponseEntity<String> connectGmail(@RequestBody Map<String, String> body

try {
gmailAutomationService.connectAndSetupPush(authCode, email);
gmailAutomationService.initiateManualSync(email);
return ResponseEntity.ok("Gmail Automation enabled successfully.");
} catch (Exception e) {
log.error("Failed to setup Gmail for user {}: {}", email, e.getMessage());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@
import lombok.AllArgsConstructor;
import lombok.Data;

import java.io.Serializable;

@Data
@AllArgsConstructor
public class ChartData {
public class ChartData implements Serializable {
private static final long serialVersionUID = 1L;
private String name;
private long value;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,15 @@
import lombok.Data;
import java.util.List;

import java.io.Serializable;

@Data
public class DashboardResponse {
public class DashboardResponse implements Serializable {
private static final long serialVersionUID = 1L;
private DashboardStatsDTO stats;
private List<ChartData> statusChart;
private List<ChartData> monthlyChart;
private List<ChartData> interviewChart;
private boolean gmailSyncInProgress;
private String gmailSyncStatus;
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@
import lombok.AllArgsConstructor;
import lombok.Data;

import java.io.Serializable;

@Data
@AllArgsConstructor
public class DashboardStatsDTO {
public class DashboardStatsDTO implements Serializable {
private static final long serialVersionUID = 1L;
private long totalApplications;
private long activePipeline;
private long interviews;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ public class User {
@Column(name = "gmail_sync_started_at")
private LocalDateTime gmailSyncStartedAt;

@Column(name = "gmail_sync_status")
private String gmailSyncStatus;

@Column(name = "gmail_connected")
private Boolean gmailConnected = false;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.thughari.jobtrackerpro.exception;

public class AiQuotaExceededException extends RuntimeException {
public AiQuotaExceededException(String message) {
super(message);
}
public AiQuotaExceededException(String message, Throwable cause) {
super(message, cause);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import com.thughari.jobtrackerpro.dto.EmailBatchItem;
import com.thughari.jobtrackerpro.dto.JobDTO;

public interface GeminiService {
public interface AiExtractionService {

JobDTO extractJobFromEmail(String from, String subject, String body);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,16 @@ public interface UserRepository extends JpaRepository<User, UUID> {
@Query("UPDATE User u SET u.gmailSyncInProgress = false WHERE u.email = :email")
void releaseSyncLock(@Param("email") String email);

@Modifying
@Transactional
@Query("UPDATE User u SET u.gmailSyncInProgress = false, u.gmailSyncStatus = null")
void resetAllSyncLocks();

@Modifying
@Transactional
@Query("UPDATE User u SET u.gmailSyncStatus = :status WHERE u.email = :email")
void updateSyncStatus(@Param("email") String email, @Param("status") String status);

List<User> findByGmailConnectedTrue();

@Modifying
Expand Down
Loading
Loading