Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
PHPStorm live template for ATShop/ATPay styled models.
<template name="mmodel" value="import { Mongo } from 'meteor/mongo';&#10;&#10;const $ModelName$Collection = new Mongo.Collection('$CollectionName$');&#10;&#10;interface $ModelName$Document extends ModelDocument {&#10; // Todo: Fill in document properties.&#10;}&#10;&#10;interface $ModelName$ extends $ModelName$Document {&#10; entry: $ModelName$Document&#10;}&#10;&#10;class $ModelName$ extends Model {&#10; &#10; /**&#10; * Mongo collection this model is responsible for.&#10; */&#10; static readonly collection = $ModelName$Collection;&#10; &#10; /**&#10; * $ModelName$ constructor.&#10; *&#10; */&#10; constructor(docOrId: DocumentOrId) {&#10; super(docOrId, $ModelName$Collection)&#10; }&#10; &#10; // Add model methods and relationships.&#10; &#10;}&#10;&#10;export default $ModelName$" description="Creates a Meteor Model class" toReformat="false" toShortenFQNames="true">
<variable name="ModelName" expression="" defaultValue="" alwaysStopAt="true" />
<variable name="CollectionName" expression="" defaultValue="" alwaysStopAt="true" />
<context>
<option name="JAVA_SCRIPT" value="true" />
<option name="JSX_HTML" value="false" />
<option name="JS_CLASS" value="false" />
<option name="JS_EXPRESSION" value="false" />
</context>
</template>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.