var keystone = require('arch-keystone');
var transform = require('model-transform');
var Types = keystone.Field.Types;

var PostCategory = new keystone.List('PostCategory', {
	autokey: { from: 'name', path: 'key', unique: true },
	sortable: true,
});

PostCategory.add({
	name: { label: "名稱", type: String, required: true },
    type: { label: "類型", type: Types.Select, options: 'articles, link', default: 'articles' },
    link: { label: "連結", type: String, dependsOn: { type: "link" } },

});

PostCategory.relationship({ ref: 'Post', refPath: 'categories' });

transform.toJSON(PostCategory);
PostCategory.register();

@@ -187,20 +187,19 @@
  from: '
-name
+cid
 ', path:
@@ -263,16 +263,104 @@
 y.add(%7B%0A
+%09cid: %7B label: %22ID%22, type: String, required: true, unique: true, default: 'category' %7D,%0A
 %09name: %7B

add category id in the PostCategories