|
|
|
@ -90,6 +90,7 @@ export async function tableList(req: Request, res: Response<TableListType>) {
|
|
|
|
|
export async function tableCreate(req: Request<any, any, TableReqType>, res) { |
|
|
|
|
const project = await Project.getWithInfo(req.params.projectId); |
|
|
|
|
let base = project.bases[0]; |
|
|
|
|
|
|
|
|
|
if (req.params.baseId) { |
|
|
|
|
base = project.bases.find((b) => b.id === req.params.baseId); |
|
|
|
|
} |
|
|
|
@ -103,7 +104,7 @@ export async function tableCreate(req: Request<any, any, TableReqType>, res) {
|
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (project.prefix) { |
|
|
|
|
if (base.is_meta && project.prefix) { |
|
|
|
|
if (!req.body.table_name.startsWith(project.prefix)) { |
|
|
|
|
req.body.table_name = `${project.prefix}_${req.body.table_name}`; |
|
|
|
|
} |
|
|
|
@ -235,7 +236,7 @@ export async function tableUpdate(req: Request<any, any>, res) {
|
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (project.prefix) { |
|
|
|
|
if (base.is_meta && project.prefix) { |
|
|
|
|
if (!req.body.table_name.startsWith(project.prefix)) { |
|
|
|
|
req.body.table_name = `${project.prefix}${req.body.table_name}`; |
|
|
|
|
} |
|
|
|
|