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

refactor-model-controllers-extend-base #11

Open
colinwilliams91 opened this issue Mar 16, 2024 · 0 comments
Open

refactor-model-controllers-extend-base #11

colinwilliams91 opened this issue Mar 16, 2024 · 0 comments

Comments

@colinwilliams91
Copy link
Contributor

Describe the Problem

Currently, the model controllers do not inherit from the base class which will define the 5-6 basic crud operations.

Describe the Proposed Solution

public readonly _model: Model<any>;

and

  constructor(model: Model<any>) {
    this._model = model;
  }

need to be type correctly to handle any Model that gets passed in. Consult Mongoose for the typing

References

current ARepository base class:

// TODO: the typings for _model are all messed up and not inferring correctly...
export abstract class ARepository {

  public readonly _model: Model<any>;

  /**
   * @summary This Abstract base class will have the core Read/Write operations for req/res
   * @param typeof User to infer mongoose model type
   */
  constructor(model: Model<any>) {
    this._model = model;
  }

  // TODO: Generic Repository need param types defined...
  // async create(item: T): Promise<boolean> {
  //   throw new Error("Method not implemented.");
  // }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

No branches or pull requests

1 participant