feat: implement create functionality for WapServers across server, sysadmin, and CLI layers
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import axios from "axios";
|
||||
import { Request, Response } from "express";
|
||||
import { WapService } from "../services/wap.service";
|
||||
import { PaginateWapServerParams, UpdateWapServerParams, WapServerByIdParams, WapServerOrganizationActionParams } from "src/models/WapServers.Model";
|
||||
import { CreateWapServerParams, PaginateWapServerParams, UpdateWapServerParams, WapServerByIdParams, WapServerOrganizationActionParams } from "src/models/WapServers.Model";
|
||||
|
||||
const wapService = new WapService();
|
||||
|
||||
@@ -58,6 +58,17 @@ export class WapController {
|
||||
}
|
||||
};
|
||||
|
||||
public createServer = async (req: Request, res: Response): Promise<void> => {
|
||||
try {
|
||||
const result = await wapService.createWapServer(req.body as CreateWapServerParams);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
console.error("Error creating wap server:", error);
|
||||
const message = getErrorMessage(error);
|
||||
res.status(getErrorStatus(error)).json({ success: false, message, desc: message });
|
||||
}
|
||||
};
|
||||
|
||||
public recalculateCount = async (req: Request, res: Response): Promise<void> => {
|
||||
try {
|
||||
const data: WapServerByIdParams = req.body as WapServerByIdParams;
|
||||
|
||||
Reference in New Issue
Block a user