Skip to content

Commit

Permalink
refactor(generators/*/templates): update comments
Browse files Browse the repository at this point in the history
  • Loading branch information
phatpham9 committed Feb 14, 2021
1 parent 87c7d1b commit e979f99
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ interface Model extends MongooseModel<Document> {}

const schema = new Schema<Document>({
name: String,
// TODO: add more fields here
// TODO: add more fields
});

export default mongo.createModel<Document, Model>(ENTITY, schema);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const del = async (id: string): Promise<<%= compNamePascalCase %>> => {
return transform(document);
};

// transform document to json object
// transform document to <%= compNamePascalCase %>
const transform = (document: Document): <%= compNamePascalCase %> => {
const { _id: id, ...restObject } = document.toObject({
versionKey: false,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
interface <%= compNamePascalCase %> {
readonly id: string;
readonly name: string;
// TODO: add more props here
// TODO: add more props
}

export { <%= compNamePascalCase %> };
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const get = async (id: number): Promise<<%= compNamePascalCase %>> => {
// get document
const document = await getRepository(Model).findOne(id);
if (document === undefined) {
throw new MyError('Row not found');
throw new MyError('Document not found');
}

return transform(document);
Expand All @@ -36,7 +36,7 @@ const update = async (
// get document
const document = await getRepository(Model).findOne(id);
if (document === undefined) {
throw new MyError('Row not found');
throw new MyError('Document not found');
}

// update document
Expand All @@ -50,7 +50,7 @@ const del = async (id: number): Promise<<%= compNamePascalCase %>> => {
// get document
const document = await getRepository(Model).findOne(id);
if (document === undefined) {
throw new MyError('Row not found');
throw new MyError('Document not found');
}

// delete document
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
interface <%= compNamePascalCase %> {
readonly id: number;
readonly name: string;
// TODO: add more props here
// TODO: add more props
}

export { <%= compNamePascalCase %> };
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const schema = {
autoIncrement: true,
},
name: DataTypes.STRING,
// TODO: add more fields here
// TODO: add more fields
};

export default postgres.createModel<Instance, Model>(ENTITY, schema, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const del = async (id: number): Promise<<%= compNamePascalCase %>> => {
return transform(instance);
};

// transform instance to json object
// transform instance to <%= compNamePascalCase %>
const transform = (instance: Instance): <%= compNamePascalCase %> => {
return instance.toJSON() as <%= compNamePascalCase %>;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
interface <%= compNamePascalCase %> {
readonly id: number;
readonly name: string;
// TODO: add more props here
// TODO: add more props
}

export { <%= compNamePascalCase %> };

0 comments on commit e979f99

Please sign in to comment.