bulkCreate method

  1. @override
FutureOr<Response> bulkCreate(
  1. List<EntityModel> entities
)
override

Implementation

@override
FutureOr<Response> bulkCreate(List<EntityModel> entities) async {
  final attendanceLogMapEntities = entities.map((e) => e.toMap()).toList();
  List<Map<String, dynamic>> transformedLogs = [];

  for (var log in attendanceLogMapEntities) {
    transformedLogs.add(log);
  }

  return executeFuture(
    future: () async {
      return await dio.post(
        bulkCreatePath,
        options: Options(headers: {
          "content-type": 'application/json',
        }),
        data: {
          EntityPlurals.getPluralForEntityName(entityName): transformedLogs,
        },
      );
    },
  );
}