Skip to content

Commit

Permalink
Working on profiles, upload, storage plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
Ian Walter committed Dec 31, 2021
1 parent b761ddc commit c7dba13
Show file tree
Hide file tree
Showing 14 changed files with 1,174 additions and 12 deletions.
6 changes: 5 additions & 1 deletion packages/whip-billing/package.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
{
"name": "@generates/whip-billing",
"license": "UNLICENSED"
"version": "0.0.0",
"license": "UNLICENSED",
"dependencies": {
"@generates/whip-prisma": "0.0.2"
}
}
6 changes: 6 additions & 0 deletions packages/whip-blog/index.js
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
import prisma from '@generates/whip-prisma'

export default function blogPlugin (app, opts) {
if (!app.prisma) prisma(app, opts.prisma)
}

blogPlugin.getSession
12 changes: 11 additions & 1 deletion packages/whip-blog/package.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
{
"name": "@generates/whip-blog",
"license": "UNLICENSED"
"version": "0.0.0",
"license": "UNLICENSED",
"scripts": {
"test": "bff"
},
"dependencies": {
"@generates/whip-prisma": "0.0.2"
},
"devDependencies": {
"@ianwalter/bff": "^11.2.2"
}
}
86 changes: 86 additions & 0 deletions packages/whip-blog/prisma/schema.prisma
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
// This is your Prisma schema file,
// learn more about it in the docs: https://pris.ly/d/prisma-schema

generator client {
provider = "prisma-client-js"
}

datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}

model Account {
id String @id
email String @unique
username String? @unique
firstName String?
lastName String?
password String
emailVerified Boolean @default(value: false)
enabled Boolean @default(value: true)
createdAt DateTime @default(now())
updatedAt DateTime @default(now())
tokens Token[]
blogPosts BlogPost[]
@@index([email])
@@index([username])
}

enum TokenType {
email
password
}

model Token {
id String @id
value String @unique
account Account @relation(fields: [accountId], references: [id], onDelete: Cascade)
accountId String
type TokenType @default(value: email)
email String
expiresAt DateTime
createdAt DateTime @default(now())
updatedAt DateTime @default(now())
@@index([email])
@@index([accountId])
}

model Session {
sid String @id
sess Json
expire DateTime
@@index([expire])
}

model BlogPost {
id String @id
title String
slug String
body String
status String @default(value: "draft")
account Account @relation(fields: [accountId], references: [id], onDelete: Cascade)
accountId String
createdAt DateTime @default(now())
updatedAt DateTime @default(now())
tags BlogTagOnBlogPost[]
}

model BlogTag {
id String @id
name String @unique
createdAt DateTime @default(now())
updatedAt DateTime @default(now())
posts BlogTagOnBlogPost[]
}

model BlogTagOnBlogPost {
id String @id
post BlogPost @relation(fields: [postId], references: [id], onDelete: Cascade)
postId String
tag BlogTag @relation(fields: [tagId], references: [id], onDelete: Cascade)
tagId String
}
Empty file added packages/whip-profiles/index.js
Empty file.
5 changes: 5 additions & 0 deletions packages/whip-profiles/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "@generates/whip-profiles",
"version": "0.0.0",
"license": "UNLICENSED"
}
68 changes: 68 additions & 0 deletions packages/whip-profiles/prisma/schema.prisma
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
// This is your Prisma schema file,
// learn more about it in the docs: https://pris.ly/d/prisma-schema

generator client {
provider = "prisma-client-js"
}

datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}

model Account {
id String @id
email String @unique
username String? @unique
firstName String?
lastName String?
password String
emailVerified Boolean @default(value: false)
enabled Boolean @default(value: true)
createdAt DateTime @default(now())
updatedAt DateTime @default(now())
tokens Token[]
profile Profile?
@@index([email])
@@index([username])
}

enum TokenType {
email
password
}

model Token {
id String @id
value String @unique
account Account @relation(fields: [accountId], references: [id], onDelete: Cascade)
accountId String
type TokenType @default(value: email)
email String
expiresAt DateTime
createdAt DateTime @default(now())
updatedAt DateTime @default(now())
@@index([email])
@@index([accountId])
}

model Session {
sid String @id
sess Json
expire DateTime
@@index([expire])
}

model Profile {
id String @id
name String
bio String?
imageUrl String?
account Account @relation(fields: [accountId], references: [id], onDelete: Cascade)
accountId String @unique
createdAt DateTime @default(now())
updatedAt DateTime @default(now())
}
Empty file added packages/whip-storage/index.js
Empty file.
8 changes: 8 additions & 0 deletions packages/whip-storage/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "@generates/whip-storage",
"version": "0.0.0",
"license": "UNLICENSED",
"dependencies": {
"@aws-sdk/client-s3": "^3.45.0"
}
}
4 changes: 2 additions & 2 deletions packages/whip-stripe/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import stripe from 'stripe'

export default function redisPlugin (app, opts) {
app.redis = stripe(opts)
export default function stripePlugin (app, opts) {
app.stripe = stripe(opts)
app.use(function stripeMiddleware (req, res, next) {
req.stripe = app.stripe
next()
Expand Down
8 changes: 8 additions & 0 deletions packages/whip-stripe/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "@generates/whip-stripe",
"version": "0.0.0",
"license": "UNLICENSED",
"dependencies": {
"stripe": "^8.195.0"
}
}
Empty file added packages/whip-upload/index.js
Empty file.
8 changes: 8 additions & 0 deletions packages/whip-upload/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "@generates/whip-upload",
"version": "0.0.0",
"license": "UNLICENSED",
"dependencies": {
"multer": "^1.4.4"
}
}
Loading

0 comments on commit c7dba13

Please sign in to comment.