Last active
September 6, 2020 12:43
-
-
Save UmerIftikhar/2930b1aa3fd6d9cd7a5902c2bb0660c2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Injectable } from '@angular/core'; | |
import { HttpClient } from '@angular/common/http'; | |
import { TodoItem, TodoItemCreate, TodoItemUpdate } from './models'; | |
import { Constants } from './constants'; | |
import { BaseService } from './base.service'; | |
@Injectable() | |
export class TodoService extends BaseService<TodoItem, TodoItemCreate, TodoItemUpdate> { | |
constructor(private readonly httpClient: HttpClient) { | |
super(httpClient, Constants.apiEndpoints.todoItems); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
This is the Read model, and the getbyId & getAll must return this data model (as per the api contract). | |
*/ | |
export interface TodoItem { | |
id: string; | |
title: string; | |
description: string; | |
tags: string; | |
} | |
/* | |
This is the Create model, and the create function of todoService (derived from base srevice) must accept this data model (as per the api contract). | |
*/ | |
export interface TodoItemCreate { | |
title: string; | |
description: string; | |
tags: string; | |
} | |
/* | |
This is the Update model, and the update function of todoService (derived from base srevice) must accept this data model (as per the api contract). | |
*/ | |
export interface TodoItemUpdate { | |
description: string; | |
tags: string; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment