mirror of
https://gitea.gofwd.group/dstrawsb/ballistic-builder.git
synced 2025-12-06 02:36:44 -05:00
ok, we are nearly done
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { pgTable, integer, varchar, text, numeric, timestamp, uuid, unique, real, index, doublePrecision } from "drizzle-orm/pg-core"
|
||||
import { pgTable, integer, varchar, text, numeric, timestamp, uuid, unique, index, real, doublePrecision, pgView } from "drizzle-orm/pg-core"
|
||||
import { sql } from "drizzle-orm"
|
||||
|
||||
|
||||
@@ -67,38 +67,6 @@ export const manufacturer = pgTable("manufacturer", {
|
||||
}
|
||||
});
|
||||
|
||||
export const psa = pgTable("psa", {
|
||||
sku: varchar("SKU", { length: 50 }),
|
||||
manufacturerId: varchar("MANUFACTURER_ID", { length: 50 }),
|
||||
brandName: varchar("BRAND_NAME", { length: 50 }),
|
||||
productName: varchar("PRODUCT_NAME", { length: 255 }),
|
||||
longDescription: text("LONG_DESCRIPTION"),
|
||||
shortDescription: varchar("SHORT_DESCRIPTION", { length: 50 }),
|
||||
department: varchar("DEPARTMENT", { length: 50 }),
|
||||
category: varchar("CATEGORY", { length: 50 }),
|
||||
subcategory: varchar("SUBCATEGORY", { length: 50 }),
|
||||
thumbUrl: varchar("THUMB_URL", { length: 50 }),
|
||||
imageUrl: varchar("IMAGE_URL", { length: 50 }),
|
||||
buyLink: varchar("BUY_LINK", { length: 128 }),
|
||||
keywords: varchar("KEYWORDS", { length: 50 }),
|
||||
reviews: varchar("REVIEWS", { length: 50 }),
|
||||
retailPrice: real("RETAIL_PRICE"),
|
||||
salePrice: real("SALE_PRICE"),
|
||||
brandPageLink: varchar("BRAND_PAGE_LINK", { length: 50 }),
|
||||
brandLogoImage: varchar("BRAND_LOGO_IMAGE", { length: 50 }),
|
||||
productPageViewTracking: varchar("PRODUCT_PAGE_VIEW_TRACKING", { length: 256 }),
|
||||
parentGroupId: varchar("PARENT_GROUP_ID", { length: 50 }),
|
||||
fineline: varchar("FINELINE", { length: 50 }),
|
||||
superfineline: varchar("SUPERFINELINE", { length: 200 }),
|
||||
modelnumber: varchar("MODELNUMBER", { length: 50 }),
|
||||
caliber: varchar("CALIBER", { length: 200 }),
|
||||
upc: varchar("UPC", { length: 100 }),
|
||||
mediumImageUrl: varchar("MEDIUM_IMAGE_URL", { length: 50 }),
|
||||
productContentWidget: varchar("PRODUCT_CONTENT_WIDGET", { length: 256 }),
|
||||
googleCategorization: varchar("GOOGLE_CATEGORIZATION", { length: 50 }),
|
||||
itemBasedCommission: varchar("ITEM_BASED_COMMISSION", { length: 50 }),
|
||||
});
|
||||
|
||||
export const states = pgTable("states", {
|
||||
id: integer().primaryKey().generatedByDefaultAsIdentity({ name: "states_id_seq", startWith: 1, increment: 1, minValue: 1, maxValue: 2147483647, cache: 1 }),
|
||||
state: varchar({ length: 50 }),
|
||||
@@ -118,6 +86,34 @@ export const componentType = pgTable("component_type", {
|
||||
}
|
||||
});
|
||||
|
||||
export const aeroPrecision = pgTable("aero_precision", {
|
||||
sku: text().primaryKey().notNull(),
|
||||
manufacturerId: text("manufacturer_id"),
|
||||
brandName: text("brand_name"),
|
||||
productName: text("product_name"),
|
||||
longDescription: text("long_description"),
|
||||
shortDescription: text("short_description"),
|
||||
department: text(),
|
||||
category: text(),
|
||||
subcategory: text(),
|
||||
thumbUrl: text("thumb_url"),
|
||||
imageUrl: text("image_url"),
|
||||
buyLink: text("buy_link"),
|
||||
keywords: text(),
|
||||
reviews: text(),
|
||||
retailPrice: numeric("retail_price"),
|
||||
salePrice: numeric("sale_price"),
|
||||
brandPageLink: text("brand_page_link"),
|
||||
brandLogoImage: text("brand_logo_image"),
|
||||
productPageViewTracking: text("product_page_view_tracking"),
|
||||
variantsXml: text("variants_xml"),
|
||||
mediumImageUrl: text("medium_image_url"),
|
||||
productContentWidget: text("product_content_widget"),
|
||||
googleCategorization: text("google_categorization"),
|
||||
itemBasedCommission: text("item_based_commission"),
|
||||
uuid: uuid().defaultRandom(),
|
||||
});
|
||||
|
||||
export const compartment = pgTable("compartment", {
|
||||
id: uuid().defaultRandom().primaryKey().notNull(),
|
||||
name: varchar({ length: 100 }).notNull(),
|
||||
@@ -163,6 +159,80 @@ export const balAccounts = pgTable("bal_accounts", {
|
||||
}
|
||||
});
|
||||
|
||||
export const brownells = pgTable("brownells", {
|
||||
sku: text(),
|
||||
manufacturerId: text("manufacturer_id"),
|
||||
brandName: text("brand_name"),
|
||||
productName: text("product_name"),
|
||||
longDescription: text("long_description"),
|
||||
shortDescription: text("short_description"),
|
||||
department: text(),
|
||||
category: text(),
|
||||
subcategory: text(),
|
||||
thumbUrl: text("thumb_url"),
|
||||
imageUrl: text("image_url"),
|
||||
buyLink: text("buy_link"),
|
||||
keywords: text(),
|
||||
reviews: text(),
|
||||
retailPrice: numeric("retail_price"),
|
||||
salePrice: numeric("sale_price"),
|
||||
brandPageLink: text("brand_page_link"),
|
||||
brandLogoImage: text("brand_logo_image"),
|
||||
productPageViewTracking: text("product_page_view_tracking"),
|
||||
parentGroupId: text("parent_group_id"),
|
||||
color: text(),
|
||||
size: text(),
|
||||
pattern: text(),
|
||||
material: text(),
|
||||
ageGroup: text("age_group"),
|
||||
gender: text(),
|
||||
upc: text(),
|
||||
availability: text(),
|
||||
googleProductCategory: text("google_product_category"),
|
||||
mediumImageUrl: text("medium_image_url"),
|
||||
variantsXml: text("variants_xml"),
|
||||
gtin: text(),
|
||||
keyWords: text("key_words"),
|
||||
productContentWidget: text("product_content_widget"),
|
||||
googleCategorization: text("google_categorization"),
|
||||
itemBasedCommission: text("item_based_commission"),
|
||||
itemBasedCommissionRate: text("item_based_commission_rate"),
|
||||
itemBasedCommissionRule: text("item_based_commission_rule"),
|
||||
});
|
||||
|
||||
export const psa = pgTable("psa", {
|
||||
sku: varchar("SKU", { length: 50 }),
|
||||
manufacturerId: varchar("MANUFACTURER_ID", { length: 50 }),
|
||||
brandName: varchar("BRAND_NAME", { length: 50 }),
|
||||
productName: varchar("PRODUCT_NAME", { length: 255 }),
|
||||
longDescription: text("LONG_DESCRIPTION"),
|
||||
shortDescription: varchar("SHORT_DESCRIPTION", { length: 50 }),
|
||||
department: varchar("DEPARTMENT", { length: 50 }),
|
||||
category: varchar("CATEGORY", { length: 50 }),
|
||||
subcategory: varchar("SUBCATEGORY", { length: 50 }),
|
||||
thumbUrl: varchar("THUMB_URL", { length: 50 }),
|
||||
imageUrl: varchar("IMAGE_URL", { length: 50 }),
|
||||
buyLink: varchar("BUY_LINK", { length: 128 }),
|
||||
keywords: varchar("KEYWORDS", { length: 50 }),
|
||||
reviews: varchar("REVIEWS", { length: 50 }),
|
||||
retailPrice: real("RETAIL_PRICE"),
|
||||
salePrice: real("SALE_PRICE"),
|
||||
brandPageLink: varchar("BRAND_PAGE_LINK", { length: 50 }),
|
||||
brandLogoImage: varchar("BRAND_LOGO_IMAGE", { length: 50 }),
|
||||
productPageViewTracking: varchar("PRODUCT_PAGE_VIEW_TRACKING", { length: 256 }),
|
||||
parentGroupId: varchar("PARENT_GROUP_ID", { length: 50 }),
|
||||
fineline: varchar("FINELINE", { length: 50 }),
|
||||
superfineline: varchar("SUPERFINELINE", { length: 200 }),
|
||||
modelnumber: varchar("MODELNUMBER", { length: 50 }),
|
||||
caliber: varchar("CALIBER", { length: 200 }),
|
||||
upc: varchar("UPC", { length: 100 }),
|
||||
mediumImageUrl: varchar("MEDIUM_IMAGE_URL", { length: 50 }),
|
||||
productContentWidget: varchar("PRODUCT_CONTENT_WIDGET", { length: 256 }),
|
||||
googleCategorization: varchar("GOOGLE_CATEGORIZATION", { length: 50 }),
|
||||
itemBasedCommission: varchar("ITEM_BASED_COMMISSION", { length: 50 }),
|
||||
uuid: uuid().defaultRandom(),
|
||||
});
|
||||
|
||||
export const lipseycatalog = pgTable("lipseycatalog", {
|
||||
id: integer().primaryKey().generatedAlwaysAsIdentity({ name: "lipseycatalog_id_seq", startWith: 1, increment: 1, minValue: 1, maxValue: 2147483647, cache: 1 }),
|
||||
itemno: varchar({ length: 20 }).notNull(),
|
||||
@@ -275,3 +345,7 @@ export const balResellers = pgTable("bal_resellers", {
|
||||
balResellersUuidUnique: unique("bal_resellers_uuid_unique").on(table.uuid),
|
||||
}
|
||||
});
|
||||
export const vwProducts = pgView("vw_products", { aeroSku: text("aero_sku"),
|
||||
aeroCategory: text("aero_category"),
|
||||
aeroProductName: text("aero_product_name"),
|
||||
}).as(sql`SELECT aero.sku AS aero_sku, aero.category AS aero_category, aero.product_name AS aero_product_name FROM aero_precision aero WHERE aero.department = 'Stripped Lowers'::text UNION ALL SELECT psa."SKU" AS aero_sku, psa."CATEGORY" AS aero_category, psa."PRODUCT_NAME" AS aero_product_name FROM psa psa WHERE psa."FINELINE"::text = 'AR Complete Lowers'::text`);
|
||||
Reference in New Issue
Block a user