feat: add order module

This commit is contained in:
Rogee
2025-01-10 16:54:33 +08:00
parent 2ba8ed7dbd
commit ca1b4cdd12
17 changed files with 456 additions and 40 deletions

View File

@@ -228,3 +228,29 @@ func (svc *Service) SetUserStatusByID(ctx context.Context, userID int64, status
}
return nil
}
// GetUserOAuthChannels
func (svc *Service) GetUserOAuthChannels(ctx context.Context, userID int64) ([]model.UserOauths, error) {
_, span := otel.Start(ctx, "users.service.GetUserOAuthChannels")
defer span.End()
span.SetAttributes(
attribute.Int64("user.id", userID),
)
tbl := table.UserOauths
stmt := tbl.
SELECT(
tbl.Channel,
tbl.ExpireAt,
).
WHERE(
tbl.UserID.EQ(Int64(userID)),
)
span.SetAttributes(semconv.DBStatementKey.String(stmt.DebugSql()))
var oauths []model.UserOauths
if err := stmt.QueryContext(ctx, svc.db, &oauths); err != nil {
return nil, err
}
return oauths, nil
}