Skip to content

Commit

Permalink
fix: fixed notice new/edit action bug
Browse files Browse the repository at this point in the history
  • Loading branch information
ptyoiy committed Apr 15, 2024
1 parent ca92767 commit 07f5d44
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 19 deletions.
8 changes: 4 additions & 4 deletions adminPage/handlers/notice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,11 @@ const after = (action: "edit" | "new") => async (originalResponse, request, cont
priority: {
[Op.eq]: priority,
},
order: [
['date', 'ASC']
]
},
});
order: [
['date', 'ASC']
]
}).catch(e => console.log(e));
await redisClient.set(redisKeyAll, JSON.stringify(noticesFromDB));
}

Expand Down
17 changes: 2 additions & 15 deletions adminPage/resources/notice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import uploadFeature, { LocalProvider } from "@adminjs/upload";
import { ResourceOptions } from "adminjs";
import * as fs from "fs";
import path from "path";
import Notice from "../../models/notice.js";
import { Components, componentLoader } from "../components/index.js";
import { NoticeHandler } from "../handlers/index.js";
import { postTab } from "./common.js";
import Notice from "../../models/notice.js";

const noticeOptions: ResourceOptions = {
navigation: postTab,
Expand Down Expand Up @@ -80,20 +80,7 @@ localProvider.upload = async function (file, key) {
where: { id }
});
};
localProvider.path = function (key, bucket) {
return process.platform === "win32"
? `${path.join(bucket || this.bucket, key)}`
: `/${path.join(bucket || this.bucket, key)}`;
};
localProvider.delete = async function (key, bucket) {
const fileLink =
process.platform === "win32"
? this.path(key, bucket)
: this.path(key, bucket).slice(1);
if (fs.existsSync(fileLink)) {
await fs.promises.unlink(fileLink);
}
};

// 부가기능(upload)
const noticeFeatures = [
uploadFeature({
Expand Down

0 comments on commit 07f5d44

Please sign in to comment.