-
Notifications
You must be signed in to change notification settings - Fork 1
87 save customers #139
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
87 save customers #139
Conversation
Codecov Report
@@ Coverage Diff @@
## master #139 +/- ##
==========================================
- Coverage 92.42% 92.18% -0.25%
==========================================
Files 47 50 +3
Lines 449 499 +50
Branches 27 32 +5
==========================================
+ Hits 415 460 +45
- Misses 26 29 +3
- Partials 8 10 +2
Continue to review full report at Codecov.
|
| const messages$ = this.store.pipe(select(getStatusMessage)); | ||
| this.saveSubscription = messages$.subscribe((valueMessage) => { | ||
| this.setStatusOnScreen(valueMessage); | ||
| console.log(valueMessage); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, delete this console.log
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
| createCustomer(customerData): Observable<any> { | ||
| const body = { | ||
| ...customerData, | ||
| tenant_id: '4225ab1e-1033-4a5f-8650-0dd4950f38c8', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@enriquezrene Do we still need to set a tenant_id fake?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think @daros10 needs to talk to @macrisguncay to understand how to get the tenant_id from the session_storage. Good catch @jorgecod, ty.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changes was applied except this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@daros10 you can get the real tenant id and bearer token from session storage, I implemented these methods in AzureAdB2CService, please check it and use them please.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you @macrisguncay , @enriquezrene all review requesting was applied.
| import { Component, Input, Output, EventEmitter, OnDestroy, OnInit } from '@angular/core'; | ||
| import { Store, select } from '@ngrx/store'; | ||
| import { CustomerState, CreateCustomer } from 'src/app/modules/customer-management/store'; | ||
| import { FormGroup, FormBuilder, Validators } from '@angular/forms'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please sort imports by module.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
| import { TestBed, inject } from '@angular/core/testing'; | ||
|
|
||
| import { CustomerService } from './customer.service'; | ||
| import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please sort imports by module
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
| import { MockStore, provideMockStore } from '@ngrx/store/testing'; | ||
| import { CustomerState, CreateCustomer } from 'src/app/modules/customer-management/store'; | ||
| import { FormBuilder } from '@angular/forms'; | ||
| import { Customer } from 'src/app/modules/shared/models/customer.model'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The customer.model must be added in the index file in 'src/app/modules/shared/models/index.ts'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
| import { CreateCustomerComponent } from './create-customer'; | ||
| import { MockStore, provideMockStore } from '@ngrx/store/testing'; | ||
| import { CustomerState, CreateCustomer } from 'src/app/modules/customer-management/store'; | ||
| import { FormBuilder } from '@angular/forms'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please sort imports by module
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
| <div class="form-group"> | ||
| <div | ||
| *ngIf="showAlert && messageToShow !== ''" | ||
| [ngClass]="{'bg-secondary': messageToShow == 'Customer create successfully!', 'bg-primary': messageToShow != 'Customer create successfully!'}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo:
Customer created successfully!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
|
|
||
| component.setStatusOnScreen('Customer create successfully!'); | ||
|
|
||
| expect(component.messageToShow).toEqual('Customer create successfully!'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Customer created successfully
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
| expect(component.isActiveItemTabs).toBeTrue(); | ||
| }); | ||
|
|
||
| it('should be disabled tabs and show message Something went wrong creating customer! ', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it('should disable tabs and show a message "An error occurred, try again later." '
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
| }) | ||
| export class CreateCustomerComponent implements OnInit, OnDestroy { | ||
| customerForm: FormGroup; | ||
| @Input() isActiveItemTabs: boolean; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A better name would be:
areTabsActive
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
| createCustomer(customerData): Observable<any> { | ||
| const body = { | ||
| ...customerData, | ||
| tenant_id: '4225ab1e-1033-4a5f-8650-0dd4950f38c8', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think @daros10 needs to talk to @macrisguncay to understand how to get the tenant_id from the session_storage. Good catch @jorgecod, ty.
| ...customerData, | ||
| tenant_id: this.service.getTenantId(), | ||
| }; | ||
| console.log(this.service.getTenantId()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove the console.log please.
Issue #87.