@apso/cli 0.6.0 → 0.7.1

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.
@@ -51,11 +51,13 @@ const createController = async (apiBaseDir, entity, relationshipMap) => {
51
51
  const svcName = `${entityName}Service`;
52
52
  const ctrlName = `${entityName}Controller`;
53
53
  const pluralEntityName = (0, pluralize_1.default)(entityName);
54
+ const primaryKeyType = entity.primaryKeyType || "serial"; // Default to 'serial' if not specified
54
55
  const data = {
55
56
  svcName,
56
57
  ctrlName,
57
58
  entityName,
58
59
  pluralEntityName,
60
+ primaryKeyType,
59
61
  associations: [...new Set(relationships)],
60
62
  nestedJoinsFile,
61
63
  };
@@ -128,7 +128,7 @@ const createGuards = async (rootPath, entities, auth) => {
128
128
  console.log("[apso] No scopeBy or auth configurations found, skipping guards generation");
129
129
  return;
130
130
  }
131
- const guardsDir = path.join(rootPath, "guards");
131
+ const guardsDir = path.join(rootPath, "autogen", "guards");
132
132
  // Ensure guards directory exists
133
133
  if (!fs.existsSync(guardsDir)) {
134
134
  fs.mkdirSync(guardsDir, { recursive: true });
@@ -21,11 +21,11 @@ import { Reflector } from '@nestjs/core';
21
21
  import { InjectRepository } from '@nestjs/typeorm';
22
22
  import { Repository } from 'typeorm';
23
23
 
24
- // Entity imports
25
- import { <%= it.authConfig.sessionEntity %> } from '../autogen/<%= it.authConfig.sessionEntity %>/<%= it.authConfig.sessionEntity %>.entity';
26
- import { <%= it.authConfig.userEntity %> } from '../autogen/<%= it.authConfig.userEntity %>/<%= it.authConfig.userEntity %>.entity';
24
+ // Entity imports (from sibling autogen folders)
25
+ import { <%= it.authConfig.sessionEntity %> } from '../<%= it.authConfig.sessionEntity %>/<%= it.authConfig.sessionEntity %>.entity';
26
+ import { <%= it.authConfig.userEntity %> } from '../<%= it.authConfig.userEntity %>/<%= it.authConfig.userEntity %>.entity';
27
27
  <% if (it.authConfig.accountUserEntity) { %>
28
- import { <%= it.authConfig.accountUserEntity %> } from '../autogen/<%= it.authConfig.accountUserEntity %>/<%= it.authConfig.accountUserEntity %>.entity';
28
+ import { <%= it.authConfig.accountUserEntity %> } from '../<%= it.authConfig.accountUserEntity %>/<%= it.authConfig.accountUserEntity %>.entity';
29
29
  <% } %>
30
30
 
31
31
  /**
@@ -11,21 +11,21 @@ import { ScopeGuard } from './scope.guard';
11
11
  import { AuthGuard } from './auth.guard';
12
12
  <% } %>
13
13
 
14
- <% /* Import all entities for ScopeGuard */ %>
14
+ <% /* Import all entities for ScopeGuard (from sibling autogen folders) */ %>
15
15
  <% if (it.scopedEntities && it.scopedEntities.length > 0) { %>
16
16
  // Entities for ScopeGuard
17
17
  <% it.scopedEntities.forEach((entity) => { %>
18
- import { <%= entity.name %> } from '../autogen/<%= entity.name %>/<%= entity.name %>.entity';
18
+ import { <%= entity.name %> } from '../<%= entity.name %>/<%= entity.name %>.entity';
19
19
  <% }) %>
20
20
  <% } %>
21
21
 
22
- <% /* Import entities for AuthGuard */ %>
22
+ <% /* Import entities for AuthGuard (from sibling autogen folders) */ %>
23
23
  <% if (it.authConfig) { %>
24
24
  // Entities for AuthGuard
25
- import { <%= it.authConfig.sessionEntity %> } from '../autogen/<%= it.authConfig.sessionEntity %>/<%= it.authConfig.sessionEntity %>.entity';
26
- import { <%= it.authConfig.userEntity %> } from '../autogen/<%= it.authConfig.userEntity %>/<%= it.authConfig.userEntity %>.entity';
25
+ import { <%= it.authConfig.sessionEntity %> } from '../<%= it.authConfig.sessionEntity %>/<%= it.authConfig.sessionEntity %>.entity';
26
+ import { <%= it.authConfig.userEntity %> } from '../<%= it.authConfig.userEntity %>/<%= it.authConfig.userEntity %>.entity';
27
27
  <% if (it.authConfig.accountUserEntity) { %>
28
- import { <%= it.authConfig.accountUserEntity %> } from '../autogen/<%= it.authConfig.accountUserEntity %>/<%= it.authConfig.accountUserEntity %>.entity';
28
+ import { <%= it.authConfig.accountUserEntity %> } from '../<%= it.authConfig.accountUserEntity %>/<%= it.authConfig.accountUserEntity %>.entity';
29
29
  <% } %>
30
30
  <% } %>
31
31
 
@@ -10,9 +10,9 @@ import { Reflector } from '@nestjs/core';
10
10
  import { InjectRepository } from '@nestjs/typeorm';
11
11
  import { Repository } from 'typeorm';
12
12
 
13
- <% /* Import all entities that have scoped relationships */ %>
13
+ <% /* Import all entities that have scoped relationships (from sibling autogen folders) */ %>
14
14
  <% it.scopedEntities.forEach((entity) => { %>
15
- import { <%= entity.name %> } from '../autogen/<%= entity.name %>/<%= entity.name %>.entity';
15
+ import { <%= entity.name %> } from '../<%= entity.name %>/<%= entity.name %>.entity';
16
16
  <% }) %>
17
17
 
18
18
  /**
@@ -15,6 +15,13 @@ import {<%= it.svcName %>} from './<%= it.entityName %>.service';
15
15
  update: <%= it.entityName %>,
16
16
  replace: <%= it.entityName %>,
17
17
  },
18
+ params: {
19
+ id: {
20
+ field: 'id',
21
+ type: 'string',
22
+ primary: true,
23
+ },
24
+ },
18
25
  query: {
19
26
  /**
20
27
  * commenting out limit and pagination because of an issue with Crud lib: https://github.com/nestjsx/crud/issues/777
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.6.0",
2
+ "version": "0.7.1",
3
3
  "commands": {
4
4
  "server:new": {
5
5
  "id": "server:new",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apso/cli",
3
- "version": "0.6.0",
3
+ "version": "0.7.1",
4
4
  "description": "Apso CLI",
5
5
  "author": "Apso by Mavric - @mavric",
6
6
  "bin": {