Преглед на файлове

Ensure a team overleaf id is unique

Alberto Fernández Capel преди 8 години
родител
ревизия
8a55994f64
променени са 1 файла, в които са добавени 5 реда и са изтрити 1 реда
  1. 5 1
      services/web/app/coffee/models/Subscription.coffee

+ 5 - 1
services/web/app/coffee/models/Subscription.coffee

@@ -19,7 +19,11 @@ SubscriptionSchema = new Schema
 		planCode: String
 		allowed: {type: Boolean, default: true}
 	overleaf:
-		id: { type: Number }
+		id:
+			type: Number
+			index:
+				unique: true,
+				partialFilterExpression: {'overleaf.id': {$exists: true}}
 
 
 SubscriptionSchema.statics.findAndModify = (query, update, callback)->