@apso/cli 0.8.2 → 0.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<% const {field} = it; %>
|
|
2
|
-
<% if (field.name === '
|
|
2
|
+
<% if (field.name === 'created_at') { %>
|
|
3
3
|
@CreateDateColumn()
|
|
4
|
-
|
|
5
|
-
<% } else if (field.name === '
|
|
4
|
+
created_at: Date;
|
|
5
|
+
<% } else if (field.name === 'updated_at') { %>
|
|
6
6
|
@UpdateDateColumn()
|
|
7
|
-
|
|
7
|
+
updated_at: Date;
|
|
8
8
|
<% } else { %>
|
|
9
9
|
@Column({ type: 'timestamp', nullable: <%= Boolean(field.nullable) %> })
|
|
10
10
|
<%= field.name %>: Date;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<% const {field} = it; %>
|
|
2
|
-
<% if (field.name === '
|
|
2
|
+
<% if (field.name === 'created_at') { %>
|
|
3
3
|
@CreateDateColumn()
|
|
4
|
-
|
|
5
|
-
<% } else if (field.name === '
|
|
4
|
+
created_at: Date;
|
|
5
|
+
<% } else if (field.name === 'updated_at') { %>
|
|
6
6
|
@UpdateDateColumn()
|
|
7
|
-
|
|
7
|
+
updated_at: Date;
|
|
8
8
|
<% } else { %>
|
|
9
9
|
@Column({ type: 'timestamptz', nullable: <%= Boolean(field.nullable) %> })
|
|
10
10
|
<%= field.name %>: Date;
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
/* eslint @typescript-eslint/no-unused-vars: "off" */
|
|
3
3
|
|
|
4
4
|
<%
|
|
5
|
-
// Check if any columns are named
|
|
6
|
-
const hasCreatedAt = it.createdAt || it.columns.some(c => c.name === '
|
|
7
|
-
const hasUpdatedAt = it.updatedAt || it.columns.some(c => c.name === '
|
|
5
|
+
// Check if any columns are named created_at or updated_at
|
|
6
|
+
const hasCreatedAt = it.createdAt || it.columns.some(c => c.name === 'created_at');
|
|
7
|
+
const hasUpdatedAt = it.updatedAt || it.columns.some(c => c.name === 'updated_at');
|
|
8
8
|
%>
|
|
9
9
|
import {
|
|
10
10
|
Column,
|
|
@@ -73,20 +73,20 @@ export class <%= it.name %> {
|
|
|
73
73
|
|
|
74
74
|
<% if (it.createdAt) { %>
|
|
75
75
|
@CreateDateColumn()
|
|
76
|
-
|
|
76
|
+
created_at: Date;
|
|
77
77
|
<% } %>
|
|
78
78
|
|
|
79
79
|
<% if (it.updatedAt) { %>
|
|
80
80
|
@UpdateDateColumn()
|
|
81
|
-
|
|
81
|
+
updated_at: Date;
|
|
82
82
|
<% } %>
|
|
83
83
|
|
|
84
84
|
<%
|
|
85
|
-
// Filter out id (if createPrimaryKey),
|
|
85
|
+
// Filter out id (if createPrimaryKey), created_at, and updated_at since they're handled separately
|
|
86
86
|
const columnsToProcess = it.columns.filter(c => {
|
|
87
87
|
if (it.createPrimaryKey && c.name === 'id') return false;
|
|
88
|
-
if (it.createdAt && c.name === '
|
|
89
|
-
if (it.updatedAt && c.name === '
|
|
88
|
+
if (it.createdAt && c.name === 'created_at') return false;
|
|
89
|
+
if (it.updatedAt && c.name === 'updated_at') return false;
|
|
90
90
|
return true;
|
|
91
91
|
});
|
|
92
92
|
columnsToProcess.forEach((field) => { %>
|
package/oclif.manifest.json
CHANGED