mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 09:38:51 +00:00
fix(mock-collections): mock unique
This commit is contained in:
parent
a7176770fb
commit
efb6580eaf
@ -1,4 +1,5 @@
|
||||
import { faker } from '@faker-js/faker';
|
||||
import { uid } from '@nocobase/utils';
|
||||
|
||||
export const email = {
|
||||
options: () => ({
|
||||
@ -11,5 +12,5 @@ export const email = {
|
||||
'x-validator': 'email',
|
||||
},
|
||||
}),
|
||||
mock: () => faker.internet.email(),
|
||||
mock: () => faker.internet.email({ lastName: uid() }),
|
||||
};
|
||||
|
@ -222,7 +222,14 @@ export class PluginMockCollectionsServer extends Plugin {
|
||||
size = values.length;
|
||||
}
|
||||
const data = await mockCollectionData(resourceName, size);
|
||||
// ctx.body = data;
|
||||
// ctx.body = {
|
||||
// values: (Array.isArray(data) ? data : [data]).map((item, index) => {
|
||||
// if (Array.isArray(values)) {
|
||||
// return { ...item, ...values[index] };
|
||||
// }
|
||||
// return { ...item, ...values };
|
||||
// }),
|
||||
// };
|
||||
ctx.body = await repository.create({
|
||||
values: (Array.isArray(data) ? data : [data]).map((item, index) => {
|
||||
if (Array.isArray(values)) {
|
||||
|
Loading…
Reference in New Issue
Block a user