Refactor Kanel configuration and update schema files

- Updated kanel.config.js to use makePgTsGenerator and adjusted type filtering.
- Modified various schema files to remove autogenerated comments and updated type definitions for enums to use union types.
- Added new MessagesAttachments schema and integrated it into PublicSchema.
- Ensured consistency in export types across all schema files.
This commit is contained in:
Marco Pedone 2026-04-27 16:53:54 +02:00
parent 98463da038
commit 2ac16e4f33
40 changed files with 97 additions and 197 deletions

View file

@ -1,5 +1,5 @@
const { makeKyselyHook } = require("kanel-kysely");
const { makePgTsGenerator } = require("kanel");
const ignoredTables = ["schema_migrations"];
/** @type {import('kanel').Config} */
@ -11,17 +11,19 @@ module.exports = {
password: "rootpost",
port: 5433,
},
typeFilter: (pgType) => !ignoredTables.includes(pgType.name),
preDeleteOutputFolder: true,
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: [makeKyselyHook()],
customTypeMap: {
"pg_catalog.tsvector": "string",
"pg_catalog.bpchar": "string",
'pg_catalog.numeric': 'number',
//"pg_catalog.json": "string",
},
preRenderHooks: [makeKyselyHook()],
}),
],
preDeleteOutputFolder: true,
};

View file

@ -1,8 +1,5 @@
// @generated
// This file is automatically generated by Kanel. Do not modify manually.
import type { default as PublicSchema } from './public/PublicSchema';
type Database = PublicSchema;
export default Database;
export default Database;

View file

