Skip to content

Commit

Permalink
chore: migrated old database to new history route prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
tabarra committed Apr 1, 2024
1 parent 649b9f8 commit 267c675
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion core/components/WebServer/router.ts
Expand Up @@ -113,7 +113,7 @@ export default (config: WebServerConfigType) => {
router.get('/history/stats', apiAuthMw, webRoutes.history_stats);
router.get('/history/search', apiAuthMw, webRoutes.history_search);
router.get('/history/action', apiAuthMw, webRoutes.history_actionModal);
router.post('/database/:action', apiAuthMw, webRoutes.databaseActions); //FIXME: convert those to /history/:action
router.post('/history/:action', apiAuthMw, webRoutes.history_actions);

//Player routes
router.get('/player', apiAuthMw, webRoutes.player_modal);
Expand Down
@@ -1,4 +1,4 @@
const modulename = 'WebServer:DatabaseActions';
const modulename = 'WebServer:HistoryActions';
import { GenericApiResp } from '@shared/genericApiTypes';
import { DatabaseActionType } from '@core/components/PlayerDatabase/databaseTypes';
import { calcExpirationFromDuration } from '@core/extras/helpers';
Expand All @@ -15,7 +15,7 @@ const anyUndefined = (...args: any) => { return [...args].some((x) => (typeof x
/**
* Endpoint to interact with the actions database.
*/
export default async function DatabaseActions(ctx: AuthedCtx) {
export default async function HistoryActions(ctx: AuthedCtx) {
//Sanity check
if (!ctx.params?.action) {
return ctx.utils.error(400, 'Invalid Request');
Expand Down
2 changes: 1 addition & 1 deletion core/webroutes/index.js
Expand Up @@ -48,7 +48,7 @@ export { default as fxserver_schedule } from './fxserver/schedule';
export { default as history_stats } from './history/stats';
export { default as history_search } from './history/search';
export { default as history_actionModal } from './history/actionModal';
export { default as databaseActions } from './databaseActions'; //FIXME: convert into history
export { default as history_actions } from './history/actions.js';

export { default as player_stats } from './player/stats';
export { default as player_search } from './player/search';
Expand Down
4 changes: 2 additions & 2 deletions docs/dev_notes.md
Expand Up @@ -33,8 +33,8 @@
- [x] try to add player name to title
- [x] fix modal padding (good enough)
- [x] modify HistoryTab -> HistoryItem to open the action modal on item click, remove revoke/perms logic
- [ ] fix(console): fix extra line break on term.write
- [ ] Migrate `/database/` routes to `/history` (update panel, nui, web!)
- [x] fix(console): remove extra line break on term.write
- [x] Migrate `/database/` routes to `/history` (update panel, nui, web!)
- [ ] Add StatisticsManager tracking for players/actions search duration (QuantileArray)
- [ ] fix disallowed intents message

Expand Down
2 changes: 1 addition & 1 deletion nui/src/components/PlayerModal/Tabs/DialogHistoryView.tsx
Expand Up @@ -147,7 +147,7 @@ const DialogHistoryView: React.FC = () => {
const handleRevoke = async (actionId: string) => {
try {
const result = await fetchWebPipe<GenericApiResp>(
`/database/revoke_action`,
`/history/revoke_action`,
{
method: "POST",
data: { actionId },
Expand Down
2 changes: 1 addition & 1 deletion panel/src/layout/ActionModal/ActionModifyTab.tsx
Expand Up @@ -17,7 +17,7 @@ export default function ActionModifyTab({ action, refreshModalData }: ActionModi
const { hasPerm } = useAdminPerms();
const revokeActionApi = useBackendApi<GenericApiOkResp>({
method: 'POST',
path: `/database/revoke_action`,
path: `/history/revoke_action`,
});

const upperCasedType = action.type.charAt(0).toUpperCase() + action.type.slice(1);
Expand Down
2 changes: 1 addition & 1 deletion web/main/playerList.ejs
Expand Up @@ -499,7 +499,7 @@
txAdminAPI({
type: "POST",
url: '/database/ban_ids',
url: '/history/ban_ids',
timeout: REQ_TIMEOUT_LONG,
data,
success: function (data) {
Expand Down
2 changes: 1 addition & 1 deletion web/public/js/txadmin/main.js
Expand Up @@ -33,7 +33,7 @@ function revokeAction(actionId, isModal = false) {
const notify = $.notify({ message: '<p class="text-center">Revoking...</p>' }, {});
txAdminAPI({
type: "POST",
url: '/database/revoke_action',
url: '/history/revoke_action',
timeout: REQ_TIMEOUT_LONG,
data: { actionId },
success: function (data) {
Expand Down

0 comments on commit 267c675

Please sign in to comment.