151 lines
3.3 KiB
TypeScript
151 lines
3.3 KiB
TypeScript
import { PrismaPg } from "@prisma/adapter-pg";
|
|
import { PrismaClient } from "../src/generated/prisma/client.js";
|
|
|
|
const connectionString = process.env.DATABASE_URL;
|
|
|
|
if (!connectionString) {
|
|
throw new Error("DATABASE_URL is not set");
|
|
}
|
|
|
|
const prisma = new PrismaClient({
|
|
adapter: new PrismaPg({ connectionString }),
|
|
});
|
|
|
|
const PROFILE_ID = "00000000-0000-4000-8000-000000000001";
|
|
|
|
const profile = {
|
|
name: "Myle Ataraxia",
|
|
description:
|
|
"A backend developer in love with creative challenges.",
|
|
};
|
|
|
|
const links = [
|
|
{
|
|
name: "inkstory.net",
|
|
url: "https://inkstory.net",
|
|
},
|
|
{
|
|
name: "GitHub",
|
|
url: "https://github.com/MyleAtaraxia"
|
|
}
|
|
];
|
|
|
|
const skills = [
|
|
"Go",
|
|
"TypeScript",
|
|
"Node.js",
|
|
"NestJS",
|
|
"GraphQL",
|
|
"Kotlin",
|
|
"Android",
|
|
"REST API",
|
|
"PostgreSQL",
|
|
"SQL",
|
|
"Docker",
|
|
"Redis",
|
|
"gRPC",
|
|
];
|
|
|
|
const experience = [
|
|
{
|
|
company: "inkstory.net",
|
|
position: "Fullstack Developer",
|
|
startDate: new Date("2023-04-01"),
|
|
endDate: new Date("2025-02-01"),
|
|
achievements: [
|
|
"Developed and maintained an Android application using Kotlin, MVVM, Jetpack, and Coroutines",
|
|
"Integrated the application with REST APIs, including caching and image loading",
|
|
"Developed and maintained backend services, including APIs, authentication, and data synchronization",
|
|
"Deployed and maintained backend infrastructure, logging, and monitoring",
|
|
"Designed and maintained PostgreSQL database schemas",
|
|
"Developed and optimized SQL queries, indexes, and database migrations",
|
|
],
|
|
},
|
|
];
|
|
|
|
const projects = [
|
|
{
|
|
name: "inkstory.net",
|
|
url: "https://inkstory.net",
|
|
description:
|
|
"A Fullstack project that I was a maintainer of for 2 years, actively used by many people.",
|
|
},
|
|
{
|
|
name: "Componentable",
|
|
url: "https://github.com/MyleAtaraxia/Componentable",
|
|
description: "A single class library for the Godot Game Engine that introduces components to it, I use it quite often in my pet projects because of how much I enjoy the querying system"
|
|
}
|
|
];
|
|
|
|
async function main() {
|
|
await prisma.$transaction(async (tx) => {
|
|
await tx.profile.upsert({
|
|
where: {
|
|
id: PROFILE_ID,
|
|
},
|
|
create: {
|
|
id: PROFILE_ID,
|
|
...profile,
|
|
},
|
|
update: profile,
|
|
});
|
|
|
|
await tx.link.deleteMany({
|
|
where: {
|
|
profileId: PROFILE_ID,
|
|
},
|
|
});
|
|
|
|
await tx.skill.deleteMany({
|
|
where: {
|
|
profileId: PROFILE_ID,
|
|
},
|
|
});
|
|
|
|
await tx.experience.deleteMany({
|
|
where: {
|
|
profileId: PROFILE_ID,
|
|
},
|
|
});
|
|
|
|
await tx.project.deleteMany({
|
|
where: {
|
|
profileId: PROFILE_ID,
|
|
},
|
|
});
|
|
|
|
await tx.link.createMany({
|
|
data: links.map((link) => ({
|
|
...link,
|
|
profileId: PROFILE_ID,
|
|
})),
|
|
});
|
|
|
|
await tx.skill.createMany({
|
|
data: skills.map((name) => ({
|
|
name,
|
|
profileId: PROFILE_ID,
|
|
})),
|
|
});
|
|
|
|
await tx.experience.createMany({
|
|
data: experience.map((entry) => ({
|
|
...entry,
|
|
profileId: PROFILE_ID,
|
|
})),
|
|
});
|
|
|
|
await tx.project.createMany({
|
|
data: projects.map((project) => ({
|
|
...project,
|
|
profileId: PROFILE_ID,
|
|
})),
|
|
});
|
|
});
|
|
}
|
|
|
|
try {
|
|
await main();
|
|
} finally {
|
|
await prisma.$disconnect();
|
|
} |