feat: ftime logic for usertitle is changed
This commit is contained in:
parent
5acc53ec9d
commit
00894f4526
12 changed files with 113 additions and 35 deletions
|
|
@ -69,6 +69,16 @@ func sqlDate2oapi(p_date pgtype.Timestamptz) *time.Time {
|
|||
return nil
|
||||
}
|
||||
|
||||
func oapiDate2sql(t *time.Time) pgtype.Timestamptz {
|
||||
if t == nil {
|
||||
return pgtype.Timestamptz{Valid: false}
|
||||
}
|
||||
return pgtype.Timestamptz{
|
||||
Time: *t,
|
||||
Valid: true,
|
||||
}
|
||||
}
|
||||
|
||||
// func UserTitleStatus2Sqlc(s *[]oapi.UserTitleStatus) (*SqlcUserStatus, error) {
|
||||
// var sqlc_status SqlcUserStatus
|
||||
// if s == nil {
|
||||
|
|
@ -365,6 +375,7 @@ func (s Server) AddUserTitle(ctx context.Context, request oapi.AddUserTitleReque
|
|||
TitleID: request.Body.TitleId,
|
||||
Status: *status,
|
||||
Rate: request.Body.Rate,
|
||||
Ftime: oapiDate2sql(request.Body.Ftime),
|
||||
}
|
||||
|
||||
user_title, err := s.db.InsertUserTitle(ctx, params)
|
||||
|
|
@ -428,6 +439,7 @@ func (s Server) UpdateUserTitle(ctx context.Context, request oapi.UpdateUserTitl
|
|||
Rate: request.Body.Rate,
|
||||
UserID: request.UserId,
|
||||
TitleID: request.TitleId,
|
||||
Ftime: oapiDate2sql(request.Body.Ftime),
|
||||
}
|
||||
|
||||
user_title, err := s.db.UpdateUserTitle(ctx, params)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue