- Added file attachment support in chat messages, allowing users to upload and send files. - Implemented a new API endpoint to retrieve message attachments. - Updated chat components to display attachments and handle file uploads. - Improved user experience with loading indicators and toast notifications for file uploads. - Refactored chat bottom bar to integrate file upload functionality seamlessly. - Enhanced chat list to show attachments associated with messages. - Updated database schema to support attachments in chat messages. Co-authored-by: Copilot <copilot@github.com>
83 lines
2.1 KiB
JavaScript
83 lines
2.1 KiB
JavaScript
const { makeKyselyHook } = require("kanel-kysely");
|
|
const { makePgTsGenerator } = require("kanel");
|
|
const ignoredTables = ["schema_migrations"];
|
|
|
|
/**
|
|
* Allows for injection of custom types from the mapping of `table.field`
|
|
* @param {import("kanel").TypeMap} mappings
|
|
* @returns {import("kanel").PreRenderHook}
|
|
*/
|
|
const specificTypes = (mappings) => {
|
|
/** @type {import("kanel").PreRenderHook} */
|
|
return async (outputAcc, instantiatedConfig) => {
|
|
const output = { ...outputAcc };
|
|
|
|
for (const path of Object.keys(output)) {
|
|
const file = outputAcc[path];
|
|
const declarations = file.declarations.map((decl) => {
|
|
const declaration = { ...decl };
|
|
|
|
if (declaration.declarationType === "interface") {
|
|
for (const field of declaration.properties) {
|
|
const key = `${declaration.name}.${field.name}`;
|
|
if (mappings[key]) {
|
|
field.typeName = mappings[key].name;
|
|
declaration.typeImports = [
|
|
...(declaration.typeImports || []),
|
|
...mappings[key].typeImports,
|
|
];
|
|
}
|
|
}
|
|
}
|
|
return declaration;
|
|
});
|
|
|
|
output[path] = {
|
|
...file,
|
|
declarations,
|
|
};
|
|
}
|
|
|
|
return output;
|
|
};
|
|
}
|
|
|
|
/** @type {import('kanel').Config} */
|
|
module.exports = {
|
|
connection: {
|
|
host: "localhost",
|
|
user: "postgres",
|
|
database: "postgres",
|
|
password: "rootpost",
|
|
port: 5433,
|
|
},
|
|
filter: (pgTable) => !ignoredTables.includes(pgTable.name),
|
|
outputPath: "./src/schemas",
|
|
generators: [makePgTsGenerator({
|
|
customTypeMap: {
|
|
"pg_catalog.tsvector": "string",
|
|
"pg_catalog.bpchar": "string",
|
|
'pg_catalog.numeric': 'number',
|
|
//"pg_catalog.json": "string",
|
|
|
|
},
|
|
preRenderHooks: [
|
|
|
|
specificTypes({
|
|
"Annunci.caratteristiche": {
|
|
name: "Caratteristiche",
|
|
typeImports: [{ name: "Caratteristiche", path: "src/utils/kanel-types.ts", importAsType: true, isAbsolute: false, isDefault: false }],
|
|
},
|
|
}),
|
|
makeKyselyHook(),
|
|
],
|
|
|
|
}),
|
|
],
|
|
|
|
preDeleteOutputFolder: true,
|
|
|
|
typescriptConfig: {
|
|
enumStyle: "enum",
|
|
},
|
|
};
|