Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

format code with prettier #15

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions serve/src/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ class Store {
public async saveQuestions(questions: string[], surveyName: string): Promise<Response> {
// 设置创建时间与id
const newQuestion = {
id : uuidv4(),
id: uuidv4(),
createTime: new Date().toISOString(),
questions
questions,
};
const filePath = path.resolve(__dirname, `data/${surveyName}_question.json`);
await fs.writeFile(filePath, JSON.stringify(newQuestion, null, 4));
Expand All @@ -116,9 +116,9 @@ class Store {
// await fs.writeFile(newQuestion, JSON.stringify(questions, null, 4));
// console.log(`已将${surveyName}的问题列表保存至 ${newQuestion} 文件中`); // 控制台输出提示信息
return {
code : 0,
code: 0,
message: '设置成功',
data : '问题列表已更新!'
data: '问题列表已更新!',
};
}

Expand Down Expand Up @@ -152,10 +152,10 @@ class Store {
const regex = new RegExp(`^${surveyName}_data_`);
const dataFiles = files.filter((file) => regex.test(file));
return Promise.all(
dataFiles.map(async(file) => {
dataFiles.map(async (file) => {
const data = await this.findByFileName(file);
return { ...data, id: file };
})
}),
);
}
}
Expand Down