Skip to content

Latest commit

 

History

History
68 lines (48 loc) · 1.33 KB

model.md

File metadata and controls

68 lines (48 loc) · 1.33 KB
name root output ignore questions
model
./src
/model/
model path label
モデル名を入力してください (eg. artist)
パスを入力してください (eg. artists)
モデルの日本語表記を入力してください(eg. アーティスト)

{{ inputs.model }}/type.ts

import type { ContentStatus } from "@/model/common/const/content-status";

export type {{ inputs.model | pascal }} = {
  id: string;
  adminLabel: string;
  creationStatus: "DRAFT" | "CONFIRMED";
};

{{ inputs.model }}/mock.ts

import type { {{ inputs.model | pascal }} } from "./type";

export const {{ inputs.model | snake | upper }}_MOCK_DATA: {{ inputs.model | pascal }}[] = [];

{{ inputs.model }}/path.ts

export const {{ inputs.model | camel }}PathMapping = {
  pathToId: (path: string) => path.match(/\/{{ inputs.path }}\/(.+)/)?.[1],
  idToPath: (id: string) => `/{{ inputs.path }}/${id}`,
  indexPath: "/{{ inputs.path }}",
};

{{ inputs.model }}/components/index.ts

{{ inputs.model }}/README.md

# {{ inputs.label }}

common/const/index.ts

{{ read output.abs | before "} as const;" }}
  {{ inputs.model | pascal }}: {
    label: "{{ inputs.label }}",
  },
{{ read output.abs | after "} as const;" -1 }}