Compare commits
No commits in common. "220ad5fdb532649c2b4fb2305562234219af420c" and "6075a0ed1ca1a7f8665c3d1e31620770919dafe2" have entirely different histories.
220ad5fdb5
...
6075a0ed1c
8
.env
8
.env
@ -11,7 +11,6 @@ NEXTCLOUD_URL=https://espace.slm-lab.net
|
|||||||
NEXTCLOUD_CLIENT_ID=espace.slm-lab.net
|
NEXTCLOUD_CLIENT_ID=espace.slm-lab.net
|
||||||
NEXTCLOUD_CLIENT_SECRET=YHLVMGpu0nGRaP7gMDpSjRr1ia6HiSr1
|
NEXTCLOUD_CLIENT_SECRET=YHLVMGpu0nGRaP7gMDpSjRr1ia6HiSr1
|
||||||
|
|
||||||
# Agenda/Calendar database (Prisma)
|
|
||||||
DATABASE_URL="postgresql://postgres:postgres@localhost:5432/calendar_db?schema=public"
|
DATABASE_URL="postgresql://postgres:postgres@localhost:5432/calendar_db?schema=public"
|
||||||
|
|
||||||
# Sidebar iframes
|
# Sidebar iframes
|
||||||
@ -47,12 +46,5 @@ ROCKET_CHAT_TOKEN=w91TYgkH-Z67Oz72usYdkW5TZLLRwnre7qyAhp7aHJB
|
|||||||
ROCKET_CHAT_USER_ID=Tpuww59PJKsrGNQJB
|
ROCKET_CHAT_USER_ID=Tpuww59PJKsrGNQJB
|
||||||
LEANTIME_TOKEN=lt_lsdShQdoYHaPUWuL07XZR1Rf3GeySsIs_UDlll3VJPk5EwAuILpMC4BwzJ9MZFRrb
|
LEANTIME_TOKEN=lt_lsdShQdoYHaPUWuL07XZR1Rf3GeySsIs_UDlll3VJPk5EwAuILpMC4BwzJ9MZFRrb
|
||||||
LEANTIME_API_URL=https://agilite.slm-lab.net
|
LEANTIME_API_URL=https://agilite.slm-lab.net
|
||||||
<<<<<<< HEAD
|
|
||||||
|
|
||||||
NEWSDB_URL=postgresql://alma:Sict33711###@cube.governance-labs.com/rivacube
|
NEWSDB_URL=postgresql://alma:Sict33711###@cube.governance-labs.com/rivacube
|
||||||
=======
|
|
||||||
DB_USER=alma
|
|
||||||
DB_PASSWORD=Sict33711###
|
|
||||||
DB_NAME=rivacube
|
|
||||||
DB_HOST=cube.governance-labs.com
|
|
||||||
>>>>>>> 1abc8e9fe8b5d9382da1c53238741114288da34c
|
|
||||||
|
|||||||
@ -1,25 +1,25 @@
|
|||||||
import { NextResponse } from 'next/server';
|
import { NextResponse } from 'next/server';
|
||||||
import { Pool } from 'pg';
|
import { prisma } from '@/lib/prisma';
|
||||||
|
|
||||||
const pool = new Pool({
|
|
||||||
connectionString: process.env.NEWSDB_URL,
|
|
||||||
});
|
|
||||||
|
|
||||||
export async function GET() {
|
export async function GET() {
|
||||||
try {
|
try {
|
||||||
const client = await pool.connect();
|
const news = await prisma.news.findMany({
|
||||||
try {
|
orderBy: {
|
||||||
const result = await client.query(
|
date: 'desc'
|
||||||
`SELECT id, title, date, source, description, category, url
|
},
|
||||||
FROM news
|
take: 5,
|
||||||
ORDER BY date DESC
|
select: {
|
||||||
LIMIT 5`
|
id: true,
|
||||||
);
|
title: true,
|
||||||
|
date: true,
|
||||||
|
source: true,
|
||||||
|
description: true,
|
||||||
|
category: true,
|
||||||
|
url: true
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
return NextResponse.json(result.rows);
|
return NextResponse.json(news);
|
||||||
} finally {
|
|
||||||
client.release();
|
|
||||||
}
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error fetching news:', error);
|
console.error('Error fetching news:', error);
|
||||||
return NextResponse.json(
|
return NextResponse.json(
|
||||||
|
|||||||
@ -1,13 +0,0 @@
|
|||||||
import { PrismaClient } from '@prisma/client/news'
|
|
||||||
|
|
||||||
const globalForPrisma = globalThis as unknown as {
|
|
||||||
prismaNews: PrismaClient | undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const prismaNews =
|
|
||||||
globalForPrisma.prismaNews ||
|
|
||||||
new PrismaClient({
|
|
||||||
log: ['query'],
|
|
||||||
})
|
|
||||||
|
|
||||||
if (process.env.NODE_ENV !== 'production') globalForPrisma.prismaNews = prismaNews
|
|
||||||
59
node_modules/.prisma/client/edge.js
generated
vendored
59
node_modules/.prisma/client/edge.js
generated
vendored
File diff suppressed because one or more lines are too long
32
node_modules/.prisma/client/index-browser.js
generated
vendored
32
node_modules/.prisma/client/index-browser.js
generated
vendored
@ -117,20 +117,27 @@ exports.Prisma.TransactionIsolationLevel = makeStrictEnum({
|
|||||||
Serializable: 'Serializable'
|
Serializable: 'Serializable'
|
||||||
});
|
});
|
||||||
|
|
||||||
exports.Prisma.NewsScalarFieldEnum = {
|
exports.Prisma.CalendarScalarFieldEnum = {
|
||||||
|
id: 'id',
|
||||||
|
name: 'name',
|
||||||
|
color: 'color',
|
||||||
|
description: 'description',
|
||||||
|
userId: 'userId',
|
||||||
|
createdAt: 'createdAt',
|
||||||
|
updatedAt: 'updatedAt'
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.Prisma.EventScalarFieldEnum = {
|
||||||
id: 'id',
|
id: 'id',
|
||||||
title: 'title',
|
title: 'title',
|
||||||
url: 'url',
|
|
||||||
date: 'date',
|
|
||||||
source: 'source',
|
|
||||||
content: 'content',
|
|
||||||
sentiment_score: 'sentiment_score',
|
|
||||||
sentiment: 'sentiment',
|
|
||||||
symbols: 'symbols',
|
|
||||||
symbol: 'symbol',
|
|
||||||
processed_at: 'processed_at',
|
|
||||||
description: 'description',
|
description: 'description',
|
||||||
category: 'category'
|
start: 'start',
|
||||||
|
end: 'end',
|
||||||
|
location: 'location',
|
||||||
|
isAllDay: 'isAllDay',
|
||||||
|
calendarId: 'calendarId',
|
||||||
|
createdAt: 'createdAt',
|
||||||
|
updatedAt: 'updatedAt'
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.Prisma.SortOrder = {
|
exports.Prisma.SortOrder = {
|
||||||
@ -150,7 +157,8 @@ exports.Prisma.NullsOrder = {
|
|||||||
|
|
||||||
|
|
||||||
exports.Prisma.ModelName = {
|
exports.Prisma.ModelName = {
|
||||||
News: 'News'
|
Calendar: 'Calendar',
|
||||||
|
Event: 'Event'
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
3383
node_modules/.prisma/client/index.d.ts
generated
vendored
3383
node_modules/.prisma/client/index.d.ts
generated
vendored
File diff suppressed because it is too large
Load Diff
59
node_modules/.prisma/client/index.js
generated
vendored
59
node_modules/.prisma/client/index.js
generated
vendored
File diff suppressed because one or more lines are too long
2
node_modules/.prisma/client/package.json
generated
vendored
2
node_modules/.prisma/client/package.json
generated
vendored
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "prisma-client-eeb846ee0ec87fa2c130414bdb67895badd3ab3283962f9d99affb3454d642b0",
|
"name": "prisma-client-a39bf2eb34241f9f263bba0d47613aa7e5863c7141c09c9c46ea39fc56dce086",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"types": "index.d.ts",
|
"types": "index.d.ts",
|
||||||
"browser": "index-browser.js",
|
"browser": "index-browser.js",
|
||||||
|
|||||||
51
node_modules/.prisma/client/schema.prisma
generated
vendored
51
node_modules/.prisma/client/schema.prisma
generated
vendored
@ -1,30 +1,39 @@
|
|||||||
// This is your Prisma schema file for the news database
|
|
||||||
generator client {
|
generator client {
|
||||||
provider = "prisma-client-js"
|
provider = "prisma-client-js"
|
||||||
binaryTargets = ["native", "linux-arm64-openssl-3.0.x"]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
datasource db {
|
datasource db {
|
||||||
provider = "postgresql"
|
provider = "postgresql"
|
||||||
url = env("NEWSDB_URL")
|
//TODO: Modifier l'url
|
||||||
|
url = "postgresql://enkun:183d9ad665c9257703c2e0703f111d240266a56b33e10df04fb8c565e55e0b94@172.16.32.141:5432/enkun?schema=public"
|
||||||
}
|
}
|
||||||
|
|
||||||
model News {
|
model Calendar {
|
||||||
id Int @id @default(autoincrement())
|
id String @id @default(cuid())
|
||||||
title String
|
name String
|
||||||
url String @unique
|
color String @default("#0082c9")
|
||||||
date DateTime
|
description String?
|
||||||
source String
|
userId String
|
||||||
content String?
|
createdAt DateTime @default(now())
|
||||||
sentiment_score Float?
|
updatedAt DateTime @updatedAt
|
||||||
sentiment String?
|
events Event[]
|
||||||
symbols String[]
|
|
||||||
symbol String?
|
|
||||||
processed_at DateTime @default(now())
|
|
||||||
description String?
|
|
||||||
category String? @db.VarChar(50)
|
|
||||||
|
|
||||||
@@index([category])
|
@@index([userId])
|
||||||
@@index([date])
|
}
|
||||||
@@index([symbol])
|
|
||||||
|
model Event {
|
||||||
|
id String @id @default(cuid())
|
||||||
|
title String
|
||||||
|
description String?
|
||||||
|
start DateTime
|
||||||
|
end DateTime
|
||||||
|
location String?
|
||||||
|
isAllDay Boolean @default(false)
|
||||||
|
calendar Calendar @relation(fields: [calendarId], references: [id], onDelete: Cascade)
|
||||||
|
calendarId String
|
||||||
|
createdAt DateTime @default(now())
|
||||||
|
updatedAt DateTime @updatedAt
|
||||||
|
|
||||||
|
@@index([calendarId])
|
||||||
|
@@index([start, end])
|
||||||
}
|
}
|
||||||
|
|||||||
32
node_modules/.prisma/client/wasm.js
generated
vendored
32
node_modules/.prisma/client/wasm.js
generated
vendored
@ -117,20 +117,27 @@ exports.Prisma.TransactionIsolationLevel = makeStrictEnum({
|
|||||||
Serializable: 'Serializable'
|
Serializable: 'Serializable'
|
||||||
});
|
});
|
||||||
|
|
||||||
exports.Prisma.NewsScalarFieldEnum = {
|
exports.Prisma.CalendarScalarFieldEnum = {
|
||||||
|
id: 'id',
|
||||||
|
name: 'name',
|
||||||
|
color: 'color',
|
||||||
|
description: 'description',
|
||||||
|
userId: 'userId',
|
||||||
|
createdAt: 'createdAt',
|
||||||
|
updatedAt: 'updatedAt'
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.Prisma.EventScalarFieldEnum = {
|
||||||
id: 'id',
|
id: 'id',
|
||||||
title: 'title',
|
title: 'title',
|
||||||
url: 'url',
|
|
||||||
date: 'date',
|
|
||||||
source: 'source',
|
|
||||||
content: 'content',
|
|
||||||
sentiment_score: 'sentiment_score',
|
|
||||||
sentiment: 'sentiment',
|
|
||||||
symbols: 'symbols',
|
|
||||||
symbol: 'symbol',
|
|
||||||
processed_at: 'processed_at',
|
|
||||||
description: 'description',
|
description: 'description',
|
||||||
category: 'category'
|
start: 'start',
|
||||||
|
end: 'end',
|
||||||
|
location: 'location',
|
||||||
|
isAllDay: 'isAllDay',
|
||||||
|
calendarId: 'calendarId',
|
||||||
|
createdAt: 'createdAt',
|
||||||
|
updatedAt: 'updatedAt'
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.Prisma.SortOrder = {
|
exports.Prisma.SortOrder = {
|
||||||
@ -150,7 +157,8 @@ exports.Prisma.NullsOrder = {
|
|||||||
|
|
||||||
|
|
||||||
exports.Prisma.ModelName = {
|
exports.Prisma.ModelName = {
|
||||||
News: 'News'
|
Calendar: 'Calendar',
|
||||||
|
Event: 'Event'
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -1,30 +0,0 @@
|
|||||||
// This is your Prisma schema file for the news database
|
|
||||||
generator client {
|
|
||||||
provider = "prisma-client-js"
|
|
||||||
binaryTargets = ["native", "linux-arm64-openssl-3.0.x"]
|
|
||||||
}
|
|
||||||
|
|
||||||
datasource db {
|
|
||||||
provider = "postgresql"
|
|
||||||
url = env("NEWSDB_URL")
|
|
||||||
}
|
|
||||||
|
|
||||||
model News {
|
|
||||||
id Int @id @default(autoincrement())
|
|
||||||
title String
|
|
||||||
url String @unique
|
|
||||||
date DateTime
|
|
||||||
source String
|
|
||||||
content String?
|
|
||||||
sentiment_score Float?
|
|
||||||
sentiment String?
|
|
||||||
symbols String[]
|
|
||||||
symbol String?
|
|
||||||
processed_at DateTime @default(now())
|
|
||||||
description String?
|
|
||||||
category String? @db.VarChar(50)
|
|
||||||
|
|
||||||
@@index([category])
|
|
||||||
@@index([date])
|
|
||||||
@@index([symbol])
|
|
||||||
}
|
|
||||||
@ -11,6 +11,11 @@ datasource db {
|
|||||||
url = env("DATABASE_URL")
|
url = env("DATABASE_URL")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
datasource newsdb {
|
||||||
|
provider = "postgresql"
|
||||||
|
url = env("NEWSDB_URL")
|
||||||
|
}
|
||||||
|
|
||||||
model Calendar {
|
model Calendar {
|
||||||
id String @id @default(uuid())
|
id String @id @default(uuid())
|
||||||
name String
|
name String
|
||||||
@ -41,3 +46,23 @@ model Event {
|
|||||||
@@index([calendarId])
|
@@index([calendarId])
|
||||||
@@index([userId])
|
@@index([userId])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
model News {
|
||||||
|
id Int @id @default(autoincrement())
|
||||||
|
title String
|
||||||
|
url String @unique
|
||||||
|
date DateTime
|
||||||
|
source String
|
||||||
|
content String?
|
||||||
|
sentiment_score Float?
|
||||||
|
sentiment String?
|
||||||
|
symbols String[]
|
||||||
|
symbol String?
|
||||||
|
processed_at DateTime @default(now())
|
||||||
|
description String?
|
||||||
|
category String? @db.VarChar(50)
|
||||||
|
|
||||||
|
@@index([category])
|
||||||
|
@@index([date])
|
||||||
|
@@index([symbol])
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user