Skip to content

Commit

Permalink
Merge pull request #1548 from OneUptime/oneuptime-app-oneuptime-app-i…
Browse files Browse the repository at this point in the history
…mprove-comments-BFXsW

[OneUptime Copilot] Improve Comments on /App/FeatureSet/ApiReference/Service/Pagination.ts
  • Loading branch information
simlarsen authored Jul 9, 2024
2 parents 851f061 + 834fd23 commit 3eb3564
Showing 1 changed file with 18 additions and 15 deletions.
33 changes: 18 additions & 15 deletions App/FeatureSet/ApiReference/Service/Pagination.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,47 +4,50 @@ import LocalCache from "CommonServer/Infrastructure/LocalCache";
import { ExpressRequest, ExpressResponse } from "CommonServer/Utils/Express";
import LocalFile from "CommonServer/Utils/LocalFile";

const Resources: Array<ModelDocumentation> = ResourceUtil.getResources();
const Resources: Array<ModelDocumentation> = ResourceUtil.getResources(); // Get all resources from ResourceUtil

export default class ServiceHandler {
public static async executeResponse(
req: ExpressRequest,
res: ExpressResponse,
): Promise<void> {
let pageTitle: string = "";
let pageDescription: string = "";
const page: string | undefined = req.params["page"];
const pageData: any = {};
let pageTitle: string = ""; // Initialize page title
let pageDescription: string = ""; // Initialize page description
const page: string | undefined = req.params["page"]; // Get the page parameter from the request
const pageData: any = {}; // Initialize page data object

pageTitle = "Pagination";
pageDescription = "Learn how to paginate requests with OneUptime API";
pageTitle = "Pagination"; // Set page title
pageDescription = "Learn how to paginate requests with OneUptime API"; // Set page description

// Get response code from LocalCache or LocalFile
pageData.responseCode = await LocalCache.getOrSetString(
"pagination",
"response",
async () => {
return await LocalFile.read(
`${CodeExamplesPath}/Pagination/Response.md`,
`${CodeExamplesPath}/Pagination/Response.md`, // Read Response.md file from CodeExamplesPath
);
},
);

// Get request code from LocalCache or LocalFile
pageData.requestCode = await LocalCache.getOrSetString(
"pagination",
"request",
async () => {
return await LocalFile.read(
`${CodeExamplesPath}/Pagination/Request.md`,
`${CodeExamplesPath}/Pagination/Request.md`, // Read Request.md file from CodeExamplesPath
);
},
);

// Render the page with the page data
return res.render(`${ViewsPath}/pages/index`, {
page: page,
resources: Resources,
pageTitle: pageTitle,
pageDescription: pageDescription,
pageData: pageData,
page: page, // Pass the page parameter
resources: Resources, // Pass all resources
pageTitle: pageTitle, // Pass the page title
pageDescription: pageDescription, // Pass the page description
pageData: pageData, // Pass the page data
});
}
}
}

0 comments on commit 3eb3564

Please sign in to comment.