@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user