Git Product home page Git Product logo

maya's People

Contributors

dependabot[bot] avatar japhmoraleja avatar jofftiquez avatar mackignacio avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

maya's Issues

Why no one is helping to contribute?

Why no one is helping to contribute?

  • NestJS is better?
  • No Leadership / No Vision?
  • Poor Documentation?
  • No Unit Testing?
  • People Hate the Author?
  • All of the above?

What do you guys think? Your feedback will help the author improve the framework.

Can't find model on build

πŸ“ Describe error

Server is running fine when it is on development. But when you build the typescript and try to run index.js inside the dist folder after installing necessary dependency. It will no longer find the models.

To Reproduce
Steps to reproduce the behavior:

  1. Run tsc
  2. Go to dist folder
  3. Copy package.json inside dist folder
  4. Run npm i to install dependecy
  5. Wait for the server to connect to database
  6. Make a request. Any request will do.
  7. Error will popup on terminal.

Expected behavior
Models will be found just like on development in typescript.

⛔️ Error Message

image

πŸ” Additional Info

Server is running fine when running on npm start.

FEAT: Should be able to put parameters anywhere in the URI

πŸ“ Description

Is your feature request related to a problem? Please describe.
I can't make a controller endpoint proc when the param is not :id

Describe the solution you'd like
I should be able to put the anywhere in the uri endpoints and still proc the controller's route

Describe alternatives you've considered
I tried putting the parameters in the routing modules

image

βš™οΈ Component

routing modules

Model paths not found in ElasticBeanstalk

πŸ“ Describe error

When deploying the transpiled code from ts to js and deploy it to AWS Elastic Beanstalk. It will show at the logs that the modules for the models are not found.

To Reproduce
Steps to reproduce the behavior:

  1. Build you app.
  2. Deploy it to your provider whether DigitalOcean or AWS.
  3. See error

⛔️ Error Message

image

Multiple databases

πŸ“ Description

To cater more developers and users. We need to have a feature to handle multiple databases. Right now mayajs can only handles one database at a time. We need to be able to handle an array of database that can be added on the app.module.ts. This can be only implemented if we can handle external module.

πŸ“‹ Todo:

  • database param on app.module.ts handles array
  • Create a Database interface for outside modules
  • Create a database handler and database switcher

πŸ” Additional Info

This feature is vital for the release of version 1.0.0.

❌ERROR: Uncaugth error makes the app hang

πŸ“ Describe error

Everytime that an uncaugth error occurs the app will hang.

To Reproduce
Steps to reproduce the behavior:

  1. Send a request
  2. Wait for it to have an error
  3. App will hang if an error is occured

Expected behavior
The app must send a response if there is an error.

⛔️ Error Message

image

Universal model decorator

πŸ“ Description

To handle multiple database we must have a universal model decorator. This decorator creates an objects that maps all the fields and exposes and API for the Database class to consume. This way we will just write one model and it can be used by any database.

βš™οΈ Component

Suggested code sample

const schema = {
  name : {
     type: string | number | boolean | ObjectId | Date | Enum; // REQUIRED
     required: boolean; // DEFAULT false
     unique: boolean; // DEFAULT false
     ref: ObjectId; // OPTIONAL
     maxLength: number; // OPTIONAL
     minLength: number; // OPTIONAL
     validation: Array<Validation> // OPTIONAL
  }
};
@Model( "name-of-model" , schema );

πŸ“‹ Todo:

  • Create a model decorator factory
  • Create an API for Database class to expose the model object
  • Create a list of models that can be called inside a service or controller
  • Able to define the model in app.module.ts
  • Model can be used by any ORM library

πŸ” Additional Info

This feature is vital for the release of version 1.0.0.

Root MayaJS class

πŸ“ Description

Maya class will accepts the AppModule and bootstrap all the necessary routes and models if any. It also serves as an instance of Express.app. It's also responsible for starting and setting up the server and listens to it.

πŸ“‹ Todo:

  • Create Maya class
  • Create bootstrap function
  • Create start function
  • Create use function This function is for using global middleware that all the routes will use.

πŸ” Additional Info

This Maya class will be the root of the server.

🐞 Invalid class names generated after `maya generate <type> <name>` command

πŸ“ Describe the bug

Invalid class names generated after maya generate <type> <name> command

To Reproduce
Steps to reproduce the behavior:

  1. Create a maya project using the command: maya new <project-name>
  2. Create a controller inside the project using the command: maya g r <dash-seperated-route-name>
  3. View the generated controller and service
  4. See error

Expected behavior
Generate class names with pascal casing

πŸ“· Screenshots

image

βš™οΈ Component

maya/cli

Unit Test

πŸ“ Description

Every good project has a good testing. It will be better if we can implement this early on our development.

πŸ“‹ Todo:

  • Add test folder for each .test.ts files
  • Unit test with Jest
  • Add CI (Continuous Integration) preferably Circle CI

πŸ” Additional Info

If the function relies on other library we need to make a mock for that library.

Fix the Author's Attitude

  • Need to fix the attitude towards other people.
  • Improve grammar.
  • Stop spreading false informations.
  • Think before posting nasty comments to avoid suffering the consequences.
  • Be humble.
  • Exercise more to prevent diabetes.
  • Save more money to be a future billionaire.
  • Brush your teeth 2x a day
  • Always flush the toilet after use

Sample project

πŸ“ Description

