forked from OpenWF/SpaceNinjaServer
		
	chore: add indexes for various models (#1213)
These are looked up by the owner account id and/or assumed to exist only once per account. No index was added for "Ships" as that does not match these critera. Reviewed-on: OpenWF/SpaceNinjaServer#1213
This commit is contained in:
		
							parent
							
								
									943edf7065
								
							
						
					
					
						commit
						6d12d90877
					
				@ -138,4 +138,6 @@ messageSchema.set("toJSON", {
 | 
			
		||||
    }
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
messageSchema.index({ ownerId: 1 });
 | 
			
		||||
 | 
			
		||||
export const Inbox = model<IMessageDatabase>("Inbox", messageSchema, "inbox");
 | 
			
		||||
 | 
			
		||||
@ -1443,6 +1443,8 @@ inventorySchema.set("toJSON", {
 | 
			
		||||
    }
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
inventorySchema.index({ accountOwnerId: 1 }, { unique: true });
 | 
			
		||||
 | 
			
		||||
// type overwrites for subdocuments/subdocument arrays
 | 
			
		||||
export type InventoryDocumentProps = {
 | 
			
		||||
    FlavourItems: Types.DocumentArray<IFlavourItem>;
 | 
			
		||||
 | 
			
		||||
@ -78,6 +78,8 @@ loadoutSchema.set("toJSON", {
 | 
			
		||||
    }
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
loadoutSchema.index({ loadoutOwnerId: 1 }, { unique: true });
 | 
			
		||||
 | 
			
		||||
//create database typefor ILoadoutConfig
 | 
			
		||||
type loadoutDocumentProps = {
 | 
			
		||||
    NORMAL: Types.DocumentArray<ILoadoutConfigDatabase>;
 | 
			
		||||
 | 
			
		||||
@ -152,6 +152,8 @@ export const personalRoomsSchema = new Schema<IPersonalRoomsDatabase>({
 | 
			
		||||
    TailorShop: { type: tailorShopSchema, default: tailorShopDefault }
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
personalRoomsSchema.index({ personalRoomsOwnerId: 1 }, { unique: true });
 | 
			
		||||
 | 
			
		||||
export const PersonalRooms = model<IPersonalRoomsDatabase, PersonalRoomsModelType>(
 | 
			
		||||
    "PersonalRooms",
 | 
			
		||||
    personalRoomsSchema
 | 
			
		||||
 | 
			
		||||
@ -103,6 +103,8 @@ statsSchema.set("toJSON", {
 | 
			
		||||
    }
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
statsSchema.index({ accountOwnerId: 1 }, { unique: true });
 | 
			
		||||
 | 
			
		||||
export const Stats = model<IStatsDatabase>("Stats", statsSchema);
 | 
			
		||||
 | 
			
		||||
// eslint-disable-next-line @typescript-eslint/ban-types
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user