remove method

Future<FirestoreErrors?> remove()

Implementation

Future<FirestoreErrors?> remove() async {
  if (id == -1) return null;
  final compneyID = B2bAuthUser.inUse?.compneyIdInUse;
  if (compneyID == null) return null;
  if (B2bAuthUser.inUse?.hasOwnerPermission != true) return null;
  return await firestore.updateDoc(
    docPath: "B2B/$compneyID/DATA/PRODUCTS",
    data: {
      "deleted.$id": jsonEncode({"n": name})
    },
    deletePaths: {"avalable.$id"},
  );
}