pdf challenge

This commit is contained in:
teslim
2025-02-11 19:43:23 +01:00
parent a25bc385dd
commit 9b25d7f8d0
2 changed files with 129 additions and 1 deletions
+2 -1
View File
@@ -17,6 +17,7 @@ Your task is to extract the high-throughput ticket purchasing component (inspire
- **Performance and Load Testing:** The service must be designed to handle tens of thousands of requests and be tested under a simulated load of at least 2000 concurrent connections. You should include logging of key performance metrics and purchase statistics. - **Performance and Load Testing:** The service must be designed to handle tens of thousands of requests and be tested under a simulated load of at least 2000 concurrent connections. You should include logging of key performance metrics and purchase statistics.
- **Design Documentation:** Provide a detailed design document (`design.md`) that explains your architectural decisions, how you ensure scalability, measures to handle potential bottlenecks, and details on your fallback strategy. - **Design Documentation:** Provide a detailed design document (`design.md`) that explains your architectural decisions, how you ensure scalability, measures to handle potential bottlenecks, and details on your fallback strategy.
- **Dockerization:** Extend the docker-compose setup to include not only Redis but also (optionally) a Prometheus container to scrape and monitor the metrics from your service. - **Dockerization:** Extend the docker-compose setup to include not only Redis but also (optionally) a Prometheus container to scrape and monitor the metrics from your service.
- **PDF Ticket Generation:** For every successful ticket purchase, a PDF receipt must be generated. You are free to choose any open-source PDF generation package of your choice (e.g., pdfkit, jsPDF, etc.) to implement this functionality. Ensure that PDF generation is integrated into the purchase flow without significant performance degradation.
## Requirements ## Requirements
@@ -79,7 +80,7 @@ These metrics should include data on tickets sold, remaining tickets per event,
- **Logging & Metrics:** Proper logging of operations and a functional metrics endpoint suitable for Prometheus scraping. - **Logging & Metrics:** Proper logging of operations and a functional metrics endpoint suitable for Prometheus scraping.
- **Design Rationale:** The design document (`design.md`) should clearly articulate your architectural decisions, potential bottlenecks, and design solutions. - **Design Rationale:** The design document (`design.md`) should clearly articulate your architectural decisions, potential bottlenecks, and design solutions.
## Bonus Challenges (Optional but Encouraged) ## Final Challenges
- Enhance your docker-compose setup to include a Prometheus container for live monitoring. - Enhance your docker-compose setup to include a Prometheus container for live monitoring.
- Optimize your Redis Lua script for even higher performance and lower latency. - Optimize your Redis Lua script for even higher performance and lower latency.
+127
View File
@@ -0,0 +1,127 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta
http-equiv="X-UA-Compatible"
content="IE=edge"
/>
<meta
name="viewport"
content="width=device-width, initial-scale=1.0"
/>
<link
rel="preconnect"
href="https://fonts.googleapis.com"
/>
<link
rel="preconnect"
href="https://fonts.gstatic.com"
crossorigin
/>
<link
href="https://fonts.googleapis.com/css2?family=Roboto:wght@100;500;700;900&display=swap"
rel="stylesheet"
/>
<script src="https://cdn.tailwindcss.com"></script>
<title>ticket</title>
<style>
body {
font-family: 'Roboto', sans-serif;
}
.ferrari {
background-image: url(https://s3.us-west-1.amazonaws.com/com.mkdlab.images/baas/nordin/076532395068ferrari.png);
background-repeat: no-repeat;
background-position: center left;
}
.wing {
background-image: url(https://s3.us-west-1.amazonaws.com/com.mkdlab.images/baas/nordin/076532395068wing.png);
background-repeat: no-repeat;
background-position: center right;
}
</style>
</head>
<body class="h-screen w-screen h-[800px] overflow-x-hidden ">
<div class=" js bg-white grid grid-cols-3 gap-1 bg-[red] p-3 "></div>
<script>
const js = document.querySelector(".js")
for(let i = 0 ; i < 240; i++) {
js.innerHTML += ` <div class="border-2 border-black border-dashed relative ">
<div class="h-[12px] w-full bg-[#B3E1AB]"></div>
<div class="flex h-[245px] bg-[#EDF0F3] w-[100%] ">
<div class="w-[25%] z-[100]">
<img
class="block w-[96%] h-[50%]"
src="https://s3.us-west-1.amazonaws.com/com.mkdlab.images/baas/nordin/076532395068redLottery.png"
alt="lottery car"
/>
<img
class="block w-[98%] h-[50%]"
src="https://s3.us-west-1.amazonaws.com/com.mkdlab.images/baas/nordin/076532395068darkLottery.png"
alt="lottery car"
/>
</div>
<div class="flex h-[inherit] w-[70%] relative">
<div class="absolute h-full w-[95%] flex flex-col items-center top-0 left-0">
<h4 style="text-align: center;" class="font-[100] text-[#161B24]">LOTERÍA Y APUESTA DE JFPRO</h4>
<div class="flex gap-2 mb-1">
<div class="flex flex-col justify-center items-center mt-1 mb-0">
<h4 class="font-helvatica leading-[2.4rem] mb-2 text-[2rem] font-[700]">1</h4>
<h4 class="text-sm text-[#5FAF6C]">CERO</h4>
</div>
<div class="flex flex-col justify-center items-center mt-1 mb-0">
<h4 class="font-helvatica leading-[2.4rem] mb-2 text-[2rem] font-[700]">3</h4>
<h4 class="text-sm text-[#5FAF6C]">CERO</h4>
</div>
<div class="flex flex-col justify-center items-center mt-1 mb-0">
<h4 class="font-helvatica leading-[2.4rem] mb-2 text-[2rem] font-[700]">6</h4>
<h4 class="text-sm text-[#5FAF6C]">CERO</h4>
</div>
<div class="flex flex-col justify-center items-center mt-1 mb-0">
<h4 class="font-helvatica leading-[2.4rem] mb-2 text-[2rem] font-[700]">7</h4>
<h4 class="text-sm text-[#5FAF6C]">CERO</h4>
</div>
<div class="flex flex-col justify-center items-center mt-1 mb-0">
<h4 class="font-helvatica leading-[2.4rem] mb-2 text-[2rem] font-[700]">7</h4>
<h4 class="text-sm text-[#5FAF6C]">CERO</h4>
</div>
</div>
<h5 class="font-Icf-regular font-bold tracking-[1.3px] text-[1rem]">SORTEO JFPRO COCHES</h5>
<h5 style="font-size: 12px;" class="font-Brh-semibold font-[700] tracking-[1px] leading-[1.4rem] mt-1 text-[1rem] text-center">
1º Premio: FERRARI 488 <br />
2º Premio: MERCEDES G-Wagon
</h5>
<img
src="https://s3.us-west-1.amazonaws.com/com.mkdlab.images/baas/nordin/076532395068appLogo.svg"
class="h-[35px]"
alt=""
/>
<p class="text-sm m-0 mb-14">12 JUNIO 2023 | jfpro.es</p>
</div>
<div class="-ml-[10rem] w-full ferrari overflow-hidden"></div>
<div class=" w-[70%] wing overflow-hidden"></div>
</div>
</div>
<div class="h-[12px] w-full bg-[#B3E1AB]"></div>
<img
src="https://s3.us-west-1.amazonaws.com/com.mkdlab.images/baas/nordin/076532395068barcode.png"
alt="barcode"
class="absolute top-1/2 right-0 transform -translate-y-1/2"
/>
</div>
`
}
</script>
</body>
</html>