Add support for company logos, including schema adjustments, validation, assets handling, and UI display enhancements.
This commit is contained in:
1
packages/db/src/migrations/0026_high_anita_blake.sql
Normal file
1
packages/db/src/migrations/0026_high_anita_blake.sql
Normal file
@@ -0,0 +1 @@
|
||||
ALTER TABLE "companies" ADD COLUMN IF NOT EXISTS "logo_url" text;
|
||||
5855
packages/db/src/migrations/meta/0026_snapshot.json
Normal file
5855
packages/db/src/migrations/meta/0026_snapshot.json
Normal file
File diff suppressed because it is too large
Load Diff
@@ -183,6 +183,13 @@
|
||||
"when": 1772807461603,
|
||||
"tag": "0025_nasty_salo",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 26,
|
||||
"version": "7",
|
||||
"when": 1772823634634,
|
||||
"tag": "0026_high_anita_blake",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -15,6 +15,7 @@ export const companies = pgTable(
|
||||
.notNull()
|
||||
.default(true),
|
||||
brandColor: text("brand_color"),
|
||||
logoUrl: text("logo_url"),
|
||||
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
|
||||
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
|
||||
},
|
||||
|
||||
@@ -11,6 +11,7 @@ export interface Company {
|
||||
spentMonthlyCents: number;
|
||||
requireBoardApprovalForNewAgents: boolean;
|
||||
brandColor: string | null;
|
||||
logoUrl: string | null;
|
||||
createdAt: Date;
|
||||
updatedAt: Date;
|
||||
}
|
||||
|
||||
@@ -1,10 +1,19 @@
|
||||
import { z } from "zod";
|
||||
import { COMPANY_STATUSES } from "../constants.js";
|
||||
|
||||
const logoUrlSchema = z
|
||||
.string()
|
||||
.trim()
|
||||
.max(2048)
|
||||
.regex(/^\/api\/assets\/[^\s]+$|^https?:\/\/[^\s]+$/)
|
||||
.nullable()
|
||||
.optional();
|
||||
|
||||
export const createCompanySchema = z.object({
|
||||
name: z.string().min(1),
|
||||
description: z.string().optional().nullable(),
|
||||
budgetMonthlyCents: z.number().int().nonnegative().optional().default(0),
|
||||
logoUrl: logoUrlSchema,
|
||||
});
|
||||
|
||||
export type CreateCompany = z.infer<typeof createCompanySchema>;
|
||||
@@ -16,6 +25,7 @@ export const updateCompanySchema = createCompanySchema
|
||||
spentMonthlyCents: z.number().int().nonnegative().optional(),
|
||||
requireBoardApprovalForNewAgents: z.boolean().optional(),
|
||||
brandColor: z.string().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional(),
|
||||
logoUrl: logoUrlSchema,
|
||||
});
|
||||
|
||||
export type UpdateCompany = z.infer<typeof updateCompanySchema>;
|
||||
|
||||
Reference in New Issue
Block a user