Skip to content
/ odin Public

Odin is an implementation of the Active Record pattern in TypeScript

License

Notifications You must be signed in to change notification settings

foxifyjs/odin

Repository files navigation

Odin

Odin is an implementation of Active Record pattern in TypeScript.

NPM Version Node Version TypeScript Version Tested With Jest Pull Requests License Build Status Coverage Status Package Quality Dependencies Status NPM Total Downloads NPM Monthly Downloads Open Issues Closed Issues known vulnerabilities Github Stars Github Forks

Table of Content

Installation

Before installing, download and install Node.js. Node.js 8 or higher is required.

npm i -s @foxify/odin

Usage

const Odin = require("@foxify/odin");

const { Types } = Odin;

class User extends Odin {
}

User.schema = {
  email: Types.String.email.required,
  name: {
    first: Types.String.min(3).required,
    last: Types.String.min(3),
  }
};

Features

  1. Written in ES6
  2. TypeScript ready
  3. Active Record pattern
  4. Schema validation
  5. GraphQL Schema generator (based on model schema)
  6. JSON Schema generator (based on model schema)

TODO (RoadMap to version 1.0.0)

  • Schema validation
  • Model
    • Hooks
      • create
      • update
      • delete
      • restore
    • Relationships
      • embedMany
      • hasMany
      • hasOne
      • hasManyThrough
      • hasOneThrough
      • Polymorphic
        • morphMany
        • morphOne
        • morphTo
        • morphManyThrough
        • morphOneThrough
        • morphToThrough
      • CRUD operations
        • Create operation
        • Read operation
        • Update operation
        • Delete operation
    • GraphQL support
    • JSON Schema support
  • Migrations
  • Seeding
  • Tests

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Changelog

See the CHANGELOG.md file for details

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE file for details

Support

If my work helps you, please consider

Buy Me A Coffee Become A Patron