update api

This commit is contained in:
2025-03-23 18:16:09 +01:00
parent c716973525
commit 8d27d31968
9 changed files with 864 additions and 121 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,4 @@
GOOGLE_CLIENT_ID=""
GOOGLE_CLIENT_SECRET=""
GOOGLE_CALLBACK_URI="http://localhost:5173/login/google/callback"
MEMGRAPH_URI="bolt://localhost:7687"
MEMGRAPH_USER="memgraph"
MEMGRAPH_PASSWORD="memgraph"
DB_ADAPTER=""

View File

@@ -473,6 +473,17 @@ export interface operations {
"application/json": components["schemas"]["Person"];
};
};
/** @description Bad request */
400: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": {
msg?: string;
};
};
};
};
};
softDeletePerson: {
@@ -493,6 +504,17 @@ export interface operations {
};
content?: never;
};
/** @description Bad request */
400: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": {
msg?: string;
};
};
};
};
};
hardDeletePerson: {
@@ -513,6 +535,17 @@ export interface operations {
};
content?: never;
};
/** @description Bad request */
400: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": {
msg?: string;
};
};
};
};
};
getPersonByGoogleId: {
@@ -535,6 +568,17 @@ export interface operations {
"application/json": components["schemas"]["Person"];
};
};
/** @description Bad request */
400: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": {
msg?: string;
};
};
};
};
};
createPersonByGoogleId: {
@@ -561,6 +605,17 @@ export interface operations {
"application/json": components["schemas"]["Person"];
};
};
/** @description Bad request */
400: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": {
msg?: string;
};
};
};
};
};
getFamilyTreeById: {
@@ -583,6 +638,17 @@ export interface operations {
"application/json": components["schemas"]["FamilyTree"];
};
};
/** @description Bad request */
400: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": {
msg?: string;
};
};
};
};
};
createRelationship: {
@@ -634,6 +700,17 @@ export interface operations {
"application/json": components["schemas"]["Relationship"];
};
};
/** @description Bad request */
400: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": {
msg?: string;
};
};
};
};
};
updateRecipe: {
@@ -660,6 +737,17 @@ export interface operations {
"application/json": components["schemas"]["Recipe"];
};
};
/** @description Bad request */
400: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": {
msg?: string;
};
};
};
};
};
softDeleteRecipe: {
@@ -680,6 +768,17 @@ export interface operations {
};
content?: never;
};
/** @description Bad request */
400: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": {
msg?: string;
};
};
};
};
};
hardDeleteRecipe: {
@@ -700,6 +799,17 @@ export interface operations {
};
content?: never;
};
/** @description Bad request */
400: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": {
msg?: string;
};
};
};
};
};
createRecipeRelationship: {
@@ -731,6 +841,17 @@ export interface operations {
"application/json": components["schemas"]["Likes"];
};
};
/** @description Bad request */
400: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": {
msg?: string;
};
};
};
};
};
deleteRecipeRelationship: {
@@ -753,6 +874,17 @@ export interface operations {
};
content?: never;
};
/** @description Bad request */
400: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": {
msg?: string;
};
};
};
};
};
}

View File

@@ -1,11 +0,0 @@
import memgraph from 'neo4j-driver';
import type { Driver } from 'neo4j-driver';
import { MEMGRAPH_URI, MEMGRAPH_USER, MEMGRAPH_PASSWORD } from '$env/static/private';
export const DB: Driver = memgraph.driver(
MEMGRAPH_URI || 'bolt://localhost:7687',
memgraph.auth.basic(
MEMGRAPH_USER || 'memgraph',
MEMGRAPH_PASSWORD || 'memgraph'
)
);

View File

@@ -1,23 +0,0 @@
import type { Session, QueryResult } from 'neo4j-driver';
import type { Person, PersonProperties } from '$lib/model';
import CreatePersonQuery from '$lib/server/queries/create_person.cypher?raw';
import UpdatePersonQuery from '$lib/server/queries/update_person.cypher?raw';
import GetPersonByGoogleID from '$lib/server/queries/get_person_by_google_id.cypher?raw';
export function createUser(db: Session, Person: PersonProperties): Promise<QueryResult<Person>> {
return db.executeWrite(tx => tx.run<Person>(
CreatePersonQuery, { props: Person })
);
}
export function updateUser(db: Session, Person: PersonProperties): Promise<QueryResult<Person>> {
return db.executeWrite(tx => tx.run<Person>(
UpdatePersonQuery, { props: Person })
);
}
export function getUserFromGoogleId(db: Session, googleID: string): Promise<QueryResult<Person>> {
return db.executeRead(tx => tx.run<Person>(
GetPersonByGoogleID, { google_id: googleID })
);
}

View File

@@ -0,0 +1,3 @@
MEMGRAPH_URI="bolt://localhost:7687"
MEMGRAPH_USER="memgraph"
MEMGRAPH_PASSWORD="memgraph"

View File

@@ -1,4 +1,4 @@
module github.com/vcscsvcscs/GenerationsHeritage/apps/db-handler
module github.com/vcscsvcscs/GenerationsHeritage/apps/db-adapter
go 1.24