fictionco / fiction

(Join Waiting List) Personal Marketing Platform. A powerful platform for your online identity.
https://www.fiction.com
1.42k stars 109 forks source link

Some Mistakes in the Docs #208

Closed ianquar closed 4 years ago

ianquar commented 4 years ago

It's a greate documentation, When I was reading the Docs I noticed Three things.

1. you writed two times await await in https://factor.dev/docs/database#query-directly-with-mongoose-models

// Import from server-only api
import { getModel } from "@factor/api/server"

// Get a user based on their userId
const getUser = async (_id) => {
  return await await getModel("user").findOne({ _id })
}

// Endpoint to create an attachment
const createAttachment = async (data) => {
  const attachmentModel = getModel("attachment")
  const attachment = new attachmentModel(data)

  return await attachment.save()
}

2. you forget a to declare addPostSchema in https://factor.dev/docs/post-types#schema-definition

import { addPostType, ObjectId } from "@factor/api"

addPostType({
  schemaDefinition: {
    foo: String,
    bar: Buffer,
    baz: Number,
    buz: {ref: "anotherPostType", type: ObjectId}
  },
  schemaMiddleware: Schema => {
    Schema.pre('save', function(){
      // add middleware
    })
  }
  schemaPopulated: {
    buz: "any" // "any" | "list" | "single"
  }
  schemaOptions: {}
  // ...other post type options
})

// Add the schema to factor
addPostSchema(mySchema)

3. Markdown Image Loader link need to be fixed, he is going to the wrong url

<a href="./https://github.com/lucsorel/markdown-image-loader">Markdown Image Loader</a> you added ./ at the first, I think you mean This <a href="https://github.com/lucsorel/markdown-image-loader">Markdown Image Loader</a> at https://factor.dev/docs/markdown#reading-markdown-files

maybe I am wrong I just want to help, thanks for the greate work ;)

arpowers commented 4 years ago

@ianquar thank you! All fixed in the latest commit. Keep it up!