diff --git a/api/lib/models/Icon.ts b/api/lib/models/Icon.ts index 782b94b6f..b377acfed 100644 --- a/api/lib/models/Icon.ts +++ b/api/lib/models/Icon.ts @@ -11,6 +11,7 @@ export type Icon = { iconset: string; type2525b: string; data: string; + data_alt: string; path: string; username: string; } @@ -40,6 +41,7 @@ export default class IconModel extends Modeler { iconset: pgschema.Icon.iconset, type2525b: pgschema.Icon.type2525b, data: pgschema.Icon.data, + data_alt: pgschema.Icon.data_alt, path: pgschema.Icon.path, username: pgschema.Iconset.username }).from(this.generic) diff --git a/api/lib/schema.ts b/api/lib/schema.ts index 5655ec136..5df7aede3 100644 --- a/api/lib/schema.ts +++ b/api/lib/schema.ts @@ -160,7 +160,7 @@ export const Icon = pgTable('icons', { iconset: text().notNull().references(() => Iconset.uid), type2525b: text(), data: text().notNull(), - data_alt: text().notNull(), + data_alt: text(), path: text().notNull() }); diff --git a/api/lib/sprites.ts b/api/lib/sprites.ts index dbaaad5b1..9e0f0a567 100644 --- a/api/lib/sprites.ts +++ b/api/lib/sprites.ts @@ -1,8 +1,8 @@ import spritesmith from 'spritesmith'; import Vinyl from 'vinyl'; import { promisify } from 'node:util' -import type { Icon } from './schema.js'; -import { type InferSelectModel } from 'drizzle-orm'; +import { Static } from '@sinclair/typebox'; +import { IconResponse } from './types.js'; const SpriteSmith = promisify(spritesmith.run); @@ -10,7 +10,7 @@ type SpriteConfig = { name?: string; }; -export default async function(icons: Array>, config: SpriteConfig = {}) { +export default async function(icons: Array>, config: SpriteConfig = {}) { const doc = await SpriteSmith({ src: icons.map((icon) => { return new Vinyl({ diff --git a/api/migrations/0067_strange_lifeguard.sql b/api/migrations/0067_strange_lifeguard.sql index cc76ac882..edca39dac 100644 --- a/api/migrations/0067_strange_lifeguard.sql +++ b/api/migrations/0067_strange_lifeguard.sql @@ -1,4 +1,6 @@ UPDATE settings SET value = Replace(value, '"', '') - WHERE Starts_With(key, 'group:') + WHERE Starts_With(key, 'group:'); +ALTER TABLE icons + ADD COLUMN data_alt TEXT; diff --git a/api/routes/icons.ts b/api/routes/icons.ts index 1cdd8a146..e65a193c4 100644 --- a/api/routes/icons.ts +++ b/api/routes/icons.ts @@ -292,6 +292,7 @@ export default async function router(schema: Schema, config: Config) { body: Type.Object({ name: Default.NameField, data: Type.String(), + data_alt: Type.Optional(Type.String()), type2525b: Type.Optional(Type.Union([Type.String(), Type.Null()])) }), res: IconResponse @@ -404,6 +405,7 @@ export default async function router(schema: Schema, config: Config) { body: Type.Object({ name: Type.Optional(Type.String()), data: Type.Optional(Type.String()), + data_alt: Type.Optional(Type.String()), type2525b: Type.Optional(Type.Union([Type.String(), Type.Null()])) }), res: IconResponse