messe
parent
f67b2e87d1
commit
17271cee11
|
@ -0,0 +1,30 @@
|
||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { CommonModule } from '@angular/common';
|
||||||
|
import {RouterModule, Routes} from "@angular/router";
|
||||||
|
import {ContactListComponent} from "./page/contact-list/contact-list.component";
|
||||||
|
import {ContactEditComponent} from "./page/contact-edit/contact-edit.component";
|
||||||
|
import {ContactViewComponent} from "./page/contact-view/contact-view.component";
|
||||||
|
|
||||||
|
const routes: Routes=[
|
||||||
|
{
|
||||||
|
path: "",
|
||||||
|
component:ContactListComponent
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "edit",
|
||||||
|
component: ContactEditComponent
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "view",
|
||||||
|
component: ContactViewComponent
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
declarations: [],
|
||||||
|
imports: [
|
||||||
|
CommonModule,
|
||||||
|
RouterModule.forChild(routes)
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class ContactModule { }
|
|
@ -0,0 +1,18 @@
|
||||||
|
<div>
|
||||||
|
<div>
|
||||||
|
<label>Nom</label>
|
||||||
|
<input [(ngModel)]="contact.lastname" type="text" pInputText />
|
||||||
|
<br>
|
||||||
|
<label>Prénom</label>
|
||||||
|
<input [(ngModel)]="contact.firstname" type="text" pInputText />
|
||||||
|
|
||||||
|
<label>Téléphone</label>
|
||||||
|
<input [(ngModel)]="contact.phone" type="text" pInputText />
|
||||||
|
<label>Email</label>
|
||||||
|
<input [(ngModel)]="contact.mail" type="text" pInputText />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button (click)="save()" pButton type="button" label="Enregistrer"></button>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { ContactEditComponent } from './contact-edit.component';
|
||||||
|
|
||||||
|
describe('ContactEditComponent', () => {
|
||||||
|
let component: ContactEditComponent;
|
||||||
|
let fixture: ComponentFixture<ContactEditComponent>;
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
await TestBed.configureTestingModule({
|
||||||
|
imports: [ContactEditComponent]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
|
||||||
|
fixture = TestBed.createComponent(ContactEditComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,35 @@
|
||||||
|
import {Component, OnInit} from '@angular/core';
|
||||||
|
import {ButtonDirective} from "primeng/button";
|
||||||
|
import {FormsModule} from "@angular/forms";
|
||||||
|
import {InputTextModule} from "primeng/inputtext";
|
||||||
|
import {ContactServiceService} from "../../service/contact.service.service";
|
||||||
|
import {Router} from "@angular/router";
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-contact-edit',
|
||||||
|
standalone: true,
|
||||||
|
imports: [
|
||||||
|
ButtonDirective,
|
||||||
|
FormsModule,
|
||||||
|
InputTextModule
|
||||||
|
],
|
||||||
|
templateUrl: './contact-edit.component.html',
|
||||||
|
styleUrl: './contact-edit.component.scss'
|
||||||
|
})
|
||||||
|
export class ContactEditComponent implements OnInit{
|
||||||
|
contact:any={}
|
||||||
|
|
||||||
|
constructor(private contactService: ContactServiceService,private router: Router) {}
|
||||||
|
ngOnInit() {
|
||||||
|
}
|
||||||
|
|
||||||
|
save() {
|
||||||
|
this.contactService.create(this.contact).subscribe( {
|
||||||
|
next: (res)=>{
|
||||||
|
if(res.success){
|
||||||
|
this.router.navigateByUrl("/app/contact").then();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
|
||||||
|
<div style="text-align: right; margin-bottom :10px">
|
||||||
|
<button (click)="edit()" pButton type="button" label="Ajouter un contact"></button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p-table [value]="contacts" [tableStyle]="{'min-width': '50rem'}">
|
||||||
|
<ng-template pTemplate="header">
|
||||||
|
<tr>
|
||||||
|
<th>Nom</th>
|
||||||
|
<th>Prénom</th>
|
||||||
|
<th>Téléphone</th>
|
||||||
|
<th>Email</th>
|
||||||
|
<th>Actions</th>
|
||||||
|
</tr>
|
||||||
|
</ng-template>
|
||||||
|
<ng-template pTemplate="body" let-contact>
|
||||||
|
<tr>
|
||||||
|
<td>{{contact.lastname}}</td>
|
||||||
|
<td>{{contact.firstname}}</td>
|
||||||
|
<td>{{contact.phone}}</td>
|
||||||
|
<td>{{contact.mail}}</td>
|
||||||
|
<td>
|
||||||
|
<i class="pi pi-pencil" style="margin-right: 10px"></i>
|
||||||
|
<i class="pi pi-trash" style="margin-right: 10px"></i>
|
||||||
|
<i class="pi pi-eye" style="margin-right: 10px"></i>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</ng-template>
|
||||||
|
</p-table>
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { ContactListComponent } from './contact-list.component';
|
||||||
|
|
||||||
|
describe('ContactListComponent', () => {
|
||||||
|
let component: ContactListComponent;
|
||||||
|
let fixture: ComponentFixture<ContactListComponent>;
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
await TestBed.configureTestingModule({
|
||||||
|
imports: [ContactListComponent]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
|
||||||
|
fixture = TestBed.createComponent(ContactListComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,41 @@
|
||||||
|
import {Component, OnInit} from '@angular/core';
|
||||||
|
import {ButtonDirective} from "primeng/button";
|
||||||
|
import {PrimeTemplate} from "primeng/api";
|
||||||
|
import {TableModule} from "primeng/table";
|
||||||
|
import {ContactServiceService} from "../../service/contact.service.service";
|
||||||
|
import {Router} from "@angular/router";
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-contact-list',
|
||||||
|
standalone: true,
|
||||||
|
imports: [
|
||||||
|
ButtonDirective,
|
||||||
|
PrimeTemplate,
|
||||||
|
TableModule
|
||||||
|
],
|
||||||
|
templateUrl: './contact-list.component.html',
|
||||||
|
styleUrl: './contact-list.component.scss'
|
||||||
|
})
|
||||||
|
export class ContactListComponent implements OnInit{
|
||||||
|
contacts: any[]=[]
|
||||||
|
|
||||||
|
constructor(private contactService: ContactServiceService,private router: Router) {
|
||||||
|
}
|
||||||
|
ngOnInit() {
|
||||||
|
this.getServices()
|
||||||
|
}
|
||||||
|
getServices() {
|
||||||
|
this.contactService.getAll().subscribe({
|
||||||
|
next: (res) => {
|
||||||
|
if (res.success) {
|
||||||
|
this.contacts = res.data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
edit(): void{
|
||||||
|
this.router.navigateByUrl('/app/contact/edit').then()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
<p>contact-view works!</p>
|
|
@ -0,0 +1,23 @@
|
||||||
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { ContactViewComponent } from './contact-view.component';
|
||||||
|
|
||||||
|
describe('ContactViewComponent', () => {
|
||||||
|
let component: ContactViewComponent;
|
||||||
|
let fixture: ComponentFixture<ContactViewComponent>;
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
await TestBed.configureTestingModule({
|
||||||
|
imports: [ContactViewComponent]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
|
||||||
|
fixture = TestBed.createComponent(ContactViewComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,12 @@
|
||||||
|
import { Component } from '@angular/core';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-contact-view',
|
||||||
|
standalone: true,
|
||||||
|
imports: [],
|
||||||
|
templateUrl: './contact-view.component.html',
|
||||||
|
styleUrl: './contact-view.component.scss'
|
||||||
|
})
|
||||||
|
export class ContactViewComponent {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
import { TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { ContactServiceService } from './contact.service.service';
|
||||||
|
|
||||||
|
describe('ContactServiceService', () => {
|
||||||
|
let service: ContactServiceService;
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
TestBed.configureTestingModule({});
|
||||||
|
service = TestBed.inject(ContactServiceService);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should be created', () => {
|
||||||
|
expect(service).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,45 @@
|
||||||
|
import { Injectable } from '@angular/core';
|
||||||
|
import {HttpClient} from "@angular/common/http";
|
||||||
|
import {Observable} from "rxjs";
|
||||||
|
import {apiRoute} from "../../../core/routes/api.route";
|
||||||
|
|
||||||
|
|
||||||
|
@Injectable({
|
||||||
|
providedIn: 'root'
|
||||||
|
})
|
||||||
|
export class ContactServiceService {
|
||||||
|
url:string="contact";
|
||||||
|
|
||||||
|
constructor(private http: HttpClient) { }
|
||||||
|
|
||||||
|
//getAll :
|
||||||
|
getAll():Observable<any>{
|
||||||
|
return this.http.get<any>(apiRoute+this.url);
|
||||||
|
}
|
||||||
|
|
||||||
|
//getById :
|
||||||
|
|
||||||
|
getById(id:string):Observable<any>{
|
||||||
|
return this.http.get<any>(apiRoute+this.url+"/"+id)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//create :
|
||||||
|
|
||||||
|
create(contact: any):Observable<any>{
|
||||||
|
return this.http.post<any>(apiRoute+this.url,contact)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//update :
|
||||||
|
update(contact: any):Observable<any>{
|
||||||
|
return this.http.put<any>(apiRoute+this.url+"/"+contact.id,contact)
|
||||||
|
}
|
||||||
|
|
||||||
|
//delete :
|
||||||
|
|
||||||
|
delete(id:string):Observable<any>{
|
||||||
|
return this.http.delete<any>(apiRoute+this.url+"/"+id)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
<div>
|
||||||
|
<div>
|
||||||
|
<label>Description</label>
|
||||||
|
<input [(ngModel)]="problem.description" type="text" pInputText />
|
||||||
|
<br>
|
||||||
|
<label>Date</label>
|
||||||
|
<input [(ngModel)]="problem.date" type="text" pInputText />
|
||||||
|
|
||||||
|
<label>Statut</label>
|
||||||
|
<input [(ngModel)]="problem.status" type="text" pInputText />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button (click)="save()" pButton type="button" label="Enregistrer"></button>
|
||||||
|
|
||||||
|
</div>
|
|
@ -0,0 +1,23 @@
|
||||||
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { ProblemEditComponent } from './problem-edit.component';
|
||||||
|
|
||||||
|
describe('ProblemEditComponent', () => {
|
||||||
|
let component: ProblemEditComponent;
|
||||||
|
let fixture: ComponentFixture<ProblemEditComponent>;
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
await TestBed.configureTestingModule({
|
||||||
|
imports: [ProblemEditComponent]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
|
||||||
|
fixture = TestBed.createComponent(ProblemEditComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,38 @@
|
||||||
|
import {Component, OnInit} from '@angular/core';
|
||||||
|
import {ButtonDirective} from "primeng/button";
|
||||||
|
import {PrimeTemplate} from "primeng/api";
|
||||||
|
import {TableModule} from "primeng/table";
|
||||||
|
import {InputTextModule} from "primeng/inputtext";
|
||||||
|
import {FormsModule, ReactiveFormsModule} from "@angular/forms";
|
||||||
|
import {ProblemServiceService} from "../../service/problem.service.service";
|
||||||
|
import {Router} from "@angular/router";
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-problem-edit',
|
||||||
|
standalone: true,
|
||||||
|
imports: [
|
||||||
|
ButtonDirective,
|
||||||
|
PrimeTemplate,
|
||||||
|
TableModule,
|
||||||
|
InputTextModule,
|
||||||
|
ReactiveFormsModule,
|
||||||
|
FormsModule
|
||||||
|
],
|
||||||
|
templateUrl: './problem-edit.component.html',
|
||||||
|
styleUrl: './problem-edit.component.scss'
|
||||||
|
})
|
||||||
|
export class ProblemEditComponent implements OnInit{
|
||||||
|
problem:any={}
|
||||||
|
|
||||||
|
constructor(private problemService: ProblemServiceService, private router: Router) {
|
||||||
|
}
|
||||||
|
ngOnInit() {
|
||||||
|
}
|
||||||
|
save():void{
|
||||||
|
this.problemService.create(this.problem).subscribe({
|
||||||
|
next: (res)=>{
|
||||||
|
this.router.navigateByUrl("app/problem").then();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
|
||||||
|
<div style="text-align: right; margin-bottom :10px">
|
||||||
|
<button (click)="edit()" pButton type="button" label="Ajouter un problème"></button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p-table [value]="problems" [tableStyle]="{'min-width': '50rem'}">
|
||||||
|
<ng-template pTemplate="header">
|
||||||
|
<tr>
|
||||||
|
<th>Description</th>
|
||||||
|
<th>Date</th>
|
||||||
|
<th>Statut</th>
|
||||||
|
<th>Actions</th>
|
||||||
|
</tr>
|
||||||
|
</ng-template>
|
||||||
|
<ng-template pTemplate="body" let-problems>
|
||||||
|
<tr>
|
||||||
|
<td>{{problems.description}}</td>
|
||||||
|
<td>{{problems.date}}</td>
|
||||||
|
<td>{{problems.status}}</td>
|
||||||
|
<td>
|
||||||
|
<i class="pi pi-pencil" style="margin-right: 10px"></i>
|
||||||
|
<i class="pi pi-trash" style="margin-right: 10px"></i>
|
||||||
|
<i class="pi pi-eye" style="margin-right: 10px"></i>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</ng-template>
|
||||||
|
</p-table>
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { ProblemListComponent } from './problem-list.component';
|
||||||
|
|
||||||
|
describe('ProblemListComponent', () => {
|
||||||
|
let component: ProblemListComponent;
|
||||||
|
let fixture: ComponentFixture<ProblemListComponent>;
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
await TestBed.configureTestingModule({
|
||||||
|
imports: [ProblemListComponent]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
|
||||||
|
fixture = TestBed.createComponent(ProblemListComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,39 @@
|
||||||
|
import {Component, OnInit} from '@angular/core';
|
||||||
|
import {ButtonDirective} from "primeng/button";
|
||||||
|
import {PrimeTemplate} from "primeng/api";
|
||||||
|
import {TableModule} from "primeng/table";
|
||||||
|
import {ProblemServiceService} from "../../service/problem.service.service";
|
||||||
|
import {Router} from "@angular/router";
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-problem-list',
|
||||||
|
standalone: true,
|
||||||
|
imports: [
|
||||||
|
ButtonDirective,
|
||||||
|
PrimeTemplate,
|
||||||
|
TableModule
|
||||||
|
],
|
||||||
|
templateUrl: './problem-list.component.html',
|
||||||
|
styleUrl: './problem-list.component.scss'
|
||||||
|
})
|
||||||
|
export class ProblemListComponent implements OnInit{
|
||||||
|
problems:any[]=[]
|
||||||
|
constructor(private problemService: ProblemServiceService,private router: Router) {
|
||||||
|
}
|
||||||
|
ngOnInit() {
|
||||||
|
this.getProblems()
|
||||||
|
}
|
||||||
|
|
||||||
|
getProblems():void{
|
||||||
|
this.problemService.getAll().subscribe({
|
||||||
|
next: (res)=>{
|
||||||
|
if(res.success){
|
||||||
|
this.problems=res.data
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
edit():void{
|
||||||
|
this.router.navigateByUrl("app/problem/edit").then()
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1 @@
|
||||||
|
<p>problem-view works!</p>
|
|
@ -0,0 +1,23 @@
|
||||||
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { ProblemViewComponent } from './problem-view.component';
|
||||||
|
|
||||||
|
describe('ProblemViewComponent', () => {
|
||||||
|
let component: ProblemViewComponent;
|
||||||
|
let fixture: ComponentFixture<ProblemViewComponent>;
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
await TestBed.configureTestingModule({
|
||||||
|
imports: [ProblemViewComponent]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
|
||||||
|
fixture = TestBed.createComponent(ProblemViewComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,12 @@
|
||||||
|
import { Component } from '@angular/core';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-problem-view',
|
||||||
|
standalone: true,
|
||||||
|
imports: [],
|
||||||
|
templateUrl: './problem-view.component.html',
|
||||||
|
styleUrl: './problem-view.component.scss'
|
||||||
|
})
|
||||||
|
export class ProblemViewComponent {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,31 @@
|
||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { CommonModule } from '@angular/common';
|
||||||
|
import {ProblemListComponent} from "./page/problem-list/problem-list.component";
|
||||||
|
import {ProblemEditComponent} from "./page/problem-edit/problem-edit.component";
|
||||||
|
import {ProblemViewComponent} from "./page/problem-view/problem-view.component";
|
||||||
|
import {RouterModule, Routes} from "@angular/router";
|
||||||
|
|
||||||
|
const routes : Routes=[
|
||||||
|
{
|
||||||
|
path: '',
|
||||||
|
component: ProblemListComponent
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'edit',
|
||||||
|
component: ProblemEditComponent
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'view',
|
||||||
|
component: ProblemViewComponent
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
declarations: [],
|
||||||
|
imports: [
|
||||||
|
CommonModule,
|
||||||
|
RouterModule.forChild(routes)
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class ProblemModule { }
|
|
@ -0,0 +1,16 @@
|
||||||
|
import { TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { ProblemServiceService } from './problem.service.service';
|
||||||
|
|
||||||
|
describe('ProblemServiceService', () => {
|
||||||
|
let service: ProblemServiceService;
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
TestBed.configureTestingModule({});
|
||||||
|
service = TestBed.inject(ProblemServiceService);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should be created', () => {
|
||||||
|
expect(service).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,49 @@
|
||||||
|
import { Injectable } from '@angular/core';
|
||||||
|
import {Observable} from "rxjs";
|
||||||
|
import {apiRoute} from "../../../core/routes/api.route";
|
||||||
|
import {HttpClient} from "@angular/common/http";
|
||||||
|
|
||||||
|
@Injectable({
|
||||||
|
providedIn: 'root'
|
||||||
|
})
|
||||||
|
export class ProblemServiceService {
|
||||||
|
url="problem"
|
||||||
|
|
||||||
|
constructor(private http: HttpClient) { }
|
||||||
|
|
||||||
|
//getAll :
|
||||||
|
|
||||||
|
getAll(): Observable<any>{
|
||||||
|
return this.http.get<any>(apiRoute+this.url);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//getById :
|
||||||
|
|
||||||
|
getById(id: string): Observable<any>{
|
||||||
|
return this.http.get<any>(apiRoute+this.url+"/"+id);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//create :
|
||||||
|
|
||||||
|
create(problem: any): Observable<any>{
|
||||||
|
return this.http.post<any>(apiRoute+this.url,problem);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//update :
|
||||||
|
|
||||||
|
update(problem: any): Observable<any>{
|
||||||
|
return this.http.put<any>(apiRoute+this.url+"/"+problem.id,problem);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//delete :
|
||||||
|
|
||||||
|
delete(id: string): Observable<any>{
|
||||||
|
return this.http.delete<any>(apiRoute+this.url+"/"+id);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue