Refactor interests handling: replace 'interests' table with 'servizio_interessi' and add ServizioInteressi schema
This commit is contained in:
parent
ce958e1bab
commit
8725055fb3
3 changed files with 12 additions and 12 deletions
|
|
@ -1,6 +1,7 @@
|
|||
// @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';
|
||||
import type { default as UsersTable } from './Users';
|
||||
|
|
@ -22,11 +23,12 @@ import type { default as StorageindexTable } from './Storageindex';
|
|||
import type { default as MessagesTable } from './Messages';
|
||||
import type { default as UsersAnagraficaTable } from './UsersAnagrafica';
|
||||
import type { default as BanlistTable } from './Banlist';
|
||||
import type { default as InterestsTable } from './Interests';
|
||||
import type { default as BannersTable } from './Banners';
|
||||
import type { default as ServizioTable } from './Servizio';
|
||||
|
||||
export default interface PublicSchema {
|
||||
servizio_interessi: ServizioInteressiTable;
|
||||
|
||||
flags: FlagsTable;
|
||||
|
||||
annunci: AnnunciTable;
|
||||
|
|
@ -69,8 +71,6 @@ export default interface PublicSchema {
|
|||
|
||||
banlist: BanlistTable;
|
||||
|
||||
interests: InterestsTable;
|
||||
|
||||
banners: BannersTable;
|
||||
|
||||
servizio: ServizioTable;
|
||||
|
|
|
|||
|
|
@ -5,15 +5,15 @@ import type { AnnunciId } from './Annunci';
|
|||
import type { UsersId } from './Users';
|
||||
import type { ColumnType, Selectable, Insertable, Updateable } from 'kysely';
|
||||
|
||||
/** Represents the table public.interests */
|
||||
export default interface InterestsTable {
|
||||
/** Represents the table public.servizio_interessi */
|
||||
export default interface ServizioInteressiTable {
|
||||
annuncioId: ColumnType<AnnunciId, AnnunciId, AnnunciId>;
|
||||
|
||||
userId: ColumnType<UsersId, UsersId, UsersId>;
|
||||
}
|
||||
|
||||
export type Interests = Selectable<InterestsTable>;
|
||||
export type ServizioInteressi = Selectable<ServizioInteressiTable>;
|
||||
|
||||
export type NewInterests = Insertable<InterestsTable>;
|
||||
export type NewServizioInteressi = Insertable<ServizioInteressiTable>;
|
||||
|
||||
export type InterestsUpdate = Updateable<InterestsTable>;
|
||||
export type ServizioInteressiUpdate = Updateable<ServizioInteressiTable>;
|
||||
|
|
@ -12,7 +12,7 @@ export const AddIntrest = async ({
|
|||
}) => {
|
||||
try {
|
||||
await db
|
||||
.insertInto("interests")
|
||||
.insertInto("servizio_interessi")
|
||||
.values({
|
||||
annuncioId,
|
||||
userId,
|
||||
|
|
@ -38,7 +38,7 @@ export const RemoveInterest = async ({
|
|||
}) => {
|
||||
try {
|
||||
await db
|
||||
.deleteFrom("interests")
|
||||
.deleteFrom("servizio_interessi")
|
||||
.where("annuncioId", "=", annuncioId)
|
||||
.where("userId", "=", userId)
|
||||
.execute();
|
||||
|
|
@ -62,7 +62,7 @@ export const HasUserInterest = async ({
|
|||
}) => {
|
||||
try {
|
||||
const interest = await db
|
||||
.selectFrom("interests")
|
||||
.selectFrom("servizio_interessi")
|
||||
.where("annuncioId", "=", annuncioId)
|
||||
.where("userId", "=", userId)
|
||||
.selectAll()
|
||||
|
|
@ -82,7 +82,7 @@ export const GetUserInterests = async (userId: UsersId) => {
|
|||
try {
|
||||
return (
|
||||
await db
|
||||
.selectFrom("interests")
|
||||
.selectFrom("servizio_interessi")
|
||||
.where("userId", "=", userId)
|
||||
.select("annuncioId")
|
||||
.execute()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue