Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .changeset/rude-walls-hug.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
'@example/erp': minor
---

- Base components for the kiotos next app

- [Create a dashboard and simple collection list](https://app.plane.so/softnetics/browse/DRIZZ-54/)

- [See the PR](https://github.com/softnetics/kivotos/pull/6)
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,5 @@ yarn-error.log*
.DS_Store
*.pem

.data
.data
packages/drizzlify-next/drizzilify.code-workspace
8 changes: 5 additions & 3 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,11 @@
},
"editor.formatOnSaveMode": "file",
"typescript.tsdk": "node_modules/typescript/lib",
"tailwindCSS.classFunctions": ["cva", "cx"],
"tailwindCSS.experimental.configFile": {
"packages/drizzlify-next/src/styles/tailwind.css": "packages/drizzlify-next/**",
"apps-api/erp/src/app/global.css": "apps-api/erp/**",
"apps-api/erp/src/app/(admin)/admin/tailwind.css": "apps-api/erp/(admin)/**"
"packages/next/src/styles/tailwind.css": "packages/next/**",
"examples/erp/src/app/global.css": "examples/erp/**",
"examples/erp/src/app/(admin)/admin/tailwind.css": "examples/erp/(admin)/**",
"examples/erp/src/app/(admin)/playground/tailwind.css": "examples/erp/(admin)/playground/**"
}
}
22 changes: 15 additions & 7 deletions examples/erp/db/schema/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { relations } from 'drizzle-orm'
import { relations, sql } from 'drizzle-orm'
import { boolean, pgTable, text, timestamp, uuid, varchar } from 'drizzle-orm/pg-core'

