diff --git a/docker-compose.yml b/docker-compose.yml index 709082f9..ba3d1d7f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -11,4 +11,4 @@ services: volumes: - .:/unb-tv-web - /unb-tv-web/node_modules - command: ng serve --host 0 --port 4200 + command: ng serve --host 0 --port 4200 --poll 2000 diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 31eca30f..b1f37e8b 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -12,6 +12,8 @@ import { CheckCodeRestPasswordComponent } from './pages/check-code-rest-password import { ResetPasswordComponent } from './pages/reset-password/reset-password.component'; import { AuthGuard } from './services/auth.guard'; import { EditUserComponent } from './pages/edit-user/edit-user.component'; +import { SuggestAgendaComponent } from './pages/suggest-agenda/suggest-agenda.component'; +import { ParticipateComponent } from './pages/participate/participate.component'; const routes: Routes = [ { path: 'login', component: LoginComponent }, @@ -22,6 +24,8 @@ const routes: Routes = [ { path: 'activeAccount', component: ActiveAccountComponent }, { path: 'sendCodeResetPassword', component: CheckCodeRestPasswordComponent }, { path: 'changePassword', component: ResetPasswordComponent }, + { path: 'suggestAgenda', component: SuggestAgendaComponent }, + { path: 'participate', component: ParticipateComponent }, { path: 'profile', component: ProfileComponent, canActivate: [AuthGuard], }, { path: 'editUser/:id', component: EditUserComponent, canActivate: [AuthGuard], }, { path: '', component: HomePageComponent, canActivate: [AuthGuard], } diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 3d7a5c4e..85123e85 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -22,6 +22,8 @@ import { CheckCodeRestPasswordComponent } from './pages/check-code-rest-password import { AuthGuard } from './services/auth.guard'; import { AuthService } from './services/auth.service'; import { EditUserComponent } from './pages/edit-user/edit-user.component'; +import { SuggestAgendaComponent } from './pages/suggest-agenda/suggest-agenda.component'; +import { ParticipateComponent } from './pages/participate/participate.component'; @NgModule({ declarations: [ @@ -40,6 +42,8 @@ import { EditUserComponent } from './pages/edit-user/edit-user.component'; ResetPasswordComponent, CheckCodeRestPasswordComponent, EditUserComponent, + SuggestAgendaComponent, + ParticipateComponent, ], imports: [ BrowserModule, diff --git a/src/app/components/background/background.component.html b/src/app/components/background/background.component.html index a8cfbc76..530c9a93 100644 --- a/src/app/components/background/background.component.html +++ b/src/app/components/background/background.component.html @@ -8,7 +8,8 @@
Início
|
Agora na TV
|
Programação
| -
Transmissões
+
Transmissões
| +
Participe
hamburguer diff --git a/src/app/components/background/background.component.spec.ts b/src/app/components/background/background.component.spec.ts index c7ae10a4..53021daf 100644 --- a/src/app/components/background/background.component.spec.ts +++ b/src/app/components/background/background.component.spec.ts @@ -1,6 +1,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { BackgroundComponent } from './background.component'; +import { RouterTestingModule } from '@angular/router/testing'; describe('BackgroundComponent', () => { let component: BackgroundComponent; @@ -8,7 +9,8 @@ describe('BackgroundComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - declarations: [ BackgroundComponent ] + declarations: [ BackgroundComponent ], + imports: [RouterTestingModule] }) .compileComponents(); diff --git a/src/app/environment/environment.ts b/src/app/environment/environment.ts index e21e43da..6ed41a3c 100644 --- a/src/app/environment/environment.ts +++ b/src/app/environment/environment.ts @@ -1,4 +1,5 @@ export const EDUPLAY_CLIENT_KEY = "a1cdba06226408fcda63b49c50223c68d56005d234cc98bcdc1ae787d2b4de1d"; export const environment = { - apiURL: 'https://unb-tv-backend-2be1ed3a0485.herokuapp.com/api', + usersAPIURL: 'https://unb-tv-backend-2be1ed3a0485.herokuapp.com/api', + adminAPIURL: 'https://admin-unb-tv-2023-2-dc0dd53d3aca.herokuapp.com/api' }; diff --git a/src/app/pages/login-social/login-social.component.css b/src/app/pages/login-social/login-social.component.css index fcca13ed..807ed9e3 100644 --- a/src/app/pages/login-social/login-social.component.css +++ b/src/app/pages/login-social/login-social.component.css @@ -104,4 +104,5 @@ color: #0087C8; margin-left: -140px; margin-top: 18.5px -} \ No newline at end of file +} + diff --git a/src/app/pages/participate/participate.component.css b/src/app/pages/participate/participate.component.css new file mode 100644 index 00000000..2fe148f9 --- /dev/null +++ b/src/app/pages/participate/participate.component.css @@ -0,0 +1,25 @@ +.font-unb { + font-size: 13px; + font-family: "unb-pro", sans-serif; +} + +.containner h1 { + color: #0087C8; + font-size: 13px; + font-family: "unb-pro", sans-serif; + font-style: normal; + font-weight: 700; + line-height: 12.35px; + margin-left: 29px; + margin-top: 45px; + margin-bottom: 40px; + text-align: start; +} + +.containner { + width: 360px; + margin-left: auto; + margin-right: auto; + text-align: center; + height: -300px; +} \ No newline at end of file diff --git a/src/app/pages/participate/participate.component.html b/src/app/pages/participate/participate.component.html new file mode 100644 index 00000000..480da1f1 --- /dev/null +++ b/src/app/pages/participate/participate.component.html @@ -0,0 +1,9 @@ +
+

+ Sugira uma pauta +

+

+ Solicite uma transmissão +

+
+ diff --git a/src/app/pages/participate/participate.component.spec.ts b/src/app/pages/participate/participate.component.spec.ts new file mode 100644 index 00000000..4f87ffae --- /dev/null +++ b/src/app/pages/participate/participate.component.spec.ts @@ -0,0 +1,25 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { ParticipateComponent } from './participate.component'; +import { RouterTestingModule } from '@angular/router/testing'; + +describe('ParticipateComponent', () => { + let component: ParticipateComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ ParticipateComponent ], + imports: [ RouterTestingModule ] + }) + .compileComponents(); + + fixture = TestBed.createComponent(ParticipateComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/pages/participate/participate.component.ts b/src/app/pages/participate/participate.component.ts new file mode 100644 index 00000000..4632bd98 --- /dev/null +++ b/src/app/pages/participate/participate.component.ts @@ -0,0 +1,10 @@ +import { Component } from '@angular/core'; + +@Component({ + selector: 'app-participate', + templateUrl: './participate.component.html', + styleUrls: ['./participate.component.css'] +}) +export class ParticipateComponent { + +} diff --git a/src/app/pages/suggest-agenda/suggest-agenda.component.css b/src/app/pages/suggest-agenda/suggest-agenda.component.css new file mode 100644 index 00000000..a1836637 --- /dev/null +++ b/src/app/pages/suggest-agenda/suggest-agenda.component.css @@ -0,0 +1,71 @@ + +.containner { + width: 360px; + margin-left: auto; + margin-right: auto; + text-align: center; + height: -300px; +} + +.containner h1 { + color: #0087C8; + font-size: 13px; + font-family: "unb-pro", sans-serif; + font-style: normal; + font-weight: 700; + line-height: 12.35px; + margin-left: 29px; + margin-top: 45px; + margin-bottom: 40px; + text-align: start; +} + +.first { + border: 0.15px solid #3C3C3B; + margin-left: 29px; + width: 330px; + border-radius: 9px; + height: 30px; + padding: 9px 0 10px 28px; +} + +form ::placeholder { + font-size: 13px; + font-family: "unb-pro", sans-serif; +} + +.descricao { + border: 0.15px solid #3C3C3B; + margin-left: 29px; + width: 330px; + border-radius: 9px; + height: 100px; + padding: 9px 0 10px 28px; +} + +.descricao::placeholder { + top: -35px; +} + +button { + background-color: #0087C8; + padding: 3px 33px 3px 33px; + border-radius: 9px; + margin-top: 7px; +} + +span { + color: white; + font-family: "unb-pro", sans-serif; + font-size: 13px; +} + +.input:focus { + outline: none !important; + border: 0.25px solid #00A550; +} + +.required-field { + outline: none !important; + border: 2px solid red; +} \ No newline at end of file diff --git a/src/app/pages/suggest-agenda/suggest-agenda.component.html b/src/app/pages/suggest-agenda/suggest-agenda.component.html new file mode 100644 index 00000000..53e492f6 --- /dev/null +++ b/src/app/pages/suggest-agenda/suggest-agenda.component.html @@ -0,0 +1,20 @@ +
+
+

Sugestão de Pautas

+
+ + + + + + + +
+ +
+
+
+
diff --git a/src/app/pages/suggest-agenda/suggest-agenda.component.spec.ts b/src/app/pages/suggest-agenda/suggest-agenda.component.spec.ts new file mode 100644 index 00000000..5c50eef8 --- /dev/null +++ b/src/app/pages/suggest-agenda/suggest-agenda.component.spec.ts @@ -0,0 +1,89 @@ +import { HttpClientTestingModule } from '@angular/common/http/testing'; +import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { FormBuilder, ReactiveFormsModule } from '@angular/forms'; +import { By } from '@angular/platform-browser'; +import { of, throwError } from 'rxjs'; +import { EmailService } from 'src/app/services/email.service'; +import { SuggestAgendaComponent } from './suggest-agenda.component'; + + +const mockData = "email has been sent" +class EmailServiceMock { + sendEmail() { + return of(mockData); + } +} + + +describe('SuggestAgendaComponent', () => { + let component: SuggestAgendaComponent; + let fixture: ComponentFixture; + let emailService: EmailService; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [SuggestAgendaComponent], + imports: [HttpClientTestingModule, + ReactiveFormsModule], + providers: [FormBuilder, { provide: EmailService, useValue: new EmailServiceMock() }] + }) + .compileComponents(); + + fixture = TestBed.createComponent(SuggestAgendaComponent); + component = fixture.componentInstance; + emailService = TestBed.inject(EmailService); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); + + it('should have a valid form on initialization', () => { + fixture.detectChanges(); + expect(component.suggestAgendaForm).toBeTruthy(); + }); + + it('should call suggestAgendaComponent method when the form is submitted', () => { + fixture.detectChanges(); + spyOn(component, 'sendSuggestAgenda').and.callThrough(); + const form = component.suggestAgendaForm; + form.setValue({ descricao: 'Descrição', responsavel: 'Usuário Teste', telefoneResponsavel: '999999999', tema: '', quando: '', local: '', emailContato: '' }); + + const submitButton = fixture.nativeElement.querySelector( + 'button[type="submit"]' + ); + submitButton.click(); + + expect(component.sendSuggestAgenda).toHaveBeenCalled(); + }); + + it('should call onRequiredFieldsChange when responsavel input value changes', () => { + fixture.detectChanges(); + spyOn(component, 'onRequiredFieldsChange'); + + const input = fixture.debugElement.query(By.css('input[name="responsavel"]')).nativeElement; + input.value = 'novo valor'; + input.dispatchEvent(new Event('change')); + + expect(component.onRequiredFieldsChange).toHaveBeenCalled(); + }); + + it('should call sendEmail', () => { + fixture.detectChanges(); + const mySpy = spyOn(emailService, 'sendEmail').and.callThrough(); + const form = component.suggestAgendaForm; + form.setValue({ descricao: 'Descrição', responsavel: 'Usuário Teste', telefoneResponsavel: '999999999', tema: '', quando: '', local: '', emailContato: '' }) + component.sendSuggestAgenda(); + expect(mySpy).toHaveBeenCalled(); + }); + + it('should call sendEmail and return an error', () => { + fixture.detectChanges(); + const mySpy = spyOn(emailService, 'sendEmail').and.returnValue(throwError(() => new Error('Erro'))); + const form = component.suggestAgendaForm; + form.setValue({ descricao: 'Descrição', responsavel: 'Usuário Teste', telefoneResponsavel: '999999999', tema: '', quando: '', local: '', emailContato: '' }) + component.sendSuggestAgenda(); + expect(mySpy).toHaveBeenCalled(); + }); + +}); diff --git a/src/app/pages/suggest-agenda/suggest-agenda.component.ts b/src/app/pages/suggest-agenda/suggest-agenda.component.ts new file mode 100644 index 00000000..e53faaf3 --- /dev/null +++ b/src/app/pages/suggest-agenda/suggest-agenda.component.ts @@ -0,0 +1,71 @@ +import { Component, OnInit } from '@angular/core'; +import { FormBuilder, FormGroup, Validators } from '@angular/forms'; +import { EmailService } from 'src/app/services/email.service'; +import { EmailData } from 'src/shared/model/email.model'; +import { HttpResponse, HttpErrorResponse } from '@angular/common/http'; + +@Component({ + selector: 'app-suggest-agenda', + templateUrl: './suggest-agenda.component.html', + styleUrls: ['./suggest-agenda.component.css'] +}) +export class SuggestAgendaComponent implements OnInit { + + suggestAgendaForm!: FormGroup; + isDescricaoFilled = false; + isResponsavelFilled = false; + isTelefoneFilled = false; + isSendingEmail = false; + + constructor( + private fb: FormBuilder, + private emailService: EmailService + ) { } + + ngOnInit(): void { + this.suggestAgendaForm = this.fb.group({ + tema: [''], + descricao: ['', [Validators.required]], + quando: [''], + local: [''], + responsavel: ['', [Validators.required]], + telefoneResponsavel: ['', [Validators.required]], + emailContato: [''], + }, + ); + } + + sendSuggestAgenda(): void { + if (this.suggestAgendaForm.valid) { + const emailData = new EmailData(); + emailData.tema = this.suggestAgendaForm.value.tema; + emailData.descricao = this.suggestAgendaForm.value.descricao; + emailData.local = this.suggestAgendaForm.value.local; + emailData.quando = this.suggestAgendaForm.value.quando; + emailData.responsavel = this.suggestAgendaForm.value.responsavel; + emailData.telefone_responsavel = this.suggestAgendaForm.value.telefoneResponsavel; + emailData.email_contato = this.suggestAgendaForm.value.emailContato; + const emailUnB = 'unbtv@unb.br'; + emailData.recipients = [emailUnB]; + this.isSendingEmail = true; + this.emailService.sendEmail(emailData).subscribe((res: HttpResponse) => { + alert('Sugestão enviada com sucesso'); + }, + (error: HttpErrorResponse) => { + alert('error: ' + error.message); + }, + () => { + this.isSendingEmail = false; + }); + } else { + alert('Preencha os campos obrigatórios!'); + } + } + + onRequiredFieldsChange(): void { + this.isDescricaoFilled = !!this.suggestAgendaForm.value.descricao; + this.isResponsavelFilled = !!this.suggestAgendaForm.value.responsavel; + this.isTelefoneFilled = !!this.suggestAgendaForm.value.telefoneResponsavel; + } + +} diff --git a/src/app/pages/video-viewer/video-viewer.component.spec.ts b/src/app/pages/video-viewer/video-viewer.component.spec.ts index 0fcedda5..e682490b 100644 --- a/src/app/pages/video-viewer/video-viewer.component.spec.ts +++ b/src/app/pages/video-viewer/video-viewer.component.spec.ts @@ -2,8 +2,8 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { HttpClientTestingModule } from '@angular/common/http/testing'; import { RouterTestingModule } from "@angular/router/testing"; import { VideoViewerComponent } from './video-viewer.component'; -import { VideoService } from '../../services/video.service'; import { SafePipe } from 'src/app/pipes/safe.pipe'; +import { VideoService } from 'src/app/services/video.service'; describe('VideoViewerComponent', () => { let component: VideoViewerComponent; diff --git a/src/app/services/auth.service.spec.ts b/src/app/services/auth.service.spec.ts index d4bec24a..cd99307a 100644 --- a/src/app/services/auth.service.spec.ts +++ b/src/app/services/auth.service.spec.ts @@ -30,7 +30,7 @@ describe('AuthService', () => { service.registerUser(userResponse).subscribe(res => { expect(res).toEqual(userResponse); }); - const req = httpMock.expectOne(`${service.apiURL}/auth/register`); + const req = httpMock.expectOne(`${service.usersAPIURL}/auth/register`); expect(req.request.method).toBe('POST'); req.flush(userResponse); }); @@ -44,7 +44,7 @@ describe('AuthService', () => { service.loginUser(userResponse).subscribe(res => { expect(res).toEqual(userResponse); }); - const req = httpMock.expectOne(`${service.apiURL}/auth/login`); + const req = httpMock.expectOne(`${service.usersAPIURL}/auth/login`); expect(req.request.method).toBe('POST'); req.flush(userResponse); }); @@ -57,7 +57,7 @@ describe('AuthService', () => { service.activeAccount(userResponse).subscribe(res => { expect(res).toEqual(userResponse); }); - const req = httpMock.expectOne(`${service.apiURL}/auth/activate-account`); + const req = httpMock.expectOne(`${service.usersAPIURL}/auth/activate-account`); expect(req.request.method).toBe('PATCH'); req.flush(userResponse); }); @@ -69,7 +69,7 @@ describe('AuthService', () => { service.resendCode(userResponse).subscribe(res => { expect(res).toEqual(userResponse); }); - const req = httpMock.expectOne(`${service.apiURL}/auth/resend-code`); + const req = httpMock.expectOne(`${service.usersAPIURL}/auth/resend-code`); expect(req.request.method).toBe('POST'); req.flush(userResponse); }); @@ -81,7 +81,7 @@ describe('AuthService', () => { service.sendEmailPassword(userResponse).subscribe(res => { expect(res).toEqual(userResponse); }); - const req = httpMock.expectOne(`${service.apiURL}/auth/reset-password/request`); + const req = httpMock.expectOne(`${service.usersAPIURL}/auth/reset-password/request`); expect(req.request.method).toBe('POST'); req.flush(userResponse); }); @@ -94,7 +94,7 @@ describe('AuthService', () => { service.verifyCodePassword(userResponse).subscribe(res => { expect(res).toEqual(userResponse); }); - const req = httpMock.expectOne(`${service.apiURL}/auth/reset-password/verify`); + const req = httpMock.expectOne(`${service.usersAPIURL}/auth/reset-password/verify`); expect(req.request.method).toBe('POST'); req.flush(userResponse); }); @@ -108,7 +108,7 @@ describe('AuthService', () => { service.updatePassword(userResponse).subscribe(res => { expect(res).toEqual(userResponse); }); - const req = httpMock.expectOne(`${service.apiURL}/auth/reset-password/change`); + const req = httpMock.expectOne(`${service.usersAPIURL}/auth/reset-password/change`); expect(req.request.method).toBe('PATCH'); req.flush(userResponse); }); diff --git a/src/app/services/auth.service.ts b/src/app/services/auth.service.ts index b94bb0cc..7f4a6a3a 100644 --- a/src/app/services/auth.service.ts +++ b/src/app/services/auth.service.ts @@ -8,36 +8,36 @@ import { Observable } from 'rxjs'; providedIn: 'root' }) export class AuthService { - public apiURL = environment.apiURL; + public usersAPIURL = environment.usersAPIURL; constructor(private http: HttpClient) { } registerUser(user: any): Observable { - return this.http.post(`${this.apiURL}/auth/register`, user); + return this.http.post(`${this.usersAPIURL}/auth/register`, user); } loginUser(user: any): Observable { - return this.http.post(`${this.apiURL}/auth/login`, user); + return this.http.post(`${this.usersAPIURL}/auth/login`, user); } activeAccount(emailCode: any): Observable { - return this.http.patch(`${this.apiURL}/auth/activate-account`, emailCode); + return this.http.patch(`${this.usersAPIURL}/auth/activate-account`, emailCode); } resendCode(email: any): Observable { - return this.http.post(`${this.apiURL}/auth/resend-code`, email); + return this.http.post(`${this.usersAPIURL}/auth/resend-code`, email); } sendEmailPassword(email: any): Observable { - return this.http.post(`${this.apiURL}/auth/reset-password/request`, email); + return this.http.post(`${this.usersAPIURL}/auth/reset-password/request`, email); } verifyCodePassword(info: any): Observable { - return this.http.post(`${this.apiURL}/auth/reset-password/verify`, info); + return this.http.post(`${this.usersAPIURL}/auth/reset-password/verify`, info); } updatePassword(user: any): Observable { - return this.http.patch(`${this.apiURL}/auth/reset-password/change`, user); + return this.http.patch(`${this.usersAPIURL}/auth/reset-password/change`, user); } isAuthenticated(): boolean { diff --git a/src/app/services/email.service.spec.ts b/src/app/services/email.service.spec.ts new file mode 100644 index 00000000..a47083aa --- /dev/null +++ b/src/app/services/email.service.spec.ts @@ -0,0 +1,19 @@ +import { TestBed } from '@angular/core/testing'; +import { HttpClientTestingModule } from '@angular/common/http/testing'; +import { EmailService } from './email.service'; + +describe('EmailService', () => { + let service: EmailService; + + beforeEach(() => { + TestBed.configureTestingModule({ + imports: [HttpClientTestingModule], + providers: [EmailService] + }); + service = TestBed.inject(EmailService); + }); + + it('should be created', () => { + expect(service).toBeTruthy(); + }); +}); diff --git a/src/app/services/email.service.ts b/src/app/services/email.service.ts new file mode 100644 index 00000000..fa91d33b --- /dev/null +++ b/src/app/services/email.service.ts @@ -0,0 +1,18 @@ +import { Injectable } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; +import { Observable } from 'rxjs'; +import { IEmailData } from 'src/shared/model/email.model'; +import { environment } from '../environment/environment'; + +@Injectable({ + providedIn: 'root' +}) +export class EmailService { + private adminAPIUrl = environment.adminAPIURL + '/pauta/email'; // Ajuste conforme necessário + + constructor(private http: HttpClient) { } + + sendEmail(email: IEmailData): Observable { + return this.http.post(this.adminAPIUrl, email); + } +} \ No newline at end of file diff --git a/src/app/services/user-token-interceptor.service.spec.ts b/src/app/services/user-token-interceptor.service.spec.ts index 085d5581..3f520648 100644 --- a/src/app/services/user-token-interceptor.service.spec.ts +++ b/src/app/services/user-token-interceptor.service.spec.ts @@ -33,7 +33,7 @@ describe('TokenInterceptorService', () => { userService.getAllUsers().subscribe((res) => { expect(res).toBeTruthy(); }); - const req = httpMock.expectOne(`${userService.apiURL}/users`); + const req = httpMock.expectOne(`${userService.usersAPIURL}/users`); expect(req.request.headers.has('Authorization')).toEqual(true); }); }); diff --git a/src/app/services/user.service.spec.ts b/src/app/services/user.service.spec.ts index cc2d4167..9950ac52 100644 --- a/src/app/services/user.service.spec.ts +++ b/src/app/services/user.service.spec.ts @@ -30,7 +30,7 @@ describe('UserService', () => { expect(res).toEqual(userResponse); }); - const req = httpMock.expectOne(`${service.apiURL}/users/1`); + const req = httpMock.expectOne(`${service.usersAPIURL}/users/1`); expect(req.request.method).toBe('GET'); req.flush(userResponse); }); @@ -56,7 +56,7 @@ describe('UserService', () => { service.getAllUsers().subscribe(res => { expect(res).toEqual(userResponse); }); - const req = httpMock.expectOne(`${service.apiURL}/users`); + const req = httpMock.expectOne(`${service.usersAPIURL}/users`); expect(req.request.method).toBe('GET'); req.flush(userResponse); } @@ -74,7 +74,7 @@ describe('UserService', () => { service.updateUser(1, { "name": "Mario", "connection": "PROFESSOR", "email": "mario@gmail.com" }).subscribe(res => { expect(res).toEqual(userResponse); }); - const req = httpMock.expectOne(`${service.apiURL}/users/1`); + const req = httpMock.expectOne(`${service.usersAPIURL}/users/1`); expect(req.request.method).toBe('PATCH'); req.flush(userResponse); } @@ -92,7 +92,7 @@ describe('UserService', () => { service.deleteUser(1).subscribe(res => { expect(res).toEqual(userResponse); }); - const req = httpMock.expectOne(`${service.apiURL}/users/1`); + const req = httpMock.expectOne(`${service.usersAPIURL}/users/1`); expect(req.request.method).toBe('DELETE'); req.flush(userResponse); } diff --git a/src/app/services/user.service.ts b/src/app/services/user.service.ts index bb9279f9..4677ad41 100644 --- a/src/app/services/user.service.ts +++ b/src/app/services/user.service.ts @@ -7,23 +7,23 @@ import { Observable } from 'rxjs'; providedIn: 'root' }) export class UserService { - public apiURL = environment.apiURL; + public usersAPIURL = environment.usersAPIURL; constructor(private http: HttpClient) { } getUser(id: any): Observable { - return this.http.get(`${this.apiURL}/users/${id}`); + return this.http.get(`${this.usersAPIURL}/users/${id}`); } getAllUsers(): Observable { - return this.http.get(`${this.apiURL}/users`); + return this.http.get(`${this.usersAPIURL}/users`); } updateUser(id: any, body: any): Observable { - return this.http.patch(`${this.apiURL}/users/${id}`, body); + return this.http.patch(`${this.usersAPIURL}/users/${id}`, body); } deleteUser(id: any): Observable { - return this.http.delete(`${this.apiURL}/users/${id}`); + return this.http.delete(`${this.usersAPIURL}/users/${id}`); } } diff --git a/src/app/services/video.service.spec.ts b/src/app/services/video.service.spec.ts index 5230f2a5..84e13dd8 100644 --- a/src/app/services/video.service.spec.ts +++ b/src/app/services/video.service.spec.ts @@ -1,8 +1,8 @@ import { TestBed } from '@angular/core/testing'; import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing'; -import { VideoService } from './video.service'; import { EDUPLAY_API_URL, UNB_ID } from 'src/app/app.constant'; import { EDUPLAY_CLIENT_KEY } from '../environment/environment'; +import { VideoService } from './video.service'; describe('VideoService', () => { let service: VideoService; diff --git a/src/shared/model/email.model.ts b/src/shared/model/email.model.ts new file mode 100644 index 00000000..fa930695 --- /dev/null +++ b/src/shared/model/email.model.ts @@ -0,0 +1,24 @@ + +export interface IEmailData { + tema?: string; + descricao?: string; + quando?: string; + local?: string; + responsavel?: string; + telefone_responsavel?: string; + email_contato?: string; + recipients?: string[]; +} + +export class EmailData implements IEmailData { + constructor( + public tema?: string, + public descricao?: string, + public quando?: string, + public local?: string, + public responsavel?: string, + public telefone_responsavel?: string, + public email_contato?: string, + public recipients?: string[], + ) { } +} \ No newline at end of file