Samples work in ui now
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { NextResponse } from 'next/server';
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { getDatasetsRoot } from '@/app/api/datasets/utils';
|
||||
import { getDatasetsRoot } from '@/server/settings';
|
||||
|
||||
export async function POST(request: Request) {
|
||||
try {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { NextResponse } from 'next/server';
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { getDatasetsRoot } from '@/app/api/datasets/utils';
|
||||
import { getDatasetsRoot } from '@/server/settings';
|
||||
|
||||
export async function POST(request: Request) {
|
||||
try {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { NextResponse } from 'next/server';
|
||||
import fs from 'fs';
|
||||
import { getDatasetsRoot } from '@/app/api/datasets/utils';
|
||||
import { getDatasetsRoot } from '@/server/settings';
|
||||
|
||||
export async function GET() {
|
||||
try {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { NextResponse } from 'next/server';
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { getDatasetsRoot } from '@/app/api/datasets/utils';
|
||||
import { getDatasetsRoot } from '@/server/settings';
|
||||
|
||||
export async function POST(request: Request) {
|
||||
const datasetsPath = await getDatasetsRoot();
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import { NextRequest, NextResponse } from 'next/server';
|
||||
import { writeFile, mkdir } from 'fs/promises';
|
||||
import { join } from 'path';
|
||||
import { getDatasetsRoot } from '@/app/api/datasets/utils';
|
||||
import { getDatasetsRoot } from '@/server/settings';
|
||||
|
||||
export async function POST(request: NextRequest) {
|
||||
try {
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
import { PrismaClient } from '@prisma/client';
|
||||
import { defaultDatasetsFolder } from '@/paths';
|
||||
|
||||
const prisma = new PrismaClient();
|
||||
|
||||
export const getDatasetsRoot = async () => {
|
||||
let row = await prisma.settings.findFirst({
|
||||
where: {
|
||||
key: 'DATASETS_FOLDER',
|
||||
},
|
||||
});
|
||||
let datasetsPath = defaultDatasetsFolder;
|
||||
if (row?.value && row.value !== '') {
|
||||
datasetsPath = row.value;
|
||||
}
|
||||
return datasetsPath;
|
||||
};
|
||||
Reference in New Issue
Block a user