@ -1,7 +1,3 @@
// @generated
// This file is automatically generated by Kanel. Do not modify manually.
import type { Caratteristiche } from '../../utils/kanel-types.ts';
import type { ColumnType, Selectable, Insertable, Updateable } from 'kysely';
/** Identifier type for public.annunci */
@ -89,7 +85,7 @@ export default interface AnnunciTable {
web: ColumnType<boolean | null, boolean | null, boolean | null>;
caratteristiche: ColumnType<Caratteristiche | null, Caratteristiche | null, Caratteristiche | null>;
caratteristiche: ColumnType<unknown | null, unknown | null, unknown | null>;
homepage: ColumnType<boolean | null, boolean | null, boolean | null>;
@ -118,4 +114,4 @@ export type Annunci = Selectable<AnnunciTable>;
export type NewAnnunci = Insertable<AnnunciTable>;
export type AnnunciUpdate = Updateable<AnnunciTable>;
export type AnnunciUpdate = Updateable<AnnunciTable>;

View file

@ -1,12 +1,8 @@
// @generated
// This file is automatically generated by Kanel. Do not modify manually.
/** Represents the enum public.BanType */
enum BanType {
ip = 'ip',
email = 'email',
phone = 'phone',
cf = 'cf',
};
type BanType =
| 'ip'
| 'email'
| 'phone'
| 'cf';
export default BanType;
export default BanType;

View file

@ -1,6 +1,3 @@
// @generated
// This file is automatically generated by Kanel. Do not modify manually.
import type { default as BanType } from './BanType';
import type { ColumnType, Selectable, Insertable, Updateable } from 'kysely';
@ -20,4 +17,4 @@ export type Banlist = Selectable<BanlistTable>;
export type NewBanlist = Insertable<BanlistTable>;
export type BanlistUpdate = Updateable<BanlistTable>;
export type BanlistUpdate = Updateable<BanlistTable>;

View file

@ -1,6 +1,3 @@
// @generated
// This file is automatically generated by Kanel. Do not modify manually.
import type { ColumnType, Selectable, Insertable, Updateable } from 'kysely';
/** Identifier type for public.banners */
@ -39,4 +36,4 @@ export type Banners = Selectable<BannersTable>;
export type NewBanners = Insertable<BannersTable>;
export type BannersUpdate = Updateable<BannersTable>;
export type BannersUpdate = Updateable<BannersTable>;

View file

@ -1,6 +1,3 @@
// @generated
// This file is automatically generated by Kanel. Do not modify manually.
import type { UsersId } from './Users';
import type { ColumnType, Selectable, Insertable, Updateable } from 'kysely';
@ -22,4 +19,4 @@ export type Chats = Selectable<ChatsTable>;
export type NewChats = Insertable<ChatsTable>;
export type ChatsUpdate = Updateable<ChatsTable>;
export type ChatsUpdate = Updateable<ChatsTable>;

View file

@ -1,6 +1,3 @@
// @generated
// This file is automatically generated by Kanel. Do not modify manually.
import type { ChatsChatid } from './Chats';
import type { EtichetteIdEtichetta } from './Etichette';
import type { ColumnType, Selectable, Insertable, Updateable } from 'kysely';
@ -16,4 +13,4 @@ export type ChatsEtichette = Selectable<ChatsEtichetteTable>;
export type NewChatsEtichette = Insertable<ChatsEtichetteTable>;
export type ChatsEtichetteUpdate = Updateable<ChatsEtichetteTable>;
export type ChatsEtichetteUpdate = Updateable<ChatsEtichetteTable>;

View file

@ -1,6 +1,3 @@
// @generated
// This file is automatically generated by Kanel. Do not modify manually.
import type { ColumnType, Selectable, Insertable, Updateable } from 'kysely';
/** Identifier type for public.comuni */
@ -23,4 +20,4 @@ export type Comuni = Selectable<ComuniTable>;
export type NewComuni = Insertable<ComuniTable>;
export type ComuniUpdate = Updateable<ComuniTable>;
export type ComuniUpdate = Updateable<ComuniTable>;

View file

@ -1,6 +1,3 @@
// @generated
// This file is automatically generated by Kanel. Do not modify manually.
import type { UsersId } from './Users';
import type { ColumnType, Selectable, Insertable, Updateable } from 'kysely';
@ -22,4 +19,4 @@ export type Emails = Selectable<EmailsTable>;
export type NewEmails = Insertable<EmailsTable>;
export type EmailsUpdate = Updateable<EmailsTable>;
export type EmailsUpdate = Updateable<EmailsTable>;

View file

@ -1,6 +1,3 @@
// @generated
// This file is automatically generated by Kanel. Do not modify manually.
import type { ColumnType, Selectable, Insertable, Updateable } from 'kysely';
/** Identifier type for public.etichette */
@ -19,4 +16,4 @@ export type Etichette = Selectable<EtichetteTable>;
export type NewEtichette = Insertable<EtichetteTable>;
export type EtichetteUpdate = Updateable<EtichetteTable>;
export type EtichetteUpdate = Updateable<EtichetteTable>;

View file

@ -1,6 +1,3 @@
// @generated
// This file is automatically generated by Kanel. Do not modify manually.
import type { ColumnType, Selectable, Insertable, Updateable } from 'kysely';
/** Identifier type for public.event_queue */
@ -21,4 +18,4 @@ export type EventQueue = Selectable<EventQueueTable>;
export type NewEventQueue = Insertable<EventQueueTable>;
export type EventQueueUpdate = Updateable<EventQueueTable>;
export type EventQueueUpdate = Updateable<EventQueueTable>;

View file

@ -1,6 +1,3 @@
// @generated
// This file is automatically generated by Kanel. Do not modify manually.
import type { ColumnType, Selectable, Insertable, Updateable } from 'kysely';
/** Identifier type for public.flags */
@ -17,4 +14,4 @@ export type Flags = Selectable<FlagsTable>;
export type NewFlags = Insertable<FlagsTable>;
export type FlagsUpdate = Updateable<FlagsTable>;
export type FlagsUpdate = Updateable<FlagsTable>;

View file

@ -1,11 +1,7 @@
// @generated
// This file is automatically generated by Kanel. Do not modify manually.
/** Represents the enum public.GenericStatusEnum */
enum GenericStatusEnum {
pending = 'pending',
success = 'success',
failed = 'failed',
};
type GenericStatusEnum =
| 'pending'
| 'success'
| 'failed';
export default GenericStatusEnum;
export default GenericStatusEnum;

View file

@ -1,6 +1,3 @@
// @generated
// This file is automatically generated by Kanel. Do not modify manually.
import type { ColumnType, Selectable, Insertable, Updateable } from 'kysely';
/** Represents the table public.images_refs */
@ -20,4 +17,4 @@ export type ImagesRefs = Selectable<ImagesRefsTable>;
export type NewImagesRefs = Insertable<ImagesRefsTable>;
export type ImagesRefsUpdate = Updateable<ImagesRefsTable>;
export type ImagesRefsUpdate = Updateable<ImagesRefsTable>;

View file

@ -1,6 +1,3 @@
// @generated
// This file is automatically generated by Kanel. Do not modify manually.
import type { ChatsChatid } from './Chats';
import type { UsersId } from './Users';
import type { ColumnType, Selectable, Insertable, Updateable } from 'kysely';
@ -31,4 +28,4 @@ export type Messages = Selectable<MessagesTable>;
export type NewMessages = Insertable<MessagesTable>;
export type MessagesUpdate = Updateable<MessagesTable>;
export type MessagesUpdate = Updateable<MessagesTable>;

View file

@ -0,0 +1,16 @@
import type { MessagesMessageid } from './Messages';
import type { UsersStorageUserStorageId } from './UsersStorage';
import type { ColumnType, Selectable, Insertable, Updateable } from 'kysely';
/** Represents the table public.messages_attachments */
export default interface MessagesAttachmentsTable {
messageId: ColumnType<MessagesMessageid, MessagesMessageid, MessagesMessageid>;
userStorageId: ColumnType<UsersStorageUserStorageId, UsersStorageUserStorageId, UsersStorageUserStorageId>;
}
export type MessagesAttachments = Selectable<MessagesAttachmentsTable>;
export type NewMessagesAttachments = Insertable<MessagesAttachmentsTable>;
export type MessagesAttachmentsUpdate = Updateable<MessagesAttachmentsTable>;

View file

@ -1,6 +1,3 @@
// @generated
// This file is automatically generated by Kanel. Do not modify manually.
import type { ColumnType, Selectable, Insertable, Updateable } from 'kysely';
/** Identifier type for public.nazioni */
@ -21,4 +18,4 @@ export type Nazioni = Selectable<NazioniTable>;
export type NewNazioni = Insertable<NazioniTable>;
export type NazioniUpdate = Updateable<NazioniTable>;
export type NazioniUpdate = Updateable<NazioniTable>;

View file

@ -1,13 +1,9 @@
// @generated
// This file is automatically generated by Kanel. Do not modify manually.
/** Represents the enum public.OrderTypeEnum */
enum OrderTypeEnum {
Acconto = 'Acconto',
Saldo = 'Saldo',
Consulenza = 'Consulenza',
Altro = 'Altro',
Rinnovo = 'Rinnovo',
};
type OrderTypeEnum =
| 'Acconto'
| 'Saldo'
| 'Consulenza'
| 'Altro'
| 'Rinnovo';
export default OrderTypeEnum;
export default OrderTypeEnum;

View file

@ -1,6 +1,3 @@
// @generated
// This file is automatically generated by Kanel. Do not modify manually.
import type { UsersId } from './Users';
import type { PrezziarioIdprezziario } from './Prezziario';
import type { ServizioServizioId } from './Servizio';
@ -47,4 +44,4 @@ export type Ordini = Selectable<OrdiniTable>;
export type NewOrdini = Insertable<OrdiniTable>;
export type OrdiniUpdate = Updateable<OrdiniTable>;
export type OrdiniUpdate = Updateable<OrdiniTable>;

View file

@ -1,11 +1,7 @@
// @generated
// This file is automatically generated by Kanel. Do not modify manually.
/** Represents the enum public.PaymentStatusEnum */
enum PaymentStatusEnum {
processing = 'processing',
success = 'success',
failed = 'failed',
};
type PaymentStatusEnum =
| 'processing'
| 'success'
| 'failed';
export default PaymentStatusEnum;
export default PaymentStatusEnum;

View file

@ -1,6 +1,3 @@
// @generated
// This file is automatically generated by Kanel. Do not modify manually.
import type { UsersId } from './Users';
import type { PotenzialiGroupsId } from './PotenzialiGroups';
import type { ColumnType, Selectable, Insertable, Updateable } from 'kysely';
@ -27,4 +24,4 @@ export type Potenziali = Selectable<PotenzialiTable>;
export type NewPotenziali = Insertable<PotenzialiTable>;
export type PotenzialiUpdate = Updateable<PotenzialiTable>;
export type PotenzialiUpdate = Updateable<PotenzialiTable>;

View file

@ -1,6 +1,3 @@
// @generated
// This file is automatically generated by Kanel. Do not modify manually.
import type { ColumnType, Selectable, Insertable, Updateable } from 'kysely';
/** Identifier type for public.potenziali_groups */
@ -19,4 +16,4 @@ export type PotenzialiGroups = Selectable<PotenzialiGroupsTable>;
export type NewPotenzialiGroups = Insertable<PotenzialiGroupsTable>;
export type PotenzialiGroupsUpdate = Updateable<PotenzialiGroupsTable>;
export type PotenzialiGroupsUpdate = Updateable<PotenzialiGroupsTable>;

View file

@ -1,6 +1,3 @@
// @generated
// This file is automatically generated by Kanel. Do not modify manually.
import type { default as OrderTypeEnum } from './OrderTypeEnum';
import type { default as TipologiaPosizioneEnum } from './TipologiaPosizioneEnum';
import type { ColumnType, Selectable, Insertable, Updateable } from 'kysely';
@ -39,4 +36,4 @@ export type Prezziario = Selectable<PrezziarioTable>;
export type NewPrezziario = Insertable<PrezziarioTable>;
export type PrezziarioUpdate = Updateable<PrezziarioTable>;
export type PrezziarioUpdate = Updateable<PrezziarioTable>;

View file

@ -1,6 +1,3 @@
// @generated
// This file is automatically generated by Kanel. Do not modify manually.
import type { ColumnType, Selectable, Insertable, Updateable } from 'kysely';
/** Identifier type for public.provincie */
@ -19,4 +16,4 @@ export type Provincie = Selectable<ProvincieTable>;
export type NewProvincie = Insertable<ProvincieTable>;
export type ProvincieUpdate = Updateable<ProvincieTable>;
export type ProvincieUpdate = Updateable<ProvincieTable>;

View file

@ -1,6 +1,3 @@
// @generated
// This file is automatically generated by Kanel. Do not modify manually.
import type { default as ServizioInteressiTable } from './ServizioInteressi';
import type { default as FlagsTable } from './Flags';
import type { default as AnnunciTable } from './Annunci';
@ -31,6 +28,7 @@ import type { default as NazioniTable } from './Nazioni';
import type { default as ImagesRefsTable } from './ImagesRefs';
import type { default as BannersTable } from './Banners';
import type { default as ServizioTable } from './Servizio';
import type { default as MessagesAttachmentsTable } from './MessagesAttachments';
export default interface PublicSchema {
servizio_interessi: ServizioInteressiTable;
@ -92,4 +90,6 @@ export default interface PublicSchema {
banners: BannersTable;
servizio: ServizioTable;
}
messages_attachments: MessagesAttachmentsTable;
}

View file

@ -1,6 +1,3 @@
// @generated
// This file is automatically generated by Kanel. Do not modify manually.
import type { ColumnType, Selectable, Insertable, Updateable } from 'kysely';
/** Represents the table public.ratelimiter */
@ -16,4 +13,4 @@ export type Ratelimiter = Selectable<RatelimiterTable>;
export type NewRatelimiter = Insertable<RatelimiterTable>;
export type RatelimiterUpdate = Updateable<RatelimiterTable>;
export type RatelimiterUpdate = Updateable<RatelimiterTable>;

View file

@ -1,6 +1,3 @@
// @generated
// This file is automatically generated by Kanel. Do not modify manually.
import type { UsersId } from './Users';
import type { ColumnType, Selectable, Insertable, Updateable } from 'kysely';
@ -26,4 +23,4 @@ export type Rinnovi = Selectable<RinnoviTable>;
export type NewRinnovi = Insertable<RinnoviTable>;
export type RinnoviUpdate = Updateable<RinnoviTable>;
export type RinnoviUpdate = Updateable<RinnoviTable>;

View file

@ -1,6 +1,3 @@
// @generated
// This file is automatically generated by Kanel. Do not modify manually.
import type { UsersId } from './Users';
import type { default as TipologiaPosizioneEnum } from './TipologiaPosizioneEnum';
import type { UsersStorageUserStorageId } from './UsersStorage';
@ -80,4 +77,4 @@ export type Servizio = Selectable<ServizioTable>;
export type NewServizio = Insertable<ServizioTable>;
export type ServizioUpdate = Updateable<ServizioTable>;
export type ServizioUpdate = Updateable<ServizioTable>;

View file

@ -1,6 +1,3 @@
// @generated
// This file is automatically generated by Kanel. Do not modify manually.
import type { ServizioServizioId } from './Servizio';
import type { AnnunciId } from './Annunci';
import type { default as StatusConfermaEnum } from './StatusConfermaEnum';
@ -46,4 +43,4 @@ export type ServizioAnnunci = Selectable<ServizioAnnunciTable>;
export type NewServizioAnnunci = Insertable<ServizioAnnunciTable>;
export type ServizioAnnunciUpdate = Updateable<ServizioAnnunciTable>;
export type ServizioAnnunciUpdate = Updateable<ServizioAnnunciTable>;

View file

@ -1,6 +1,3 @@
// @generated
// This file is automatically generated by Kanel. Do not modify manually.
import type { AnnunciId } from './Annunci';
import type { UsersId } from './Users';
import type { ColumnType, Selectable, Insertable, Updateable } from 'kysely';
@ -16,4 +13,4 @@ export type ServizioInteressi = Selectable<ServizioInteressiTable>;
export type NewServizioInteressi = Insertable<ServizioInteressiTable>;
export type ServizioInteressiUpdate = Updateable<ServizioInteressiTable>;
export type ServizioInteressiUpdate = Updateable<ServizioInteressiTable>;

View file

@ -1,11 +1,7 @@
// @generated
// This file is automatically generated by Kanel. Do not modify manually.
/** Represents the enum public.StatusConfermaEnum */
enum StatusConfermaEnum {
'Inviato conferma' = 'Inviato conferma',
'Conferma accettata' = 'Conferma accettata',
'Caparra versata' = 'Caparra versata',
};
type StatusConfermaEnum =
| 'Inviato conferma'
| 'Conferma accettata'
| 'Caparra versata';
export default StatusConfermaEnum;
export default StatusConfermaEnum;

View file

@ -1,6 +1,3 @@
// @generated
// This file is automatically generated by Kanel. Do not modify manually.
import type { ColumnType, Selectable, Insertable, Updateable } from 'kysely';
/** Identifier type for public.testi_e_stringhe */
@ -17,4 +14,4 @@ export type TestiEStringhe = Selectable<TestiEStringheTable>;
export type NewTestiEStringhe = Insertable<TestiEStringheTable>;
export type TestiEStringheUpdate = Updateable<TestiEStringheTable>;
export type TestiEStringheUpdate = Updateable<TestiEStringheTable>;

View file

@ -1,10 +1,6 @@
// @generated
// This file is automatically generated by Kanel. Do not modify manually.
/** Represents the enum public.TipologiaPosizioneEnum */
enum TipologiaPosizioneEnum {
Transitorio = 'Transitorio',
Stabile = 'Stabile',
};
type TipologiaPosizioneEnum =
| 'Transitorio'
| 'Stabile';
export default TipologiaPosizioneEnum;
export default TipologiaPosizioneEnum;

View file

@ -1,6 +1,3 @@
// @generated
// This file is automatically generated by Kanel. Do not modify manually.
import type { UsersId } from './Users';
import type { EtichetteIdEtichetta } from './Etichette';
import type { ColumnType, Selectable, Insertable, Updateable } from 'kysely';
@ -16,4 +13,4 @@ export type UserEtichette = Selectable<UserEtichetteTable>;
export type NewUserEtichette = Insertable<UserEtichetteTable>;
export type UserEtichetteUpdate = Updateable<UserEtichetteTable>;
export type UserEtichetteUpdate = Updateable<UserEtichetteTable>;

View file

@ -1,6 +1,3 @@
// @generated
// This file is automatically generated by Kanel. Do not modify manually.
import type { ColumnType, Selectable, Insertable, Updateable } from 'kysely';
/** Identifier type for public.user_invites */
@ -23,4 +20,4 @@ export type UserInvites = Selectable<UserInvitesTable>;
export type NewUserInvites = Insertable<UserInvitesTable>;
export type UserInvitesUpdate = Updateable<UserInvitesTable>;
export type UserInvitesUpdate = Updateable<UserInvitesTable>;

View file

@ -1,6 +1,3 @@
// @generated
// This file is automatically generated by Kanel. Do not modify manually.
import type { ColumnType, Selectable, Insertable, Updateable } from 'kysely';
/** Identifier type for public.users */
@ -53,4 +50,4 @@ export type Users = Selectable<UsersTable>;
export type NewUsers = Insertable<UsersTable>;
export type UsersUpdate = Updateable<UsersTable>;
export type UsersUpdate = Updateable<UsersTable>;

View file

@ -1,6 +1,3 @@
// @generated
// This file is automatically generated by Kanel. Do not modify manually.
import type { UsersId } from './Users';
import type { UsersStorageUserStorageId } from './UsersStorage';
import type { ColumnType, Selectable, Insertable, Updateable } from 'kysely';
@ -45,4 +42,4 @@ export type UsersAnagrafica = Selectable<UsersAnagraficaTable>;
export type NewUsersAnagrafica = Insertable<UsersAnagraficaTable>;
export type UsersAnagraficaUpdate = Updateable<UsersAnagraficaTable>;
export type UsersAnagraficaUpdate = Updateable<UsersAnagraficaTable>;

View file

@ -1,6 +1,3 @@
// @generated
// This file is automatically generated by Kanel. Do not modify manually.
import type { UsersId } from './Users';
import type { ColumnType, Selectable, Insertable, Updateable } from 'kysely';
@ -22,4 +19,4 @@ export type UsersStorage = Selectable<UsersStorageTable>;
export type NewUsersStorage = Insertable<UsersStorageTable>;
export type UsersStorageUpdate = Updateable<UsersStorageTable>;
export type UsersStorageUpdate = Updateable<UsersStorageTable>;

View file

@ -1,6 +1,3 @@
// @generated
// This file is automatically generated by Kanel. Do not modify manually.
import type { ColumnType, Selectable, Insertable, Updateable } from 'kysely';
/** Represents the table public.videos_refs */
@ -20,4 +17,4 @@ export type VideosRefs = Selectable<VideosRefsTable>;
export type NewVideosRefs = Insertable<VideosRefsTable>;
export type VideosRefsUpdate = Updateable<VideosRefsTable>;
export type VideosRefsUpdate = Updateable<VideosRefsTable>;