Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement generators for new Models, Services and Routables #10

Closed
etsuo opened this issue Jan 11, 2018 · 0 comments
Closed

Implement generators for new Models, Services and Routables #10

etsuo opened this issue Jan 11, 2018 · 0 comments
Assignees
Milestone

Comments

@etsuo
Copy link
Member

etsuo commented Jan 11, 2018

This has become expecially important because of how mixins work (don't work?) with TypeScript 2.6 (see: microsoft/TypeScript#9944).

So, for example to get an @Model working, there's an export tap dance that needs to happen:

import {
  Db,
  IDbGetParams,
  IFromDbOptions,
  Json,
  Model,
  SakuraApi,
  SapiModelMixin
}            from '@sakuraapi/api';
import {
  Collection,
  CollectionInsertOneOptions,
  CollectionOptions,
  Cursor,
  Db as MongoDb,
  DeleteWriteOpResultObject,
  InsertOneWriteOpResult,
  ObjectID,
  ReplaceOneOptions,
  UpdateWriteOpResult
}            from 'mongodb';
import {dbs} from '../config/db';

export {
  Collection,
  CollectionInsertOneOptions,
  CollectionOptions,
  Cursor,
  MongoDb,
  DeleteWriteOpResultObject,
  InsertOneWriteOpResult,
  ObjectID,
  ReplaceOneOptions,
  UpdateWriteOpResult,
  IDbGetParams,
  IFromDbOptions,
  SakuraApi
};

@Model({
  dbConfig: dbs.user
})
export class User extends SapiModelMixin() {
}

That's a lot of setup work. It looks like TypeScript issue 9944 is scheduled to have some sort of solution in 2.8, so revisit the issue then. In the meantime, sapi cli needs to reduce the pain in setting up a model.

Might as well create generators for Services and Routables at the same time.

@etsuo etsuo added this to the 0.5.0 milestone Jan 11, 2018
@etsuo etsuo self-assigned this Jan 13, 2018
@etsuo etsuo closed this as completed in 4d544e6 Jan 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant