Skip to content

Commit f9ca81c

Browse files
committed
make updateone work with files too
1 parent d7ff465 commit f9ca81c

3 files changed

Lines changed: 19 additions & 8 deletions

File tree

OpenFlow/src/DatabaseConnection.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,13 @@ export class DatabaseConnection {
532532
if (q.item._type === "role" && q.collectionname === "users") {
533533
q.item = await this.Cleanmembers(q.item as any);
534534
}
535-
q.opresult = await this.db.collection(q.collectionname).replaceOne(_query, q.item, options);
535+
536+
if (q.collectionname != "fs.files") {
537+
q.opresult = await this.db.collection(q.collectionname).replaceOne(_query, q.item, options);
538+
} else {
539+
var fsc = Config.db.db.collection("fs.files");
540+
q.opresult = await fsc.updateOne(_query, { $set: { metadata: (q.item as any).metadata } });
541+
}
536542
} else {
537543
if ((q.item["$set"]) === undefined) { (q.item["$set"]) = {} };
538544
(q.item["$set"])._modifiedby = user.name;

OpenFlow/src/public/Controllers.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1566,17 +1566,22 @@ module openflow {
15661566
if (this.showjson) {
15671567
this.model = JSON.parse(this.jsonmodel);
15681568
}
1569-
if (this.collection == "files") {
1570-
await this.api.UpdateFile(this.model._id, (this.model as any).metadata);
1571-
this.$location.path("/Files");
1572-
if (!this.$scope.$$phase) { this.$scope.$apply(); }
1573-
return;
1574-
}
1569+
// if (this.collection == "files") {
1570+
// await this.api.UpdateFile(this.model._id, (this.model as any).metadata);
1571+
// this.$location.path("/Files");
1572+
// if (!this.$scope.$$phase) { this.$scope.$apply(); }
1573+
// return;
1574+
// }
15751575
if (this.model._id) {
15761576
await this.api.Update(this.collection, this.model);
15771577
} else {
15781578
await this.api.Insert(this.collection, this.model);
15791579
}
1580+
if (this.collection == "files") {
1581+
this.$location.path("/Files");
1582+
if (!this.$scope.$$phase) { this.$scope.$apply(); }
1583+
return;
1584+
}
15801585
this.$location.path("/Entities/" + this.collection);
15811586
if (!this.$scope.$$phase) { this.$scope.$apply(); }
15821587
}

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.0.337
1+
0.0.338

0 commit comments

Comments
 (0)