Skip to content

Commit

Permalink
fix imports for use with latest lb-next
Browse files Browse the repository at this point in the history
  • Loading branch information
biniam committed Jun 15, 2017
1 parent 82ae79b commit cdb602c
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 14 deletions.
7 changes: 3 additions & 4 deletions services/accountsanjuggler/controllers/AccountController.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import { api } from 'loopback-next/packages/core';
import { def } from './AccountController.api';
import {Model} from 'loopback-next/packages/juggler/src/model';
import { AccountRepository } from '../repositories/account';
import { Account } from '../repositories/account/models/Account';
import { repository } from "loopback-next/packages/juggler/src/decorator";
import { Filter, Order } from "loopback-next/packages/juggler/src/query";
import { repository } from "loopback-next/packages/repository/src/decorators/repository";
import { Filter, Order } from "loopback-next/packages/repository/src/query";

@api(def)
@repository('AccountRepository')
//@repository('AccountRepository')
export class AccountController {
repository: AccountRepository;

Expand Down
2 changes: 1 addition & 1 deletion services/accountsanjuggler/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class AccountMicroservice extends Application {

async start() {
this._startTime = new Date();
const server = new Server({ port: 3001 });
const server = new Server(this, { port: 3001 });
server.bind('applications.accounts').to(this);
return server.start();
}
Expand Down
11 changes: 4 additions & 7 deletions services/accountsanjuggler/repositories/account/index.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import {Class, ObjectType, AnyObject, Options} from 'loopback-next/packages/juggler/src/common';
import {Model} from 'loopback-next/packages/juggler/src/model';
import {Filter, Where, Operators, Condition, Order, Inclusion} from 'loopback-next/packages/juggler/src/query';
import {EntityCrudRepository, CrudRepository} from 'loopback-next/packages/juggler/src/repository';
import {Class, ObjectType, AnyObject, Options} from 'loopback-next/packages/repository/src/common-types';
import {Filter, Where, Operators, Condition, Order, Inclusion} from 'loopback-next/packages/repository/src/query';
import {EntityCrudRepository, CrudRepository} from 'loopback-next/packages/repository/src/repository';
import {Account} from './models/Account';
const modelDefinition = require('./models/account/model-definition');
const mysqlDriver = require('mysql');
let conn = mysqlDriver.createConnection(require('./datasources/mysql.json'));
let _ = require('lodash');

export class AccountRepository implements EntityCrudRepository<Account, string> {

Expand Down Expand Up @@ -59,7 +57,7 @@ export class AccountRepository implements EntityCrudRepository<Account, string>
return new Promise<Account>(function(resolve, reject) {
conn.query(sqlStmt, function(err, count, fields) {
if (err !== null) return reject(err);
resolve({"count": count} as Account);
resolve(count.affectedRows);
});
});
}
Expand Down Expand Up @@ -88,7 +86,6 @@ export class AccountRepository implements EntityCrudRepository<Account, string>
throw new Error("Method not implemented.");
}
find(filter?: Filter, options?: AnyObject): Promise<Account[]> {
//console.log ('model inside find ', this.model);
let sqlStmt = 'SELECT * FROM ' + Account.name;
if(filter.where) {
let sql = '?? = ?';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {model} from 'loopback-next/packages/juggler/src/decorator';
import {Entity, ModelProperty} from 'loopback-next/packages/juggler/src/model';
import {model} from 'loopback-next/packages/repository/src/decorators/model';
import {Entity} from 'loopback-next/packages/repository/src/model';

@model(require('./account/model-definition'))
export class Account extends Entity {
Expand Down

0 comments on commit cdb602c

Please sign in to comment.