Skip to content
This repository has been archived by the owner on Jul 10, 2024. It is now read-only.

Commit

Permalink
✨ Redwood plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
Errorname committed Aug 16, 2020
1 parent 4fe925d commit 2d019df
Show file tree
Hide file tree
Showing 46 changed files with 3,563 additions and 170 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,16 +108,16 @@ Read more on how `prisma-multi-tenant` can help you achieve multi-tenancy for yo
- [Apollo](/docs/integrations/Apollo.md)
- [Nexus](/docs/integrations/Nexus.md)
- [Blitz](/docs/integrations/Blitz.md)
- Redwood (TODO)
- [Redwood](/docs/integrations/Redwood.md)
- Bison (TODO)
- [Examples](/docs/examples)
- [Basic (JS)](/docs/examples/basic-js)
- [Basic (TS)](/docs/examples/basic-ts)
- [Express](/docs/examples/express)
- [Apollo](/docs/examples/apollo)
- [Nexus](/docs/examples/nexus)
- Blitz (TODO)
- Redwood (TODO)
- [Blitz](/docs/examples/blitz)
- [Redwood](/docs/examples/redwood)
- Bison (TODO)
- [Issues with Vercel](/docs/Vercel.md)
- [Contributing guide](/docs/Contributing_Guide.md)
Expand Down
30 changes: 30 additions & 0 deletions docs/Complete_Documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ There are also plugins for Prisma-powered frameworks:

- The [Nexus plugin](#nexus-plugin) (`@prisma-multi-tenant/nexus`) which is a wrapper of the `nexus-plugin-prisma` package, and adds multi-tenancy to your Nexus application.
- The [Blitz plugin](#blitz-plugin) (`@prisma-multi-tenant/blitz`) which adds multi-tenancy to your Blitz application.
- The [Redwood plugin](#redwood-plugin) (`@prisma-multi-tenant/redwood`) which adds multi-tenancy to your Redwood application.

**Table of content:**

Expand All @@ -39,6 +40,8 @@ There are also plugins for Prisma-powered frameworks:
- [`prismaMultiTenant`](#prismamultitenantsettings-multitenantsettings-runtimeplugin)
- [Blitz plugin](#blitz-plugin)
- [`multiTenantMiddleware`](#multiTenantMiddlewaretenantRouter-function-prismaoptions-prismaclientoptions-middleware)
- [Redwood plugin](#redwood-plugin)
- [`fromContext`](#fromcontext-prismaclient)

## CLI

Expand Down Expand Up @@ -469,3 +472,30 @@ module.exports = {
],
}
```

## Redwood plugin

### `fromContext(): PrismaClient`

Dynamically return the Prisma Client instance from the context. This replaces the generated code from Redwood.

**Usage**

In the `api/src/lib/db.js` file:

```js
import { MultiTenant, fromContext } from '@prisma-multi-tenant/redwood'

export const multiTenant = new MultiTenant()
export const db = fromContext()
```

Everywhere else:

```js
import { db } from 'src/lib/db'

//

db.post.findMany()
```
2 changes: 1 addition & 1 deletion docs/Contributing_Guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Here are the steps to contribute:

1. [Finding an issue to work on](#1-finding-an-issue-to-work-on)
2. [Cloning and installing Prisma-multi-tenant](#2-cloning-and-installing-prisma-multi-tenant)
3. [Linking Prisma-multi-tenant](#3-linking-prisma-multi-tenant)
3. [Running and linking Prisma-multi-tenant](#3-running-and-linking-prisma-multi-tenant)
4. [Creating the Pull Request](#4-creating-the-pull-request)

## 1. Finding an issue to work on
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
- [Express](/docs/examples/express)
- [Apollo](/docs/examples/apollo)
- [Nexus](/docs/examples/nexus)
- Blitz (TODO)
- Redwood (TODO)
- [Blitz](/docs/examples/blitz)
- [Redwood](/docs/examples/redwood)
- Bison (TODO)

Do you want more examples? [Add an issue](https://github.com/Errorname/prisma-multi-tenant/issues/new) to request one!
28 changes: 14 additions & 14 deletions docs/examples/apollo/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions docs/examples/apollo/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "apollo",
"version": "2.2.0",
"version": "2.3.0",
"description": "",
"main": "index.js",
"scripts": {
Expand All @@ -10,7 +10,7 @@
"author": "",
"license": "ISC",
"dependencies": {
"@prisma-multi-tenant/client": "^2.2.0",
"@prisma-multi-tenant/client": "^2.3.0",
"apollo-server": "^2.16.0",
"graphql": "^15.3.0"
},
Expand Down
28 changes: 14 additions & 14 deletions docs/examples/basic-js/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions docs/examples/basic-js/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "basic-js",
"version": "2.2.0",
"version": "2.3.0",
"description": "",
"main": "index.js",
"scripts": {
Expand All @@ -11,7 +11,7 @@
"license": "ISC",
"dependencies": {
"@prisma/client": "^2.4.1",
"@prisma-multi-tenant/client": "^2.2.0"
"@prisma-multi-tenant/client": "^2.3.0"
},
"devDependencies": {
"@prisma/cli": "^2.4.1"
Expand Down
28 changes: 14 additions & 14 deletions docs/examples/basic-ts/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions docs/examples/basic-ts/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "basic-js",
"version": "2.2.0",
"version": "2.3.0",
"description": "",
"main": "index.js",
"scripts": {
Expand All @@ -11,7 +11,7 @@
"license": "ISC",
"dependencies": {
"@prisma/client": "^2.4.1",
"@prisma-multi-tenant/client": "^2.2.0"
"@prisma-multi-tenant/client": "^2.3.0"
},
"devDependencies": {
"@prisma/cli": "^2.4.1",
Expand Down
3 changes: 3 additions & 0 deletions docs/examples/blitz/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Blitz Example for Prisma-multi-tenant

TODO
28 changes: 14 additions & 14 deletions docs/examples/express/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions docs/examples/express/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "express",
"version": "2.2.0",
"version": "2.3.0",
"description": "",
"main": "index.js",
"scripts": {
Expand All @@ -10,7 +10,7 @@
"author": "",
"license": "ISC",
"dependencies": {
"@prisma-multi-tenant/client": "^2.2.0",
"@prisma-multi-tenant/client": "^2.3.0",
"express": "^4.17.1"
},
"devDependencies": {
Expand Down
Loading

0 comments on commit 2d019df

Please sign in to comment.