const timestamps = {
Expand All @@ -8,7 +8,9 @@ const timestamps = {
}

export const users = pgTable('users', {
id: text('id').primaryKey(),
id: uuid('id')
.primaryKey()
.default(sql`gen_random_uuid()`),
name: text('name').notNull(),
email: text('email').notNull().unique(),
emailVerified: boolean('email_verified').notNull().default(false),
Expand All @@ -22,7 +24,7 @@ export const sessions = pgTable('session', {
token: text('token').notNull().unique(),
ipAddress: text('ip_address'),
userAgent: text('user_agent'),
userId: text('user_id')
userId: uuid('user_id')
.notNull()
.references(() => users.id, { onDelete: 'cascade' }),
...timestamps,
Expand All @@ -32,7 +34,7 @@ export const accounts = pgTable('account', {
id: text('id').primaryKey(),
accountId: text('account_id').notNull(),
providerId: text('provider_id').notNull(),
userId: text('user_id')
userId: uuid('user_id')
.notNull()
.references(() => users.id, { onDelete: 'cascade' }),
accessToken: text('access_token'),
Expand All @@ -54,7 +56,9 @@ export const verifications = pgTable('verification', {
})

export const posts = pgTable('posts', {
id: uuid().primaryKey(),
id: uuid()
.primaryKey()
.default(sql`gen_random_uuid()`),
title: varchar(),
content: text(),
authorId: uuid().references(() => users.id),
Expand All @@ -72,7 +76,9 @@ export const postsRelations = relations(posts, ({ one }) => ({
}))

export const categories = pgTable('categories', {
id: uuid().primaryKey(),
id: uuid()
.primaryKey()
.default(sql`gen_random_uuid()`),
name: varchar().notNull(),
ownerId: uuid().references(() => users.id),
...timestamps,
Expand All @@ -85,7 +91,9 @@ export const categoriesRelations = relations(categories, ({ many, one }) => ({
}))

export const categoryTags = pgTable('categoryTags', {
id: uuid().primaryKey(),
id: uuid()
.primaryKey()
.default(sql`gen_random_uuid()`),
name: varchar().notNull(),
category: uuid().references(() => categories.id),
...timestamps,
Expand Down
35 changes: 0 additions & 35 deletions examples/erp/drizzle/0000_eminent_sheva_callister.sql

This file was deleted.

87 changes: 87 additions & 0 deletions examples/erp/drizzle/0000_mean_mojo.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
CREATE TABLE "account" (
"id" text PRIMARY KEY NOT NULL,
"account_id" text NOT NULL,
"provider_id" text NOT NULL,
"user_id" uuid NOT NULL,
"access_token" text,
"refresh_token" text,
"id_token" text,
"access_token_expires_at" timestamp,
"refresh_token_expires_at" timestamp,
"scope" text,
"password" text,
"updatedAt" timestamp DEFAULT now(),
"createdAt" timestamp DEFAULT now() NOT NULL,
"deletedAt" timestamp
);
--> statement-breakpoint
CREATE TABLE "categories" (
"id" uuid PRIMARY KEY NOT NULL,
"name" varchar NOT NULL,
"ownerId" uuid,
"updatedAt" timestamp DEFAULT now(),
"createdAt" timestamp DEFAULT now() NOT NULL,
"deletedAt" timestamp
);
--> statement-breakpoint
CREATE TABLE "categoryTags" (
"id" uuid PRIMARY KEY NOT NULL,
"name" varchar NOT NULL,
"category" uuid,
"updatedAt" timestamp DEFAULT now(),
"createdAt" timestamp DEFAULT now() NOT NULL,
"deletedAt" timestamp
);
--> statement-breakpoint
CREATE TABLE "posts" (
"id" uuid PRIMARY KEY NOT NULL,
"title" varchar,
"content" text,
"authorId" uuid,
"categoryId" uuid,
"updatedAt" timestamp DEFAULT now(),
"createdAt" timestamp DEFAULT now() NOT NULL,
"deletedAt" timestamp
);
--> statement-breakpoint
CREATE TABLE "session" (
"id" text PRIMARY KEY NOT NULL,
"expires_at" timestamp NOT NULL,
"token" text NOT NULL,
"ip_address" text,
"user_agent" text,
"user_id" uuid NOT NULL,
"updatedAt" timestamp DEFAULT now(),
"createdAt" timestamp DEFAULT now() NOT NULL,
"deletedAt" timestamp,
CONSTRAINT "session_token_unique" UNIQUE("token")
);
--> statement-breakpoint
CREATE TABLE "users" (
"id" uuid PRIMARY KEY NOT NULL,
"name" text NOT NULL,
"email" text NOT NULL,
"email_verified" boolean DEFAULT false NOT NULL,
"image" text,
"updatedAt" timestamp DEFAULT now(),
"createdAt" timestamp DEFAULT now() NOT NULL,
"deletedAt" timestamp,
CONSTRAINT "users_email_unique" UNIQUE("email")
);
--> statement-breakpoint
CREATE TABLE "verification" (
"id" text PRIMARY KEY NOT NULL,
"identifier" text NOT NULL,
"value" text NOT NULL,
"expires_at" timestamp NOT NULL,
"updatedAt" timestamp DEFAULT now(),
"createdAt" timestamp DEFAULT now() NOT NULL,
"deletedAt" timestamp
);
--> statement-breakpoint
ALTER TABLE "account" ADD CONSTRAINT "account_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "categories" ADD CONSTRAINT "categories_ownerId_users_id_fk" FOREIGN KEY ("ownerId") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "categoryTags" ADD CONSTRAINT "categoryTags_category_categories_id_fk" FOREIGN KEY ("category") REFERENCES "public"."categories"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "posts" ADD CONSTRAINT "posts_authorId_users_id_fk" FOREIGN KEY ("authorId") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "posts" ADD CONSTRAINT "posts_categoryId_categories_id_fk" FOREIGN KEY ("categoryId") REFERENCES "public"."categories"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "session" ADD CONSTRAINT "session_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;
10 changes: 0 additions & 10 deletions examples/erp/drizzle/0001_fixed_blue_blade.sql

This file was deleted.

4 changes: 4 additions & 0 deletions examples/erp/drizzle/0001_tidy_tomas.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
ALTER TABLE "categories" ALTER COLUMN "id" SET DEFAULT gen_random_uuid();--> statement-breakpoint
ALTER TABLE "categoryTags" ALTER COLUMN "id" SET DEFAULT gen_random_uuid();--> statement-breakpoint
ALTER TABLE "posts" ALTER COLUMN "id" SET DEFAULT gen_random_uuid();--> statement-breakpoint
ALTER TABLE "users" ALTER COLUMN "id" SET DEFAULT gen_random_uuid();
Loading
Loading