fix: updated db schema based on new immich schema
Signed-off-by: Varun Raj <varun@skcript.com>
This commit is contained in:
1 parent
c8f773a10f
commit
177fecffaf
10 files changed
+12
-13
No files matched your search
@@ -83,5 +83,5 @@ export default async function handler(
|
||||
.orderBy(desc(albums.createdAt));
|
||||
|
||||
const sortedAlbums = sortAlbums(dbAlbums as IAlbum[], sortBy, sortOrder);
|
||||
res.status(200).json(dbAlbums);
|
||||
res.status(200).json(sortedAlbums);
|
||||
}
|
||||
@@ -24,12 +24,12 @@ const SELECT_ORPHAN_PHOTOS = (date: string, ownerId: string) =>
|
||||
e."dateTimeOriginal",
|
||||
e."orientation"
|
||||
FROM
|
||||
assets a
|
||||
asset a
|
||||
LEFT JOIN
|
||||
albums_assets_assets aaa
|
||||
album_asset aaa
|
||||
ON a.id = aaa."assetsId"
|
||||
LEFT JOIN
|
||||
exif e
|
||||
asset_exif e
|
||||
ON a.id = e."assetId"
|
||||
WHERE
|
||||
aaa."albumsId" IS NULL
|
||||
@@ -58,6 +58,7 @@ export default async function handler(
|
||||
});
|
||||
return res.status(200).json(cleanedRows);
|
||||
} catch (error: any) {
|
||||
console.error(error);
|
||||
res.status(500).json({
|
||||
error: error?.message,
|
||||
});
|
||||
|
||||
@@ -45,6 +45,7 @@ export default async function handler(
|
||||
}
|
||||
return res.status(200).json(filteredRows);
|
||||
} catch (error: any) {
|
||||
console.error(error);
|
||||
res.status(500).json({
|
||||
error: error?.message,
|
||||
});
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
// pages/api/proxy.js
|
||||
|
||||
import { db } from "@/config/db";
|
||||
import { ENV } from "@/config/environment";
|
||||
import { getCurrentUser } from "@/handlers/serverUtils/user.utils";
|
||||
import { NextApiRequest, NextApiResponse } from "next";
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { pgTable, uuid, timestamp } from 'drizzle-orm/pg-core';
|
||||
|
||||
export const albumsAssetsAssets = pgTable('albums_assets_assets', {
|
||||
export const albumsAssetsAssets = pgTable('album_asset', {
|
||||
albumsId: uuid('albumsId').notNull(),
|
||||
assetsId: uuid('assetsId').notNull(),
|
||||
createdAt: timestamp('createdAt', { withTimezone: true }).defaultNow().notNull(),
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { pgTable, uuid, varchar, timestamp, boolean, text } from 'drizzle-orm/pg-core';
|
||||
|
||||
export const albums = pgTable('albums', {
|
||||
export const albums = pgTable('album', {
|
||||
id: uuid('id').defaultRandom().primaryKey().notNull(),
|
||||
ownerId: uuid('ownerId').notNull(),
|
||||
albumName: varchar('albumName').notNull().default('Untitled Album'),
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { pgTable, uuid, integer } from "drizzle-orm/pg-core";
|
||||
|
||||
export const assetFaces = pgTable("asset_faces", {
|
||||
export const assetFaces = pgTable("asset_face", {
|
||||
id: uuid("id").defaultRandom().primaryKey(),
|
||||
assetId: uuid("assetId").notNull(),
|
||||
personId: uuid("personId"),
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { pgTable, uuid, varchar, timestamp, boolean } from 'drizzle-orm/pg-core';
|
||||
|
||||
export const assets = pgTable('assets', {
|
||||
export const assets = pgTable('asset', {
|
||||
id: uuid('id').defaultRandom().primaryKey().notNull(),
|
||||
deviceAssetId: varchar('deviceAssetId').notNull(),
|
||||
ownerId: uuid('ownerId').notNull(),
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { pgTable, uuid, varchar, integer, bigint, timestamp, doublePrecision, text } from 'drizzle-orm/pg-core';
|
||||
import { assets } from './assets.schema'; // Assuming you have an assets table defined
|
||||
|
||||
export const exif = pgTable('exif', {
|
||||
export const exif = pgTable('asset_exif', {
|
||||
assetId: uuid('assetId').primaryKey().notNull().references(() => assets.id, { onDelete: 'cascade' }),
|
||||
make: varchar('make'),
|
||||
model: varchar('model'),
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { pgTable, uuid, varchar, timestamp, boolean, bigint } from "drizzle-orm/pg-core";
|
||||
|
||||
export const users = pgTable("users", {
|
||||
export const users = pgTable("user", {
|
||||
id: uuid("id").defaultRandom().primaryKey(),
|
||||
email: varchar("email").notNull(),
|
||||
password: varchar("password").notNull().default(''),
|
||||
|
||||
Reference in new issue
Block a user