Skip to content

Instantly share code, notes, and snippets.

@UmerIftikhar
Last active September 6, 2020 12:43
Show Gist options
  • Save UmerIftikhar/2930b1aa3fd6d9cd7a5902c2bb0660c2 to your computer and use it in GitHub Desktop.
Save UmerIftikhar/2930b1aa3fd6d9cd7a5902c2bb0660c2 to your computer and use it in GitHub Desktop.
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 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