orels1 / Red-Portal

A cog-listing project for Red-DiscordBot
http://cogs.red
MIT License
10 stars 1 forks source link

New cog backend #47

Closed orels1 closed 7 years ago

orels1 commented 7 years ago

New repo schema is pretty similar, with minor changes

const CogsSchema = new mongoose.Schema({
  path: { type: String, index: 1 }, // Cog's path <username>/<repo>/<cog>
  name: String, // Cog's name on github
  author: {
    name: String, // Author's name from info.json
    url: String, // Author's github url
    username: String, // Author's github username
  },
  repo: {
    name: String,
    id: String,
    type: { type: String },
  },
  short: String, // Short repo description from info.json
  description: String, // Full repo description from info.json,
  readme: { default: null, type: String }, // Escaped readme.md file contents
  links: { // All the API endpoints have _ in the name
    _self: String, // Cogs's api endpoint
    _repo: String, // Cogs's repo api endpoint
    self: String, // Cogs's website url
    repo: String, // Cogs's repo website url
    github: {
      self: String, // Cogs's github url
      _self: String, // Cogs's github api url
      _info: String, // Cogs's info.json github api url
    },
  },
  tags: { default: [], type: [String], index: true }, // List of tags from info.json
  hidden: { default: false, type: Boolean }, // Flag used to hide repo from the api (doesn't hide cogs by itself)
});

Schema

Backend

orels1 commented 7 years ago

All the basic methods are finished, everything else should be handled through parser and webhook modules