application [cat-mini-app] view page [pages/home] development

This commit is contained in:
NVWA Code Agent
2025-12-11 16:41:35 +00:00
parent c6b99525ba
commit df2fbc3e4d
4 changed files with 1301 additions and 2 deletions

View File

@@ -1,14 +1,121 @@
<template>
<view class="flex flex-col items-center justify-center space-y-4">
Index123
<view class="min-h-screen bg-gradient-to-b from-orange-100 to-pink-100">
<!-- 顶部欢迎区域 -->
<view class="flex flex-col items-center pt-8 pb-6 px-4">
<view class="text-3xl font-bold text-orange-600 mb-2">🐱</view>
<text class="text-2xl font-bold text-orange-800">欢迎来到猫舍</text>
<text class="text-gray-600 mt-1">我们致力于为猫咪提供温馨的家</text>
</view>
<!-- 猫舍信息卡片 -->
<view v-if="shelter" class="mx-4 mb-6">
<view class="bg-white rounded-2xl shadow-lg p-6">
<!-- 猫舍名称 -->
<view class="flex items-center mb-4">
<view class="w-12 h-12 bg-orange-500 rounded-full flex items-center justify-center mr-3">
<text class="text-white text-xl">🏠</text>
</view>
<view>
<text class="text-xl font-bold text-gray-800">{{ shelter.name }}</text>
<text class="text-gray-500 block">猫舍介绍</text>
</view>
</view>
<!-- 描述 -->
<view class="mb-4" v-if="shelter.description">
<text class="text-gray-700 leading-relaxed">{{ shelter.description }}</text>
</view>
<!-- 地址和电话 -->
<view class="space-y-3">
<view class="flex items-center" v-if="shelter.address">
<text class="text-orange-500 mr-2">📍</text>
<text class="text-gray-700">{{ shelter.address }}</text>
</view>
<view class="flex items-center" v-if="shelter.phone">
<text class="text-orange-500 mr-2">📞</text>
<text class="text-gray-700">{{ shelter.phone }}</text>
</view>
</view>
<!-- 图片轮播 -->
<view v-if="images.length > 0" class="mt-6">
<swiper
class="h-48 rounded-xl overflow-hidden"
:indicator-dots="true"
:autoplay="true"
:interval="3000"
indicator-color="#ffedd5"
indicator-active-color="#ea580c"
>
<swiper-item v-for="(image, index) in images" :key="index">
<image
:src="image.url"
class="w-full h-full object-cover"
mode="aspectFill"
/>
</swiper-item>
</swiper>
</view>
</view>
</view>
<!-- 加载中 -->
<view v-else class="flex-1 flex items-center justify-center">
<view class="flex flex-col items-center">
<view class="w-8 h-8 border-4 border-orange-200 border-t-orange-500 rounded-full animate-spin mb-3"></view>
<text class="text-gray-600">正在加载猫舍信息...</text>
</view>
</view>
<!-- 底部导航提示 -->
<view class="fixed bottom-0 left-0 right-0 bg-white border-t border-gray-200 p-4">
<view class="flex justify-around">
<view class="flex flex-col items-center text-orange-500">
<text class="text-lg">🏠</text>
<text class="text-xs mt-1">首页</text>
</view>
<view class="flex flex-col items-center text-gray-400">
<text class="text-lg">🐱</text>
<text class="text-xs mt-1">猫咪</text>
</view>
<view class="flex flex-col items-center text-gray-400">
<text class="text-lg">🛒</text>
<text class="text-xs mt-1">商城</text>
</view>
<view class="flex flex-col items-center text-gray-400">
<text class="text-lg">👤</text>
<text class="text-xs mt-1">我的</text>
</view>
</view>
</view>
</view>
</template>
<script setup lang="ts">
import { ref, onMounted } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import { auth } from '@/lib/nvwa'
import { AUTH_REQUIRED } from '@/lib/config'
import redirectToLogin from '@/custom/redirect-to-login'
import { entities } from '@/lib/nvwa'
interface Shelter {
id: number
name: string
description?: string
address?: string
phone?: string
imageIds: number[]
}
interface AttributeFile {
id: number
url: string
}
const shelter = ref<Shelter | null>(null)
const images = ref<AttributeFile[]>([])
onLoad(async () => {
// 如果需要认证,检查登录状态
@@ -31,7 +138,56 @@ onLoad(async () => {
const userProfile = await auth.currentUser()
console.log("current user profile", userProfile)
}
// 加载猫舍信息
await loadShelterInfo()
})
const loadShelterInfo = async () => {
try {
// 获取猫舍信息(假设只有一个猫舍,取第一个)
const { data: shelterData, error: shelterError } = await entities
.from('shelter')
.select('*')
.limit(1)
if (shelterError) {
console.error('获取猫舍信息失败:', shelterError)
return
}
if (shelterData && shelterData.length > 0) {
shelter.value = shelterData[0]
// 如果有图片ID获取图片信息
if (shelter.value.imageIds && shelter.value.imageIds.length > 0) {
const { data: imageData, error: imageError } = await entities
.from('nvwa_attribute_file')
.select('id, url')
.in('id', shelter.value.imageIds)
if (imageError) {
console.error('获取图片信息失败:', imageError)
} else if (imageData) {
images.value = imageData
}
}
}
} catch (error) {
console.error('加载猫舍信息时发生错误:', error)
}
}
</script>
<style>
/* 自定义动画 */
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
.animate-spin {
animation: spin 1s linear infinite;
}
</style>
<style></style>

View File

@@ -0,0 +1,151 @@
CREATE TYPE "public"."cat_gender" AS ENUM('male', 'female');--> statement-breakpoint
CREATE TYPE "public"."cat_grade" AS ENUM('A', 'B', 'C', 'D');--> statement-breakpoint
CREATE TYPE "public"."cat_type" AS ENUM('breeding_male', 'breeding_female', 'kitten');--> statement-breakpoint
CREATE TYPE "public"."order_status" AS ENUM('pending', 'paid', 'shipped', 'delivered', 'cancelled');--> statement-breakpoint
CREATE TYPE "public"."reservation_status" AS ENUM('queuing', 'reserved', 'completed', 'cancelled');--> statement-breakpoint
CREATE TABLE "account" (
"id" text PRIMARY KEY NOT NULL,
"account_id" text NOT NULL,
"provider_id" text NOT NULL,
"user_id" text 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,
"created_at" timestamp DEFAULT now() NOT NULL,
"updated_at" timestamp NOT NULL
);
--> statement-breakpoint
CREATE TABLE "jwks" (
"id" text PRIMARY KEY NOT NULL,
"public_key" text NOT NULL,
"private_key" text NOT NULL,
"created_at" timestamp NOT NULL
);
--> statement-breakpoint
CREATE TABLE "session" (
"id" text PRIMARY KEY NOT NULL,
"expires_at" timestamp NOT NULL,
"token" text NOT NULL,
"created_at" timestamp DEFAULT now() NOT NULL,
"updated_at" timestamp NOT NULL,
"ip_address" text,
"user_agent" text,
"user_id" text NOT NULL,
CONSTRAINT "session_token_unique" UNIQUE("token")
);
--> statement-breakpoint
CREATE TABLE "user" (
"id" text PRIMARY KEY NOT NULL,
"name" text NOT NULL,
"email" text NOT NULL,
"email_verified" boolean DEFAULT false NOT NULL,
"image" text,
"created_at" timestamp DEFAULT now() NOT NULL,
"updated_at" timestamp DEFAULT now() NOT NULL,
"username" text,
"display_username" text,
"phone_number" text,
"phone_number_verified" boolean,
"role" text DEFAULT 'user',
"lang" text DEFAULT 'en',
CONSTRAINT "user_email_unique" UNIQUE("email"),
CONSTRAINT "user_username_unique" UNIQUE("username"),
CONSTRAINT "user_phone_number_unique" UNIQUE("phone_number")
);
--> statement-breakpoint
CREATE TABLE "verification" (
"id" text PRIMARY KEY NOT NULL,
"identifier" text NOT NULL,
"value" text NOT NULL,
"expires_at" timestamp NOT NULL,
"created_at" timestamp DEFAULT now() NOT NULL,
"updated_at" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE "nvwa_attribute_file" (
"id" serial PRIMARY KEY NOT NULL,
"name" varchar(255) NOT NULL,
"type" varchar(255) NOT NULL,
"description" text,
"url" varchar(255),
"created_at" timestamp DEFAULT now() NOT NULL,
"updated_at" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE "cat" (
"id" serial PRIMARY KEY NOT NULL,
"name" varchar(255) NOT NULL,
"age" integer NOT NULL,
"gender" "cat_gender" NOT NULL,
"grade" "cat_grade" NOT NULL,
"type" "cat_type" NOT NULL,
"is_available" boolean DEFAULT true NOT NULL,
"description" text,
"image_ids" jsonb DEFAULT '[]'::jsonb,
"created_at" timestamp DEFAULT now() NOT NULL,
"updated_at" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE "order_item" (
"id" serial PRIMARY KEY NOT NULL,
"order_id" integer NOT NULL,
"product_id" integer NOT NULL,
"quantity" integer NOT NULL,
"unit_price" numeric(10, 2) NOT NULL,
"created_at" timestamp DEFAULT now() NOT NULL,
"updated_at" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE "orders" (
"id" serial PRIMARY KEY NOT NULL,
"user_id" text NOT NULL,
"total_price" numeric(10, 2) NOT NULL,
"status" "order_status" DEFAULT 'pending' NOT NULL,
"created_at" timestamp DEFAULT now() NOT NULL,
"updated_at" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE "product" (
"id" serial PRIMARY KEY NOT NULL,
"name" varchar(255) NOT NULL,
"description" text,
"price" numeric(10, 2) NOT NULL,
"stock" integer DEFAULT 0 NOT NULL,
"image_ids" jsonb DEFAULT '[]'::jsonb,
"created_at" timestamp DEFAULT now() NOT NULL,
"updated_at" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE "reservation" (
"id" serial PRIMARY KEY NOT NULL,
"user_id" text NOT NULL,
"cat_id" integer,
"deposit" numeric(10, 2) NOT NULL,
"status" "reservation_status" DEFAULT 'queuing' NOT NULL,
"queue_order" integer,
"created_at" timestamp DEFAULT now() NOT NULL,
"updated_at" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE "shelter" (
"id" serial PRIMARY KEY NOT NULL,
"name" varchar(255) NOT NULL,
"description" text,
"address" varchar(255),
"phone" varchar(20),
"image_ids" jsonb DEFAULT '[]'::jsonb,
"created_at" timestamp DEFAULT now() NOT NULL,
"updated_at" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
ALTER TABLE "account" ADD CONSTRAINT "account_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "session" ADD CONSTRAINT "session_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "order_item" ADD CONSTRAINT "order_item_order_id_orders_id_fk" FOREIGN KEY ("order_id") REFERENCES "public"."orders"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "order_item" ADD CONSTRAINT "order_item_product_id_product_id_fk" FOREIGN KEY ("product_id") REFERENCES "public"."product"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "orders" ADD CONSTRAINT "orders_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "reservation" ADD CONSTRAINT "reservation_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "reservation" ADD CONSTRAINT "reservation_cat_id_cat_id_fk" FOREIGN KEY ("cat_id") REFERENCES "public"."cat"("id") ON DELETE set null ON UPDATE no action;

View File

@@ -0,0 +1,979 @@
{
"id": "1b566d40-7751-4219-bd5b-a822ae5ef7f2",
"prevId": "00000000-0000-0000-0000-000000000000",
"version": "7",
"dialect": "postgresql",
"tables": {
"public.account": {
"name": "account",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "text",
"primaryKey": true,
"notNull": true
},
"account_id": {
"name": "account_id",
"type": "text",
"primaryKey": false,
"notNull": true
},
"provider_id": {
"name": "provider_id",
"type": "text",
"primaryKey": false,
"notNull": true
},
"user_id": {
"name": "user_id",
"type": "text",
"primaryKey": false,
"notNull": true
},
"access_token": {
"name": "access_token",
"type": "text",
"primaryKey": false,
"notNull": false
},
"refresh_token": {
"name": "refresh_token",
"type": "text",
"primaryKey": false,
"notNull": false
},
"id_token": {
"name": "id_token",
"type": "text",
"primaryKey": false,
"notNull": false
},
"access_token_expires_at": {
"name": "access_token_expires_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"refresh_token_expires_at": {
"name": "refresh_token_expires_at",
"type": "timestamp",
"primaryKey": false,
"notNull": false
},
"scope": {
"name": "scope",
"type": "text",
"primaryKey": false,
"notNull": false
},
"password": {
"name": "password",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true
}
},
"indexes": {},
"foreignKeys": {
"account_user_id_user_id_fk": {
"name": "account_user_id_user_id_fk",
"tableFrom": "account",
"tableTo": "user",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.jwks": {
"name": "jwks",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "text",
"primaryKey": true,
"notNull": true
},
"public_key": {
"name": "public_key",
"type": "text",
"primaryKey": false,
"notNull": true
},
"private_key": {
"name": "private_key",
"type": "text",
"primaryKey": false,
"notNull": true
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.session": {
"name": "session",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "text",
"primaryKey": true,
"notNull": true
},
"expires_at": {
"name": "expires_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true
},
"token": {
"name": "token",
"type": "text",
"primaryKey": false,
"notNull": true
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true
},
"ip_address": {
"name": "ip_address",
"type": "text",
"primaryKey": false,
"notNull": false
},
"user_agent": {
"name": "user_agent",
"type": "text",
"primaryKey": false,
"notNull": false
},
"user_id": {
"name": "user_id",
"type": "text",
"primaryKey": false,
"notNull": true
}
},
"indexes": {},
"foreignKeys": {
"session_user_id_user_id_fk": {
"name": "session_user_id_user_id_fk",
"tableFrom": "session",
"tableTo": "user",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {
"session_token_unique": {
"name": "session_token_unique",
"nullsNotDistinct": false,
"columns": [
"token"
]
}
},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.user": {
"name": "user",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "text",
"primaryKey": true,
"notNull": true
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": true
},
"email": {
"name": "email",
"type": "text",
"primaryKey": false,
"notNull": true
},
"email_verified": {
"name": "email_verified",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": false
},
"image": {
"name": "image",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"username": {
"name": "username",
"type": "text",
"primaryKey": false,
"notNull": false
},
"display_username": {
"name": "display_username",
"type": "text",
"primaryKey": false,
"notNull": false
},
"phone_number": {
"name": "phone_number",
"type": "text",
"primaryKey": false,
"notNull": false
},
"phone_number_verified": {
"name": "phone_number_verified",
"type": "boolean",
"primaryKey": false,
"notNull": false
},
"role": {
"name": "role",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'user'"
},
"lang": {
"name": "lang",
"type": "text",
"primaryKey": false,
"notNull": false,
"default": "'en'"
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {
"user_email_unique": {
"name": "user_email_unique",
"nullsNotDistinct": false,
"columns": [
"email"
]
},
"user_username_unique": {
"name": "user_username_unique",
"nullsNotDistinct": false,
"columns": [
"username"
]
},
"user_phone_number_unique": {
"name": "user_phone_number_unique",
"nullsNotDistinct": false,
"columns": [
"phone_number"
]
}
},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.verification": {
"name": "verification",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "text",
"primaryKey": true,
"notNull": true
},
"identifier": {
"name": "identifier",
"type": "text",
"primaryKey": false,
"notNull": true
},
"value": {
"name": "value",
"type": "text",
"primaryKey": false,
"notNull": true
},
"expires_at": {
"name": "expires_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.nvwa_attribute_file": {
"name": "nvwa_attribute_file",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"name": {
"name": "name",
"type": "varchar(255)",
"primaryKey": false,
"notNull": true
},
"type": {
"name": "type",
"type": "varchar(255)",
"primaryKey": false,
"notNull": true
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false
},
"url": {
"name": "url",
"type": "varchar(255)",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.cat": {
"name": "cat",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"name": {
"name": "name",
"type": "varchar(255)",
"primaryKey": false,
"notNull": true
},
"age": {
"name": "age",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"gender": {
"name": "gender",
"type": "cat_gender",
"typeSchema": "public",
"primaryKey": false,
"notNull": true
},
"grade": {
"name": "grade",
"type": "cat_grade",
"typeSchema": "public",
"primaryKey": false,
"notNull": true
},
"type": {
"name": "type",
"type": "cat_type",
"typeSchema": "public",
"primaryKey": false,
"notNull": true
},
"is_available": {
"name": "is_available",
"type": "boolean",
"primaryKey": false,
"notNull": true,
"default": true
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false
},
"image_ids": {
"name": "image_ids",
"type": "jsonb",
"primaryKey": false,
"notNull": false,
"default": "'[]'::jsonb"
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.order_item": {
"name": "order_item",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"order_id": {
"name": "order_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"product_id": {
"name": "product_id",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"quantity": {
"name": "quantity",
"type": "integer",
"primaryKey": false,
"notNull": true
},
"unit_price": {
"name": "unit_price",
"type": "numeric(10, 2)",
"primaryKey": false,
"notNull": true
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"order_item_order_id_orders_id_fk": {
"name": "order_item_order_id_orders_id_fk",
"tableFrom": "order_item",
"tableTo": "orders",
"columnsFrom": [
"order_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"order_item_product_id_product_id_fk": {
"name": "order_item_product_id_product_id_fk",
"tableFrom": "order_item",
"tableTo": "product",
"columnsFrom": [
"product_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.orders": {
"name": "orders",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"user_id": {
"name": "user_id",
"type": "text",
"primaryKey": false,
"notNull": true
},
"total_price": {
"name": "total_price",
"type": "numeric(10, 2)",
"primaryKey": false,
"notNull": true
},
"status": {
"name": "status",
"type": "order_status",
"typeSchema": "public",
"primaryKey": false,
"notNull": true,
"default": "'pending'"
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"orders_user_id_user_id_fk": {
"name": "orders_user_id_user_id_fk",
"tableFrom": "orders",
"tableTo": "user",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.product": {
"name": "product",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"name": {
"name": "name",
"type": "varchar(255)",
"primaryKey": false,
"notNull": true
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false
},
"price": {
"name": "price",
"type": "numeric(10, 2)",
"primaryKey": false,
"notNull": true
},
"stock": {
"name": "stock",
"type": "integer",
"primaryKey": false,
"notNull": true,
"default": 0
},
"image_ids": {
"name": "image_ids",
"type": "jsonb",
"primaryKey": false,
"notNull": false,
"default": "'[]'::jsonb"
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.reservation": {
"name": "reservation",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"user_id": {
"name": "user_id",
"type": "text",
"primaryKey": false,
"notNull": true
},
"cat_id": {
"name": "cat_id",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"deposit": {
"name": "deposit",
"type": "numeric(10, 2)",
"primaryKey": false,
"notNull": true
},
"status": {
"name": "status",
"type": "reservation_status",
"typeSchema": "public",
"primaryKey": false,
"notNull": true,
"default": "'queuing'"
},
"queue_order": {
"name": "queue_order",
"type": "integer",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {
"reservation_user_id_user_id_fk": {
"name": "reservation_user_id_user_id_fk",
"tableFrom": "reservation",
"tableTo": "user",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
},
"reservation_cat_id_cat_id_fk": {
"name": "reservation_cat_id_cat_id_fk",
"tableFrom": "reservation",
"tableTo": "cat",
"columnsFrom": [
"cat_id"
],
"columnsTo": [
"id"
],
"onDelete": "set null",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
},
"public.shelter": {
"name": "shelter",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "serial",
"primaryKey": true,
"notNull": true
},
"name": {
"name": "name",
"type": "varchar(255)",
"primaryKey": false,
"notNull": true
},
"description": {
"name": "description",
"type": "text",
"primaryKey": false,
"notNull": false
},
"address": {
"name": "address",
"type": "varchar(255)",
"primaryKey": false,
"notNull": false
},
"phone": {
"name": "phone",
"type": "varchar(20)",
"primaryKey": false,
"notNull": false
},
"image_ids": {
"name": "image_ids",
"type": "jsonb",
"primaryKey": false,
"notNull": false,
"default": "'[]'::jsonb"
},
"created_at": {
"name": "created_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
},
"updated_at": {
"name": "updated_at",
"type": "timestamp",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
}
},
"enums": {
"public.cat_gender": {
"name": "cat_gender",
"schema": "public",
"values": [
"male",
"female"
]
},
"public.cat_grade": {
"name": "cat_grade",
"schema": "public",
"values": [
"A",
"B",
"C",
"D"
]
},
"public.cat_type": {
"name": "cat_type",
"schema": "public",
"values": [
"breeding_male",
"breeding_female",
"kitten"
]
},
"public.order_status": {
"name": "order_status",
"schema": "public",
"values": [
"pending",
"paid",
"shipped",
"delivered",
"cancelled"
]
},
"public.reservation_status": {
"name": "reservation_status",
"schema": "public",
"values": [
"queuing",
"reserved",
"completed",
"cancelled"
]
}
},
"schemas": {},
"sequences": {},
"roles": {},
"policies": {},
"views": {},
"_meta": {
"columns": {},
"schemas": {},
"tables": {}
}
}

View File

@@ -0,0 +1,13 @@
{
"version": "7",
"dialect": "postgresql",
"entries": [
{
"idx": 0,
"version": "7",
"when": 1765471271797,
"tag": "0000_yielding_ogun",
"breakpoints": true
}
]
}