It will hard to everyone to use this library if they don't have any sample project that they can start of. We can make a simple project that utilize the basic usage of this library. Like how to make a simple folder structure and simple controller example.

πŸ“‹ Todo:

  • Create a sample project folder.
  • Create an index.ts
  • Create a controller.ts
  • Create a app.module.ts

πŸ” Additional Info

This sample project is a basic implementation of this library.

Models Decorator

πŸ“ Description

Models decorator accepts a name of a model related to a controller. This will replace the value of the variable it was decorated to the value of the model that has the same name that pass on it. This a collection of models and bootstrapped alongside with all the controllers.

Sample code

@Models()
const model : Model<any, any>;

πŸ“‹ Todo:

  • Create Models decorator
  • Create an object of models
  • Map all the model and add it on the model object when bootstrapping
  • Models decorator must replace the value of the variable with the correct model name
  • Models can be called on anywhere not only inside the controller

πŸ” Additional Info

This decorator must only work if there is a model defined on the @Controller() decorator.

Remove express.js library

πŸ“ Description

Right now MayaJS is using express.js as a routing library under the hood. But this is not bad for us to use it but in the future it is better to have our own routing module for us to scale more. I suggest we need to create a routing library for @mayajs/core.

Updates

Already publish mayajs/router on npm. I will update @mayajs/core to use this library and remove express as dependency.

βš™οΈ Component

@mayajs/routing

πŸ“‹ Todo:

  • Create a routing library
  • Routing must be able to plug over app.module.ts
  • Routing must be able to have middlewares like express does
  • Routing can handle all types of HTTP METHODS
  • Routing can have a default validator (OPTIONAL)
  • Routing can have a default response handler (OPTIONAL)

πŸ” Additional Info

This feature is vital for the release of version 1.0.0.

FEAT: Add support for swagger

πŸ“ Description

Describe the solution you'd like
I wanted to have a ready made documentation on all the routes and models

πŸ“‹ Todo:

  • Add swagger to maya js

Can't inject service to another service that injects it

πŸ“ Describe the bug

Can't inject service to dependent service and vice versa
e.g. (service a >> service b >> service c >> service a)

To Reproduce
Steps to reproduce the behavior:

  1. Create 2 service for their respective controllers using the command: maya generate service <service-name>
  2. Make sure both service are decorated with "@Injectable()" decorator from "@maya/common"
  3. Inject service 1 to service 2
  4. Inject service 2 to service 1
  5. Run command: maya serve

Sample Service 1 Code

@Injectable()
export class Sample1Service {
  constructor(private service: Sample2Service) {}
}

Sample Service 2 Code

@Injectable()
export class Sample2Service {
  constructor(private service: Sample1Service) {}
}

πŸ“· Screenshots

Terminal Error

image

Typo in github action's message for creating issues and PRs.

πŸ“ Describe the bug

I saw the greetings.yml file under .github >> workflow directory, is that a typo error?

**greetings.yml **

name: Greetings

on: [pull_request, issues]

jobs:
  greeting:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/first-interaction@v1
      with:
        repo-token: ${{ secrets.GITHUB_TOKEN }}
        issue-message: 'Thank you for creating your first issue. Keep collaborating!!!'' first issue'
        pr-message: 'Thank you for creating your first PR. We will review it shortly.'' first pr'

Types and Interfaces are missing

πŸ“ Describe the bug

Typescript can't find definition file for mongoose types and interfaces. You can fix this by installing their type definitions.

mongoose

npm i @types/mongoose

mongoose-paginate

npm i @types/mongoose-paginate

It will be nice if this definitions are included on the package.

Suggestion

Moved @types/mongoose and @types/mongoose-paginate from devDependecies to dependencies object in package.json.

image

πŸ“· Screenshots

image

App Module

πŸ“ Description

App module will be the one to accepts all the server settings. It will use the App decorator that decorates all the settings on it. App decorator will accept a settings object. All the settings are list below.

Sample AppModule class decorated with App and accepts settings options interface.

@App({
  cors?: boolean; // Enable CORS default false
  logs?: string; // Enable logging OPTIONAL

  // Connect to MongoDB OPTIONAL
  mongoConnection?: { 
    url: string;  // Connection string
    options?: ConnectionOptions | undefined; // Mongoose connect options OPTIONAL
  };

  // Port number where the server will listen
  port: number; // Default 3333

  // List of routes with controllers and middlewares
  routes: Array<{
    callback?: Function; // This call function will be called last
    controllers: Controller[]; // List of Controllers
    middlewares: Function[]; // Middlewares for all the routes i.e. JWT Authentication
    path: string; // Main path of this route
  }>;
})
export class AppModule{};

NOTE:

Middlewares on the routes array applied for all the controllers. If you want to apply a middleware for a specific route. You can define it on the validations option of the METHOD DECORATOR.

Method decorator middleware example:

@Post({
    path: "/",
    validations: [ /* middlewares for specific route */ ],
  })

πŸ“‹ Todo:

  • Create App Decorator
  • Add optional CORS
  • Add mongoose for MongoDB connection
  • Add express for creating server to use in background
  • Add morgan for optional logging

πŸ” Additional Info

For SQL connection and other database type it will be added on the future. For now we are just focusing on MongoDB.

Rename validations to middlewares

πŸ“ Description

There's a little bit confusion on what validations really are on the Method Decorators. For clarity sake can we rename it to just middlewares. Middlewares can be also considered as validations.
image

βš™οΈ Component

  • Method Decorators

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.