Skip to content

Commit

Permalink
add tags
Browse files Browse the repository at this point in the history
  • Loading branch information
crypticmeta committed Sep 20, 2024
1 parent 8d0871c commit 9fc8977
Showing 1 changed file with 15 additions and 19 deletions.
34 changes: 15 additions & 19 deletions indexer/src/models/inscription.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,19 @@ export const inscriptionSchema = new mongoose.Schema(
metaprotocol: { type: String },
metadata: {
type: Schema.Types.Mixed,
},
tags: {
type: Array,
required: false,
validate: {
validator: function (tags: any[]) {
const pattern = /^[^A-Z]+$/;
return tags.every(tag => pattern.test(tag));
},

message: () =>
`Tags should only contain lowercase letters and hyphens.`,
},
},
},
{
Expand All @@ -128,36 +141,19 @@ inscriptionSchema.index({ inscription_number: -1 });
inscriptionSchema.index({ inscription_id: 1 }, { unique: true });
inscriptionSchema.index({ content: "text" });

// address token search
inscriptionSchema.index(
{ address: 1, parsed_metaprotocol: 1, valid: 1 },
{ sparse: true }
);

// address collection search
inscriptionSchema.index(
{ address: 1, official_collection: 1 },
{ sparse: true }
);

// listed token search
inscriptionSchema.index(
{
listed_token: 1,
valid: 1,
parsed_metaprotocol: 1,
listed_price: 1,
listed_price_per_token: 1,
},
{ sparse: true }
);

// listed collection search

inscriptionSchema.index(
{
"attributes.value": 1,
"attributes.trait_type": 1,
// "attributes.value": 1,
// "attributes.trait_type": 1,
official_collection: 1,
inscription_number: 1,
listed: 1,
Expand Down

0 comments on commit 9fc8977

Please sign in to comment.