1 | # Odin <!-- omit in toc -->
|
2 |
|
3 | Odin is an implementation of [**Active Record**](https://en.wikipedia.org/wiki/Active_record_pattern) pattern in [**TypeScript**](https://typescriptlang.com).
|
4 |
|
5 | [![NPM Version](https://img.shields.io/npm/v/@foxify/odin.svg)](https://www.npmjs.com/package/@foxify/odin)
|
6 | [![Node Version](https://img.shields.io/node/v/@foxify/odin.svg)](https://nodejs.org)
|
7 | [![TypeScript Version](https://img.shields.io/npm/types/@foxify/odin.svg)](https://www.typescriptlang.org)
|
8 | [![Tested With Jest](https://img.shields.io/badge/tested_with-jest-99424f.svg)](https://github.com/facebook/jest)
|
9 | [![Pull Requests](https://img.shields.io/badge/PRs-Welcome-brightgreen.svg)](https://github.com/foxifyjs/odin/pulls)
|
10 | [![License](https://img.shields.io/github/license/foxifyjs/odin.svg)](https://github.com/foxifyjs/odin/blob/master/LICENSE)
|
11 | [![Build Status](https://api.travis-ci.com/foxifyjs/odin.svg?branch=master)](https://travis-ci.com/foxifyjs/odin)
|
12 | [![Coverage Status](https://codecov.io/gh/foxifyjs/odin/branch/master/graph/badge.svg)](https://codecov.io/gh/foxifyjs/odin)
|
13 | [![Package Quality](http://npm.packagequality.com/shield/%40foxify%2Fodin.svg)](http://packagequality.com/#?package=@foxify/odin)
|
14 | [![Dependencies Status](https://david-dm.org/foxifyjs/odin.svg)](https://david-dm.org/foxifyjs/odin)
|
15 | [![NPM Total Downloads](https://img.shields.io/npm/dt/@foxify/odin.svg)](https://www.npmjs.com/package/@foxify/odin)
|
16 | [![NPM Monthly Downloads](https://img.shields.io/npm/dm/@foxify/odin.svg)](https://www.npmjs.com/package/@foxify/odin)
|
17 | [![Open Issues](https://img.shields.io/github/issues-raw/foxifyjs/odin.svg)](https://github.com/foxifyjs/odin/issues?q=is%3Aopen+is%3Aissue)
|
18 | [![Closed Issues](https://img.shields.io/github/issues-closed-raw/foxifyjs/odin.svg)](https://github.com/foxifyjs/odin/issues?q=is%3Aissue+is%3Aclosed)
|
19 | [![known vulnerabilities](https://snyk.io/test/github/foxifyjs/odin/badge.svg?targetFile=package.json)](https://snyk.io/test/github/foxifyjs/odin?targetFile=package.json)
|
20 | [![Github Stars](https://img.shields.io/github/stars/foxifyjs/odin.svg?style=social)](https://github.com/foxifyjs/odin)
|
21 | [![Github Forks](https://img.shields.io/github/forks/foxifyjs/odin.svg?style=social&label=Fork)](https://github.com/foxifyjs/odin)
|
22 |
|
23 | ## Table of Content <!-- omit in toc -->
|
24 |
|
25 | - [Installation](#installation)
|
26 | - [Usage](#usage)
|
27 | - [Features](#features)
|
28 | - [TODO (RoadMap to version 1.0.0)](#todo-roadmap-to-version-100)
|
29 | - [Versioning](#versioning)
|
30 | - [Changelog](#changelog)
|
31 | - [Authors](#authors)
|
32 | - [License](#license)
|
33 | - [Support](#support)
|
34 |
|
35 | ## Installation
|
36 |
|
37 | Before installing, [download and install Node.js](https://nodejs.org/en/download).
|
38 | Node.js 8 or higher is required.
|
39 |
|
40 | ```bash
|
41 | npm i -s @foxify/odin
|
42 | ```
|
43 |
|
44 | ## Usage
|
45 |
|
46 | ```javascript
|
47 | const Odin = require("@foxify/odin");
|
48 |
|
49 | const { Types } = Odin;
|
50 |
|
51 | class User extends Odin {
|
52 | }
|
53 |
|
54 | User.schema = {
|
55 | email: Types.String.email.required,
|
56 | name: {
|
57 | first: Types.String.min(3).required,
|
58 | last: Types.String.min(3),
|
59 | }
|
60 | };
|
61 | ```
|
62 |
|
63 | ## Features
|
64 |
|
65 | 1. Written in `ES6`
|
66 | 2. `TypeScript` ready
|
67 | 3. `Active Record` pattern
|
68 | 4. `Schema` validation
|
69 | 5. `GraphQL Schema` generator (based on model schema)
|
70 | 6. `JSON Schema` generator (based on model schema)
|
71 |
|
72 | ## TODO (RoadMap to version 1.0.0)
|
73 |
|
74 | - [x] `Schema` validation
|
75 | - [ ] Model
|
76 | - [ ] Hooks
|
77 | - [x] `create`
|
78 | - [ ] `update`
|
79 | - [ ] `delete`
|
80 | - [ ] `restore`
|
81 | - [ ] Relationships
|
82 | - [x] `embedMany`
|
83 | - [x] `hasMany`
|
84 | - [x] `hasOne`
|
85 | - [ ] `hasManyThrough`
|
86 | - [ ] `hasOneThrough`
|
87 | - [ ] `Polymorphic`
|
88 | - [x] `morphMany`
|
89 | - [x] `morphOne`
|
90 | - [ ] `morphTo`
|
91 | - [ ] `morphManyThrough`
|
92 | - [ ] `morphOneThrough`
|
93 | - [ ] `morphToThrough`
|
94 | - [x] CRUD operations
|
95 | - [x] Create operation
|
96 | - [x] Read operation
|
97 | - [x] Update operation
|
98 | - [x] Delete operation
|
99 | - [x] `GraphQL` support
|
100 | - [x] `JSON Schema` support
|
101 | - [ ] Migrations
|
102 | - [ ] Seeding
|
103 | - [ ] Tests
|
104 |
|
105 | ## Versioning
|
106 |
|
107 | We use [SemVer](http://semver.org) for versioning. For the versions available, see the [tags on this repository](https://github.com/foxifyjs/odin/tags).
|
108 |
|
109 | ## Changelog
|
110 |
|
111 | See the [CHANGELOG.md](CHANGELOG.md) file for details
|
112 |
|
113 | ## Authors
|
114 |
|
115 | - **Ardalan Amini** - *Owner/Developer* - [@ardalanamini](https://github.com/ardalanamini)
|
116 |
|
117 | See also the list of [contributors](https://github.com/foxifyjs/odin/contributors) who participated in this project.
|
118 |
|
119 | ## License
|
120 |
|
121 | This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details
|
122 |
|
123 | ## Support
|
124 |
|
125 | If my work helps you, please consider
|
126 |
|
127 | [![Buy Me A Coffee](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/ardalanamini)
|
128 | [![Become A Patron](https://c5.patreon.com/external/logo/become_a_patron_button.png)](https://www.patreon.com/ardalanamini)
|