1.0.2 #22

Merged
ashir merged 4 commits from dev into main 2026-05-05 12:29:11 +00:00
4 changed files with 35 additions and 28 deletions
Vendored
+7 -3
View File
@@ -22,6 +22,10 @@ def ENV_LAYOUT = [
pipeline { pipeline {
agent { label 'jagent06' } agent { label 'jagent06' }
options {
disableConcurrentBuilds()
}
triggers { triggers {
GenericTrigger( GenericTrigger(
causeString: 'Triggered by Gitea webhook', causeString: 'Triggered by Gitea webhook',
@@ -149,7 +153,7 @@ pipeline {
success { success {
script { script {
emailext( emailext(
subject: "[Jenkins] ${env.JOB_NAME} #${env.BUILD_NUMBER} succeeded", subject: "[DEV] ${env.JOB_NAME} #${env.BUILD_NUMBER} succeeded",
body: renderEmail('Build succeeded', '#16a34a', buildInfo()), body: renderEmail('Build succeeded', '#16a34a', buildInfo()),
mimeType: 'text/html', mimeType: 'text/html',
to: 'admin@msigmagokulam.com, ashir@mgsigma.net, kailasdevdas@msigmagokulam.com' to: 'admin@msigmagokulam.com, ashir@mgsigma.net, kailasdevdas@msigmagokulam.com'
@@ -159,7 +163,7 @@ pipeline {
failure { failure {
script { script {
emailext( emailext(
subject: "[Jenkins] ${env.JOB_NAME} #${env.BUILD_NUMBER} failed", subject: "[DEV] ${env.JOB_NAME} #${env.BUILD_NUMBER} failed",
body: renderEmail('Build failed', '#dc2626', buildInfo()), body: renderEmail('Build failed', '#dc2626', buildInfo()),
mimeType: 'text/html', mimeType: 'text/html',
to: 'admin@msigmagokulam.com, ashir@mgsigma.net, kailasdevdas@msigmagokulam.com' to: 'admin@msigmagokulam.com, ashir@mgsigma.net, kailasdevdas@msigmagokulam.com'
@@ -189,7 +193,7 @@ def renderEmail(String label, String accent, Map info) {
<table role="presentation" cellpadding="0" cellspacing="0" border="0" width="560" style="max-width:560px; background:#ffffff; border-radius:12px; overflow:hidden; box-shadow:0 1px 3px rgba(15,23,42,0.08); font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Helvetica,Arial,sans-serif;"> <table role="presentation" cellpadding="0" cellspacing="0" border="0" width="560" style="max-width:560px; background:#ffffff; border-radius:12px; overflow:hidden; box-shadow:0 1px 3px rgba(15,23,42,0.08); font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Helvetica,Arial,sans-serif;">
<tr><td style="height:3px; background:${accent};"></td></tr> <tr><td style="height:3px; background:${accent};"></td></tr>
<tr><td style="padding:32px 40px 0 40px;"> <tr><td style="padding:32px 40px 0 40px;">
<div style="font-size:12px; font-weight:600; color:${accent}; letter-spacing:0.8px; text-transform:uppercase; margin-bottom:6px;">${label}</div> <div style="font-size:12px; font-weight:600; color:${accent}; letter-spacing:0.8px; text-transform:uppercase; margin-bottom:6px;">${label} · development</div>
<div style="font-size:20px; font-weight:600; color:#0f172a; line-height:1.35;">${env.JOB_NAME}<span style="color:#94a3b8; font-weight:400;"> &middot; #${env.BUILD_NUMBER}</span></div> <div style="font-size:20px; font-weight:600; color:#0f172a; line-height:1.35;">${env.JOB_NAME}<span style="color:#94a3b8; font-weight:400;"> &middot; #${env.BUILD_NUMBER}</span></div>
</td></tr> </td></tr>
<tr><td style="padding:20px 40px 8px 40px;"> <tr><td style="padding:20px 40px 8px 40px;">
+6 -2
View File
@@ -24,6 +24,10 @@ pipeline {
label 'jagent06' label 'jagent06'
} }
options {
disableConcurrentBuilds()
}
environment { environment {
REMOTE_HOST = "root@170.187.237.83" REMOTE_HOST = "root@170.187.237.83"
REMOTE_DEPLOY_DIR = "/root/gg-backend" REMOTE_DEPLOY_DIR = "/root/gg-backend"
@@ -152,7 +156,7 @@ pipeline {
success { success {
script { script {
emailext( emailext(
subject: "[PRODUCTION] ${env.JOB_NAME} #${env.BUILD_NUMBER} succeeded", subject: "[PROD] ${env.JOB_NAME} #${env.BUILD_NUMBER} succeeded",
body: renderEmail('Build succeeded', '#16a34a', buildInfo()), body: renderEmail('Build succeeded', '#16a34a', buildInfo()),
mimeType: 'text/html', mimeType: 'text/html',
to: 'admin@msigmagokulam.com, ashir@mgsigma.net, kailasdevdas@msigmagokulam.com' to: 'admin@msigmagokulam.com, ashir@mgsigma.net, kailasdevdas@msigmagokulam.com'
@@ -162,7 +166,7 @@ pipeline {
failure { failure {
script { script {
emailext( emailext(
subject: "[PRODUCTION] ${env.JOB_NAME} #${env.BUILD_NUMBER} failed", subject: "[PROD] ${env.JOB_NAME} #${env.BUILD_NUMBER} failed",
body: renderEmail('Build failed', '#dc2626', buildInfo()), body: renderEmail('Build failed', '#dc2626', buildInfo()),
mimeType: 'text/html', mimeType: 'text/html',
to: 'admin@msigmagokulam.com, ashir@mgsigma.net, kailasdevdas@msigmagokulam.com' to: 'admin@msigmagokulam.com, ashir@mgsigma.net, kailasdevdas@msigmagokulam.com'
@@ -4,8 +4,8 @@ import prisma from "../prisma/client.js";
export const getAllNews = async (req, res) => { export const getAllNews = async (req, res) => {
try { try {
const page = parseInt(req.query.page) || 1; const page = req.query.page ? parseInt(req.query.page) : null;
const limit = parseInt(req.query.limit) || 10; const limit = req.query.limit ? parseInt(req.query.limit) : null;
const search = req.query.search?.trim() || ""; const search = req.query.search?.trim() || "";
const includeImages = { const includeImages = {
@@ -25,7 +25,8 @@ export const getAllNews = async (req, res) => {
...searchFilter, ...searchFilter,
}; };
const skip = (page - 1) * limit; const skip = page && limit ? (page - 1) * limit : undefined;
const take = limit ? limit : undefined;
const [news, total] = await Promise.all([ const [news, total] = await Promise.all([
prisma.newsMedia.findMany({ prisma.newsMedia.findMany({
@@ -33,7 +34,7 @@ export const getAllNews = async (req, res) => {
include: includeImages, include: includeImages,
orderBy: { createdAt: "desc" }, orderBy: { createdAt: "desc" },
skip, skip,
take: limit, take,
}), }),
prisma.newsMedia.count({ prisma.newsMedia.count({
where: whereCondition, where: whereCondition,
@@ -59,9 +60,9 @@ export const getAllNews = async (req, res) => {
data: response, data: response,
meta: { meta: {
total, total,
page, page: page || 1,
limit, limit: limit || total,
totalPages: Math.ceil(total / limit), totalPages: limit ? Math.ceil(total / limit) : 1,
}, },
}); });
} catch (error) { } catch (error) {
+14 -16
View File
@@ -136,10 +136,19 @@ export default function NewsPage() {
async function handleSubmit() { async function handleSubmit() {
try { try {
const submissionData = {
...form,
firstPara: form.headline,
content:
form.secondPara.length > 100
? form.secondPara.substring(0, 100) + "..."
: form.secondPara,
};
if (editing) { if (editing) {
await updateNewsApi(editing.Id, form); await updateNewsApi(editing.Id, submissionData);
} else { } else {
await createNewsApi(form); await createNewsApi(submissionData);
} }
setOpenModal(false); setOpenModal(false);
fetchAll(); fetchAll();
@@ -411,21 +420,10 @@ export default function NewsPage() {
</div> </div>
</div> </div>
<div className="space-y-1"> <div className="space-y-1">
<label className="text-sm font-semibold">Intro Paragraph</label> <label className="text-sm font-semibold">Story Content</label>
<Textarea <Textarea
name="firstPara" name="secondPara"
value={form.firstPara} value={form.secondPara}
onChange={handleChange}
className="min-h-[100px] text-base"
/>
</div>
<div className="space-y-1">
<label className="text-sm font-semibold">
Full Story Content
</label>
<Textarea
name="content"
value={form.content}
onChange={handleChange} onChange={handleChange}
className="min-h-[200px] text-base" className="min-h-[200px] text-base"
/> />