chore: commit pending changes
This commit is contained in:
parent
2168f96bf6
commit
694f6c3313
14 changed files with 25 additions and 15 deletions
|
|
@ -69,22 +69,13 @@ func (uc *UpdateUserUseCase) Execute(ctx context.Context, id, tenantID string, i
|
||||||
user.AvatarUrl = *input.AvatarUrl
|
user.AvatarUrl = *input.AvatarUrl
|
||||||
}
|
}
|
||||||
|
|
||||||
// HEAD Extra Fields
|
// Profile Fields
|
||||||
if input.Bio != nil {
|
|
||||||
user.Bio = *input.Bio
|
|
||||||
}
|
|
||||||
if input.ProfilePictureURL != nil {
|
if input.ProfilePictureURL != nil {
|
||||||
user.ProfilePictureURL = *input.ProfilePictureURL
|
user.ProfilePictureURL = *input.ProfilePictureURL
|
||||||
}
|
}
|
||||||
if len(input.Skills) > 0 {
|
if len(input.Skills) > 0 {
|
||||||
user.Skills = input.Skills
|
user.Skills = input.Skills
|
||||||
}
|
}
|
||||||
if len(input.Experience) > 0 {
|
|
||||||
user.Experience = input.Experience
|
|
||||||
}
|
|
||||||
if len(input.Education) > 0 {
|
|
||||||
user.Education = input.Education
|
|
||||||
}
|
|
||||||
|
|
||||||
// 4. Save
|
// 4. Save
|
||||||
updated, err := uc.userRepo.Update(ctx, user)
|
updated, err := uc.userRepo.Update(ctx, user)
|
||||||
|
|
|
||||||
|
|
@ -147,6 +147,16 @@ func executeMigration(filename, sqlContent string) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
log.Printf("⏭️ Migration %s skipped due to existing resources", filename)
|
log.Printf("⏭️ Migration %s skipped due to existing resources", filename)
|
||||||
|
tx.Rollback()
|
||||||
|
tx2, err := DB.Begin()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer tx2.Rollback()
|
||||||
|
if _, err := tx2.Exec("INSERT INTO schema_migrations (filename) VALUES ($1)", filename); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return tx2.Commit()
|
||||||
}
|
}
|
||||||
|
|
||||||
if _, err := tx.Exec("INSERT INTO schema_migrations (filename) VALUES ($1)", filename); err != nil {
|
if _, err := tx.Exec("INSERT INTO schema_migrations (filename) VALUES ($1)", filename); err != nil {
|
||||||
|
|
|
||||||
|
|
@ -164,7 +164,7 @@ func (h *ApplicationHandler) ListUserApplications(w http.ResponseWriter, r *http
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
apps, err := h.Service.ListUserApplications(userID)
|
apps, err := h.Service.GetApplicationsByUser(userID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
return
|
return
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,7 @@ func (h *TicketHandler) GetTicketByID(w http.ResponseWriter, r *http.Request) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
ticket, messages, err := h.service.GetTicket(r.Context(), id, userID)
|
ticket, messages, err := h.service.GetTicket(r.Context(), id, userID, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
http.Error(w, err.Error(), http.StatusNotFound)
|
http.Error(w, err.Error(), http.StatusNotFound)
|
||||||
return
|
return
|
||||||
|
|
@ -118,7 +118,7 @@ func (h *TicketHandler) AddTicketMessage(w http.ResponseWriter, r *http.Request)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
msg, err := h.service.AddMessage(r.Context(), id, userID, req.Message)
|
msg, err := h.service.AddMessage(r.Context(), id, userID, req.Message, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||||
return
|
return
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@ package services
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"database/sql"
|
"database/sql"
|
||||||
"fmt"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/rede5/gohorsejobs/backend/internal/models"
|
"github.com/rede5/gohorsejobs/backend/internal/models"
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@ package services
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"database/sql"
|
"database/sql"
|
||||||
"fmt"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/rede5/gohorsejobs/backend/internal/models"
|
"github.com/rede5/gohorsejobs/backend/internal/models"
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,17 @@ console.log('🔌 DB Config:', {
|
||||||
// Database connection configuration
|
// Database connection configuration
|
||||||
export const pool = new Pool(config);
|
export const pool = new Pool(config);
|
||||||
|
|
||||||
|
// Set search_path after connection
|
||||||
|
const originalConnect = pool.connect.bind(pool);
|
||||||
|
pool.connect = async () => {
|
||||||
|
const client = await originalConnect();
|
||||||
|
const dbUrl = process.env.DATABASE_URL || '';
|
||||||
|
if (dbUrl.includes('search_path=')) {
|
||||||
|
await client.query("SET search_path TO ghj");
|
||||||
|
}
|
||||||
|
return client;
|
||||||
|
};
|
||||||
|
|
||||||
// Test database connection
|
// Test database connection
|
||||||
export async function testConnection() {
|
export async function testConnection() {
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue