-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
110 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
export const ResourceState = { | ||
Draft: "Draft", | ||
Published: "Published" | ||
} as const; | ||
export type ResourceState = (typeof ResourceState)[keyof typeof ResourceState]; | ||
Draft: "Draft", | ||
Published: "Published", | ||
} as const | ||
export type ResourceState = (typeof ResourceState)[keyof typeof ResourceState] | ||
export const ResourceType = { | ||
Page: "Page", | ||
Folder: "Folder" | ||
} as const; | ||
export type ResourceType = (typeof ResourceType)[keyof typeof ResourceType]; | ||
Page: "Page", | ||
Folder: "Folder", | ||
} as const | ||
export type ResourceType = (typeof ResourceType)[keyof typeof ResourceType] | ||
export const RoleType = { | ||
Admin: "Admin", | ||
Editor: "Editor", | ||
Publisher: "Publisher" | ||
} as const; | ||
export type RoleType = (typeof RoleType)[keyof typeof RoleType]; | ||
Admin: "Admin", | ||
Editor: "Editor", | ||
Publisher: "Publisher", | ||
} as const | ||
export type RoleType = (typeof RoleType)[keyof typeof RoleType] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,97 +1,99 @@ | ||
import type { ColumnType, GeneratedAlways } from "kysely"; | ||
export type Generated<T> = T extends ColumnType<infer S, infer I, infer U> | ||
? ColumnType<S, I | undefined, U> | ||
: ColumnType<T, T | undefined, T>; | ||
export type Timestamp = ColumnType<Date, Date | string, Date | string>; | ||
import type { ColumnType, GeneratedAlways } from "kysely" | ||
|
||
import type { ResourceState, ResourceType, RoleType } from "./generatedEnums"; | ||
import type { ResourceState, ResourceType, RoleType } from "./generatedEnums" | ||
|
||
export type Blob = { | ||
id: GeneratedAlways<string>; | ||
/** | ||
* @kyselyType(PrismaJson.BlobJsonContent) | ||
* [BlobJsonContent] | ||
*/ | ||
content: PrismaJson.BlobJsonContent; | ||
}; | ||
export type Footer = { | ||
id: GeneratedAlways<number>; | ||
siteId: number; | ||
/** | ||
* @kyselyType(PrismaJson.FooterJsonContent) | ||
* [FooterJsonContent] | ||
*/ | ||
content: PrismaJson.FooterJsonContent; | ||
}; | ||
export type Navbar = { | ||
id: GeneratedAlways<number>; | ||
siteId: number; | ||
/** | ||
* @kyselyType(PrismaJson.NavbarJsonContent) | ||
* [NavbarJsonContent] | ||
*/ | ||
content: PrismaJson.NavbarJsonContent; | ||
}; | ||
export type Permission = { | ||
id: GeneratedAlways<number>; | ||
resourceId: string; | ||
userId: string; | ||
role: RoleType; | ||
}; | ||
export type Resource = { | ||
id: GeneratedAlways<string>; | ||
title: string; | ||
permalink: string; | ||
siteId: number; | ||
parentId: string | null; | ||
publishedVersionId: string | null; | ||
draftBlobId: string | null; | ||
state: Generated<ResourceState | null>; | ||
type: ResourceType; | ||
}; | ||
export type Site = { | ||
id: GeneratedAlways<number>; | ||
name: string; | ||
/** | ||
* @kyselyType(PrismaJson.SiteJsonConfig) | ||
* [SiteJsonConfig] | ||
*/ | ||
config: PrismaJson.SiteJsonConfig; | ||
}; | ||
export type SiteMember = { | ||
userId: string; | ||
siteId: number; | ||
}; | ||
export type User = { | ||
id: string; | ||
name: string; | ||
email: string; | ||
phone: string; | ||
preferredName: string | null; | ||
}; | ||
export type VerificationToken = { | ||
identifier: string; | ||
token: string; | ||
attempts: Generated<number>; | ||
expires: Timestamp; | ||
}; | ||
export type Version = { | ||
id: GeneratedAlways<string>; | ||
versionNum: number; | ||
resourceId: string; | ||
blobId: string; | ||
publishedAt: Generated<Timestamp>; | ||
publishedBy: string; | ||
}; | ||
export type DB = { | ||
Blob: Blob; | ||
Footer: Footer; | ||
Navbar: Navbar; | ||
Permission: Permission; | ||
Resource: Resource; | ||
Site: Site; | ||
SiteMember: SiteMember; | ||
User: User; | ||
VerificationToken: VerificationToken; | ||
Version: Version; | ||
}; | ||
export type Generated<T> = | ||
T extends ColumnType<infer S, infer I, infer U> | ||
? ColumnType<S, I | undefined, U> | ||
: ColumnType<T, T | undefined, T> | ||
export type Timestamp = ColumnType<Date, Date | string, Date | string> | ||
|
||
export interface Blob { | ||
id: GeneratedAlways<string> | ||
/** | ||
* @kyselyType(PrismaJson.BlobJsonContent) | ||
* [BlobJsonContent] | ||
*/ | ||
content: PrismaJson.BlobJsonContent | ||
} | ||
export interface Footer { | ||
id: GeneratedAlways<number> | ||
siteId: number | ||
/** | ||
* @kyselyType(PrismaJson.FooterJsonContent) | ||
* [FooterJsonContent] | ||
*/ | ||
content: PrismaJson.FooterJsonContent | ||
} | ||
export interface Navbar { | ||
id: GeneratedAlways<number> | ||
siteId: number | ||
/** | ||
* @kyselyType(PrismaJson.NavbarJsonContent) | ||
* [NavbarJsonContent] | ||
*/ | ||
content: PrismaJson.NavbarJsonContent | ||
} | ||
export interface Permission { | ||
id: GeneratedAlways<number> | ||
resourceId: string | ||
userId: string | ||
role: RoleType | ||
} | ||
export interface Resource { | ||
id: GeneratedAlways<string> | ||
title: string | ||
permalink: string | ||
siteId: number | ||
parentId: string | null | ||
publishedVersionId: string | null | ||
draftBlobId: string | null | ||
state: Generated<ResourceState | null> | ||
type: ResourceType | ||
} | ||
export interface Site { | ||
id: GeneratedAlways<number> | ||
name: string | ||
/** | ||
* @kyselyType(PrismaJson.SiteJsonConfig) | ||
* [SiteJsonConfig] | ||
*/ | ||
config: PrismaJson.SiteJsonConfig | ||
} | ||
export interface SiteMember { | ||
userId: string | ||
siteId: number | ||
} | ||
export interface User { | ||
id: string | ||
name: string | ||
email: string | ||
phone: string | ||
preferredName: string | null | ||
} | ||
export interface VerificationToken { | ||
identifier: string | ||
token: string | ||
attempts: Generated<number> | ||
expires: Timestamp | ||
} | ||
export interface Version { | ||
id: GeneratedAlways<string> | ||
versionNum: number | ||
resourceId: string | ||
blobId: string | ||
publishedAt: Generated<Timestamp> | ||
publishedBy: string | ||
} | ||
export interface DB { | ||
Blob: Blob | ||
Footer: Footer | ||
Navbar: Navbar | ||
Permission: Permission | ||
Resource: Resource | ||
Site: Site | ||
SiteMember: SiteMember | ||
User: User | ||
VerificationToken: VerificationToken | ||
Version: Version | ||
} |