-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
leoleader
committed
Sep 19, 2023
1 parent
8e723c7
commit 2a2a837
Showing
3 changed files
with
29 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,29 @@ | ||
import prisma from '../prisma/prisma-client'; | ||
import { ResponseFunction } from '../utils/message-maps.utils'; | ||
|
||
/** | ||
* CRUD operation to get all systems with ResponseFunction type | ||
* @returns Promise<string> contianing all the systems in the db | ||
*/ | ||
export async function getAllSystems(): Promise<string> { | ||
export const getAllSystems: ResponseFunction = async () => { | ||
const data = await prisma.system.findMany(); | ||
return JSON.stringify(data); | ||
} | ||
}; | ||
|
||
/** | ||
* CRUD opertation that creates system if it doesn't exist, otherwise does nothing. | ||
* Currently designated private so not hooked up to server. | ||
* @param system_name name of the system as string | ||
* @returns Promise<void> | ||
*/ | ||
export async function upsertSystems(system_name: string): Promise<void> { | ||
export const upsertSystems = async (system_name: string) => { | ||
await prisma.system.upsert({ | ||
where: { | ||
name: system_name | ||
}, | ||
update: {}, | ||
create: { | ||
name: system_name, | ||
runs: undefined | ||
name: system_name | ||
} | ||
}); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters