Update License And partner

This commit is contained in:
aditya.siregar
2024-08-11 22:32:09 +07:00
parent 1bfbc1bccc
commit 4c8999a3cf
3 changed files with 18 additions and 3 deletions
+9 -3
View File
@@ -62,13 +62,19 @@ func (u *AuthServiceImpl) AuthenticateUser(ctx context.Context, email, password
var licensePartner entity.PartnerLicense
if user.PartnerID != nil && *user.PartnerID != 0 {
parterLicense, err := u.license.FindByPartnerIDMaxEndDate(ctx, user.PartnerID)
partnerLicense, err := u.license.FindByPartnerIDMaxEndDate(ctx, user.PartnerID)
if err != nil {
logger.ContextLogger(ctx).Error("error when get user license", zap.Error(err))
return nil, errors.ErrorInternalServer
}
if parterLicense != nil {
licensePartner = parterLicense.ToPartnerLicense()
if partnerLicense == nil {
return nil, errors.ErrorInvalidLicense
}
licensePartner = partnerLicense.ToPartnerLicense()
if licensePartner.LicenseStatus == "EXPIRED" {
return nil, errors.ErrorInvalidLicense
}
}