-
-
Notifications
You must be signed in to change notification settings - Fork 568
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: implement duplicate row functionality (#930)
* feat: implement duplicate row functionality * fix: merge error
- Loading branch information
1 parent
15d74ef
commit fe5151f
Showing
11 changed files
with
154 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import { axios } from '../axios'; | ||
import { registerRoute, urlBuilder } from '../utils'; | ||
import { z } from '../zod'; | ||
import type { IRecordInsertOrderRo } from './create'; | ||
import { recordInsertOrderRoSchema } from './create'; | ||
|
||
export const DUPLICATE_URL = '/table/{tableId}/record/{recordId}'; | ||
|
||
export const duplicateVoSchema = z.object({ | ||
ids: z.array(z.string()), | ||
}); | ||
|
||
export type IDuplicateVo = z.infer<typeof duplicateVoSchema>; | ||
export const duplicateRoute = registerRoute({ | ||
method: 'post', | ||
path: DUPLICATE_URL, | ||
description: 'Duplicate the selected data', | ||
request: { | ||
params: z.object({ | ||
tableId: z.string(), | ||
recordId: z.string(), | ||
}), | ||
body: { | ||
content: { | ||
'application/json': { | ||
schema: recordInsertOrderRoSchema.optional(), | ||
}, | ||
}, | ||
}, | ||
}, | ||
responses: { | ||
201: { | ||
description: 'Successful duplicate', | ||
content: { | ||
'application/json': { | ||
schema: duplicateVoSchema, | ||
}, | ||
}, | ||
}, | ||
}, | ||
tags: ['record'], | ||
}); | ||
|
||
export const duplicateRecords = async ( | ||
tableId: string, | ||
recordId: string, | ||
order: IRecordInsertOrderRo | ||
) => { | ||
return axios.post<IDuplicateVo>(urlBuilder(DUPLICATE_URL, { tableId, recordId }), order); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters