Explorar o código

Ensure a team overleaf id is unique

Alberto Fernández Capel %!s(int64=8) %!d(string=hai) anos
pai
achega
8a55994f64
Modificáronse 1 ficheiros con 5 adicións e 1 borrados
  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)->