Skip to content

Commit

Permalink
fix typescript lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
reneolivo committed Sep 5, 2016
1 parent 27f4de0 commit 86636c7
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 38 deletions.
2 changes: 1 addition & 1 deletion client/src/clients/client-form.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {Clients} from '../services/api/clients';
import {ClientModel} from '../services/api/models/client';

@autoinject
export class ClientForm extends ApiForm {
export class ClientForm extends ApiForm<ClientModel> {
constructor(clients: Clients) {
super(clients, ClientModel);
}
Expand Down
10 changes: 2 additions & 8 deletions client/src/clients/index.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
<template>
<require from="./client-form"></require>

<endpoint-manager
api-service.bind="clients"
form-control.bind="clientForm"
>
<endpoint-manager api-service.bind="clients">
<h2 slot="title">Pacientes</h2>

<span slot="add-record-label">Agregar Paciente</span>
Expand All @@ -20,9 +17,6 @@ <h2 slot="title">Pacientes</h2>
<column slot="column" header="Celular">${mobile}</column>
<column slot="column" header="Email">${email}</column>

<client-form
slot="form"
client-form.ref="clientForm"
></client-form>
<client-form slot="form"></client-form>
</endpoint-manager>
</template>
17 changes: 2 additions & 15 deletions client/src/professionals/index.html
Original file line number Diff line number Diff line change
@@ -1,17 +1,7 @@
<template>
<require from="./professional-form"></require>

<endpoint-manager
api-service.bind="professionals"
columns.bind="{
'Nombre Completo': '${firstName} ${lastName}',
'Teléfono': '${landLine}',
'Celular': '${mobile}',
'Email': '${email}',
'Citas Para hoy': '${todaysAppointmentCount}'
}"
form-control.bind="professionalForm"
>
<endpoint-manager api-service.bind="professionals">
<h2 slot="title">Doctores</h2>

<span slot="add-record-label">Agregar Doctor</span>
Expand All @@ -28,9 +18,6 @@ <h2 slot="title">Doctores</h2>
<column slot="column" header="Email">${email}</column>
<column slot="column" header="Citas Para Hoy">${todaysAppointmentCount}</column>

<professional-form
slot="form"
professional-form.ref="professionalForm"
></professional-form>
<professional-form slot="form"></professional-form>
</endpoint-manager>
</template>
2 changes: 1 addition & 1 deletion client/src/professionals/professional-form.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {Professionals} from '../services/api/professionals';
import {ProfessionalModel} from '../services/api/models/professional';

@autoinject
export class ProfessionalForm extends ApiForm {
export class ProfessionalForm extends ApiForm<ProfessionalModel> {
constructor(professionals: Professionals) {
super(professionals, ProfessionalModel);
}
Expand Down
2 changes: 1 addition & 1 deletion client/src/resources/elements/column.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export class Column {
protected element: Element
) {}

@computedFrom('element')
@computedFrom('element.innerHTML')
get content() {
return this.element.innerHTML;
}
Expand Down
9 changes: 3 additions & 6 deletions client/src/resources/elements/endpoint-manager.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import {autoinject, bindable, child, children} from 'aurelia-framework';
import {CoreApiService} from '../../services/api/core-api-service';
import {ApiForm} from '../../services/api/form/api-form';
import {CoreApiModel} from '../../services/api/models/core-api-model';
import Toast from '../../services/helpers/toast';
import {Column} from './column';

Expand All @@ -10,20 +12,15 @@ export class EndpointManager {

@children('column') columns: Column[];
@bindable apiService: CoreApiService;
@bindable formControl: any; // Todo: change to FormControl;

@child('[slot=form]') formControl: ApiForm<CoreApiModel>;
@child('[slot=delete-success-message]') deleteSuccessMessage;
@child('[slot=delete-error-message]') deleteErrorMessage;
protected defaultDeleteSuccessMessage: string = 'Record deleted successfully';
protected defaultDeleteErrorMessage: string = 'There was an error deleting the record';


constructor(protected toast: Toast) {}

attached() {
console.log(this.theColumns);
}

apiServiceChanged() {
this.getAllRecords();
}
Expand Down
2 changes: 1 addition & 1 deletion client/src/services/api/core-api-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export class CoreApiService {
return this.http.get(this.getUrl());
}

create(data: object = {}) {
create(data: Object = {}) {
return this.http.post(
this.getUrl(),
this.getPlainObject(data)
Expand Down
6 changes: 3 additions & 3 deletions client/src/services/api/form/api-form.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import {CoreApiService} from '../core-api-service';
import {CoreApiModel} from '../models/core-api-model';

export class ApiForm {
protected record: Object = {};
export class ApiForm<T extends CoreApiModel> {
protected record: CoreApiModel = new CoreApiModel();

constructor(
protected apiService: CoreApiService,
protected modelClass: CoreApiModel
protected modelClass: new (data?: Object) => T
) {
this.reset();
}
Expand Down
4 changes: 3 additions & 1 deletion client/src/services/api/models/core-api-model.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
export class CoreApiModel {
constructor(record: any = {}) {
id: number = null;

constructor(record: Object = {}) {
Object.assign(this, record || {});
}
}
1 change: 0 additions & 1 deletion client/src/services/api/models/person.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {CoreApiModel} from './core-api-model';

export class Person extends CoreApiModel {
id: number;
firstName: string;
lastName: string;
landLine: string;
Expand Down

0 comments on commit 86636c7

Please sign in to comment.