Doctor
Some checks failed
Go-test / build (push) Has been cancelled

This commit is contained in:
2025-12-01 15:55:31 +07:00
parent ffd7fa62de
commit 36e74d1238

View File

@@ -267,21 +267,21 @@ func (h *DoctorHandler) getDoctorByPoliID(ctx context.Context, dbConn *sql.DB, i
return &item, nil
}
func (h *DoctorHandler) createDoctor(ctx context.Context, dbConn *sql.DB, req *doctor.DoctorCreateRequest) (*doctor.Doctor, error) {
id := uuid.New().String()
now := time.Now()
// func (h *DoctorHandler) createDoctor(ctx context.Context, dbConn *sql.DB, req *doctor.DoctorCreateRequest) (*doctor.Doctor, error) {
// id := uuid.New().String()
// now := time.Now()
query := "INSERT INTO master.ms_doctor (id, status, date_created, date_updated, name) VALUES ($1, $2, $3, $4, $5) RETURNING id, status, sort, user_created, date_created, user_updated, date_updated, name"
row := dbConn.QueryRowContext(ctx, query, id, req.Status, now, now, req.Name)
// query := "INSERT INTO master.ms_doctor (id, status, date_created, date_updated, name) VALUES ($1, $2, $3, $4, $5) RETURNING id, status, sort, user_created, date_created, user_updated, date_updated, name"
// row := dbConn.QueryRowContext(ctx, query, id, req.Status, now, now, req.Name)
var item doctor.Doctor
err := row.Scan(&item.ID, &item.Status, &item.Sort, &item.UserCreated, &item.DateCreated, &item.UserUpdated, &item.DateUpdated, &item.Name)
if err != nil {
return nil, fmt.Errorf("failed to create doctor: %w", err)
}
// var item doctor.Doctor
// err := row.Scan(&item.ID, &item.Status, &item.Sort, &item.UserCreated, &item.DateCreated, &item.UserUpdated, &item.DateUpdated, &item.Name)
// if err != nil {
// return nil, fmt.Errorf("failed to create doctor: %w", err)
// }
return &item, nil
}
// return &item, nil
// }
// func (h *DoctorHandler) updateDoctor(ctx context.Context, dbConn *sql.DB, req *doctor.DoctorUpdateRequest) (*doctor.Doctor, error) {
// now := time.Now()