Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Audit Fields Not Generated When Using [email protected] with JHipster v8.8.0 #291

Closed
yuchilai opened this issue Dec 27, 2024 · 3 comments · Fixed by #292
Closed

Audit Fields Not Generated When Using [email protected] with JHipster v8.8.0 #291

yuchilai opened this issue Dec 27, 2024 · 3 comments · Fixed by #292

Comments

@yuchilai
Copy link

Overview of the issue

The generator-jhipster-entity-audit blueprint does not generate the createdBy, createdDate, lastModifiedBy, and lastModifiedDate fields when used with JHipster v8.8.0. This issue occurs for both the generated Java entities and the database schema.

JHipster info

WARNING! Since JHipster v8, the jhipster command will not use the locally installed generator-jhipster.
If you want to execute the locally installed generator-jhipster, run: npx jhipster
INFO! No custom commands found within blueprint: generator-jhipster-entity-audit at /Users/yuchilai/Projects/Test/aud1t-test/node_modules/generator-jhipster-entity-audit

    ██╗ ██╗   ██╗ ████████╗ ███████╗   ██████╗ ████████╗ ████████╗ ███████╗
    ██║ ██║   ██║ ╚══██╔══╝ ██╔═══██╗ ██╔════╝ ╚══██╔══╝ ██╔═════╝ ██╔═══██╗
    ██║ ████████║    ██║    ███████╔╝ ╚█████╗     ██║    ██████╗   ███████╔╝

██╗ ██║ ██╔═══██║ ██║ ██╔════╝ ╚═══██╗ ██║ ██╔═══╝ ██╔══██║
╚██████╔╝ ██║ ██║ ████████╗ ██║ ██████╔╝ ██║ ████████╗ ██║ ╚██╗
╚═════╝ ╚═╝ ╚═╝ ╚═══════╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══════╝ ╚═╝ ╚═╝
https://www.jhipster.tech
Welcome to JHipster v8.8.0

(node:55624) [DEP0040] DeprecationWarning: The punycode module is deprecated. Please use a userland alternative instead.
(Use node --trace-deprecation ... to show where the warning was created)
Welcome to the JHipster Information Sub-Generator

[email protected] /Users/yuchilai/Projects/Test/aud1t-test
├─┬ [email protected]
│ └── [email protected] deduped
└── [email protected]
JHipster configuration, a .yo-rc.json file generated in the root folder
.yo-rc.json file
{
  "generator-jhipster": {
    "applicationType": "monolith",
    "authenticationType": "oauth2",
    "baseName": "aud1TTest",
    "blueprints": [
      {
        "name": "generator-jhipster-entity-audit",
        "version": "5.8.0"
      }
    ],
    "buildTool": "maven",
    "cacheProvider": "redis",
    "clientFramework": "react",
    "clientTestFrameworks": [
      "cypress"
    ],
    "clientTheme": "none",
    "creationTimestamp": 1735327434904,
    "cypressAudit": true,
    "cypressCoverage": null,
    "databaseType": "sql",
    "devDatabaseType": "mysql",
    "enableHibernateCache": true,
    "enableSwaggerCodegen": true,
    "enableTranslation": true,
    "entities": [
      "Region",
      "Country",
      "Location",
      "Department",
      "Task",
      "Employee",
      "Job",
      "JobHistory"
    ],
    "feignClient": null,
    "jhipsterVersion": "8.8.0",
    "languages": [
      "en",
      "zh-cn",
      "zh-tw",
      "es"
    ],
    "lastLiquibaseTimestamp": 1735328572000,
    "messageBroker": "kafka",
    "microfrontend": null,
    "microfrontends": [],
    "nativeLanguage": "en",
    "packageName": "com.mycompany.myapp",
    "prodDatabaseType": "mysql",
    "reactive": false,
    "serverPort": null,
    "serviceDiscoveryType": null,
    "skipUserManagement": true,
    "syncUserWithIdp": true,
    "testFrameworks": [
      "gatling",
      "cucumber",
      "cypress"
    ],
    "withAdminUi": true
  }
}
Environment and Tools

openjdk version "17.0.9" 2023-10-17
OpenJDK Runtime Environment Temurin-17.0.9+9 (build 17.0.9+9)
OpenJDK 64-Bit Server VM Temurin-17.0.9+9 (build 17.0.9+9, mixed mode)

git version 2.47.1

node: v22.12.0
npm: 10.9.0

Docker version 27.3.1, build ce12230

JDL for the Entity configuration(s) entityName.json files generated in the .jhipster directory
JDL entity definitions
@ChangelogDate("20241227194245")
entity Region {
  regionName String
}
@ChangelogDate("20241227194246")
entity Country {
  countryName String
}
/**
 * not an ignored comment
 */
@ChangelogDate("20241227194247")
entity Location {
  streetAddress String
  postalCode String
  city String
  stateProvince String
}
@ChangelogDate("20241227194248")
entity Department {
  departmentName String required
}
/**
 * Task entity.\n@author The JHipster team.
 */
@ChangelogDate("20241227194249")
entity Task {
  title String
  description String
}
/**
 * The Employee entity.
 */
@ChangelogDate("20241227194250")
entity Employee {
  /**
   * The firstname attribute.
   */
  firstName String
  lastName String
  email String
  phoneNumber String
  hireDate Instant
  salary Long
  commissionPct Long
}
@ChangelogDate("20241227194251")
entity Job {
  jobTitle String
  minSalary Long
  maxSalary Long
}
@ChangelogDate("20241227194252")
entity JobHistory {
  startDate Instant
  endDate Instant
  language Language
}

enum Language {
  FRENCH,
  ENGLISH,
  SPANISH
}

relationship OneToOne {
  Country{region} to Region
  Location{country} to Country
  Department{location} to Location
  JobHistory{job} to Job
  JobHistory{department} to Department
  JobHistory{employee} to Employee
}
relationship OneToMany {
  /**
   * A relationship
   */
  Department{employee} to Employee
  Employee{job} to Job
}
relationship ManyToOne {
  Employee{manager} to Employee
}
relationship ManyToMany {
  Job{task(title)} to Task{job}
}

service Region, Country, Location, Department, Task, JobHistory with serviceImpl
search Region, Country, Location, Department, Task, Employee, Job, JobHistory with no
paginate Employee, JobHistory with infinite-scroll
paginate Job with pagination

Congratulations, JHipster execution is complete!
If you find JHipster useful consider sponsoring the project https://www.jhipster.tech/sponsors/

Thanks for using JHipster!

List of Changed Files

Below are the specific files that were changed during the process (23 files):
1. src/main/webapp/i18n/en/entity-audit.json
2. src/main/webapp/i18n/zh-cn/entity-audit.json
3. src/main/webapp/i18n/zh-tw/entity-audit.json
4. src/main/webapp/i18n/es/entity-audit.json
5. src/test/java/com/mycompany/myapp/web/rest/RegionResourceIT.java
6. src/test/java/com/mycompany/myapp/web/rest/LocationResourceIT.java
7. src/test/java/com/mycompany/myapp/web/rest/TaskResourceIT.java
8. src/test/java/com/mycompany/myapp/web/rest/EmployeeResourceIT.java
9. src/test/java/com/mycompany/myapp/web/rest/JobResourceIT.java
10. src/test/java/com/mycompany/myapp/web/rest/JobHistoryResourceIT.java
11. src/main/webapp/app/entities/menu.tsx
12. src/main/webapp/app/entities/routes.tsx
13. src/main/webapp/app/entities/task/task-update.tsx
14. src/main/webapp/app/entities/task/task-reducer.spec.ts
15. src/main/webapp/app/entities/employee/employee-detail.tsx
16. src/main/webapp/app/entities/employee/employee.tsx
17. src/main/webapp/app/entities/employee/employee.reducer.ts
18. src/main/webapp/app/entities/employee/index.tsx
19. src/main/webapp/app/shared/model/employee.model.ts
20. src/main/webapp/app/entities/employee/employee-delete-dialog.tsx
21. src/main/webapp/app/entities/employee/employee-update.tsx
22. src/main/webapp/app/entities/employee/employee-reducer.spec.ts
23. src/test/javascript/cypress/e2e/entity/region.cy.ts

@mshima
Copy link
Member

mshima commented Dec 27, 2024

Only angular is supported.
See #178

@yuchilai
Copy link
Author

Thanks for clarifying that Angular is supported right now. Based on issue #178, it sounds like React might be supported in the future. Is that something being considered? Thank you!

@yuchilai yuchilai reopened this Dec 28, 2024
@yuchilai
Copy link
Author

Issue with JHipster Entity Audit and Angular Framework

I created a JHipster project using the Angular framework and ran jhipster-entity-audit. After executing the command, I noticed that the files it changed were the same as when using the React framework. I’m unsure if this behavior is normal or if something is wrong with my environment.

Which audit framework would you like to use? (javers/spring-boot-auditing) but idk why in 5.8 version of jhipster-entity-audit now it does not ask ?

However, in v5.8.0, this question is no longer being asked. Is this a change in the newer version? If so, please guide me on what has changed and how I can verify that auditing is correctly configured in my Angular-based JHipster project.

JHipster info

WARNING! Since JHipster v8, the jhipster command will not use the locally installed generator-jhipster.
If you want to execute the locally installed generator-jhipster, run: npx jhipster
INFO! No custom commands found within blueprint: generator-jhipster-entity-audit at /Users/yuchilai/Downloads/1jhipsterSampleApplication/node_modules/generator-jhipster-entity-audit

    ██╗ ██╗   ██╗ ████████╗ ███████╗   ██████╗ ████████╗ ████████╗ ███████╗
    ██║ ██║   ██║ ╚══██╔══╝ ██╔═══██╗ ██╔════╝ ╚══██╔══╝ ██╔═════╝ ██╔═══██╗
    ██║ ████████║    ██║    ███████╔╝ ╚█████╗     ██║    ██████╗   ███████╔╝

██╗ ██║ ██╔═══██║ ██║ ██╔════╝ ╚═══██╗ ██║ ██╔═══╝ ██╔══██║
╚██████╔╝ ██║ ██║ ████████╗ ██║ ██████╔╝ ██║ ████████╗ ██║ ╚██╗
╚═════╝ ╚═╝ ╚═╝ ╚═══════╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══════╝ ╚═╝ ╚═╝
https://www.jhipster.tech
Welcome to JHipster v8.8.0

(node:96353) [DEP0040] DeprecationWarning: The punycode module is deprecated. Please use a userland alternative instead.
(Use node --trace-deprecation ... to show where the warning was created)
Welcome to the JHipster Information Sub-Generator

[email protected] /Users/yuchilai/Downloads/1jhipsterSampleApplication
├─┬ [email protected]
│ └── [email protected] deduped
└── [email protected]
JHipster configuration, a .yo-rc.json file generated in the root folder
.yo-rc.json file
{
  "generator-jhipster": {
    "applicationType": "monolith",
    "authenticationType": "oauth2",
    "baseName": "jhipsterSampleApplication",
    "blueprints": [
      {
        "name": "generator-jhipster-entity-audit",
        "version": "5.8.0"
      }
    ],
    "buildTool": "maven",
    "cacheProvider": "redis",
    "clientFramework": "angular",
    "clientPackageManager": "npm",
    "creationTimestamp": 1735362024268,
    "databaseType": "sql",
    "devDatabaseType": "h2Disk",
    "enableHibernateCache": true,
    "enableSwaggerCodegen": false,
    "enableTranslation": true,
    "entities": [
      "Region",
      "Country",
      "Location",
      "Department",
      "Task",
      "Employee",
      "Job",
      "JobHistory"
    ],
    "gitCompany": "",
    "iaCTools": [
      "bicep",
      "terraform"
    ],
    "jhiPrefix": "jhi",
    "jhipsterVersion": "8.8.0",
    "languages": [
      "en"
    ],
    "lastLiquibaseTimestamp": 1735365391000,
    "messageBroker": false,
    "nativeLanguage": "en",
    "packageFolder": "com/mycompany/myapp",
    "packageName": "com.mycompany.myapp",
    "prodDatabaseType": "mysql",
    "searchEngine": false,
    "serverPort": 8080,
    "serviceDiscoveryType": false,
    "skipUserManagement": true,
    "testFrameworks": [
      "gatling",
      "cucumber",
      "cypress"
    ],
    "useSass": true,
    "websocket": false,
    "withAdminUi": true
  }
}
Environment and Tools

openjdk version "17.0.9" 2023-10-17
OpenJDK Runtime Environment Temurin-17.0.9+9 (build 17.0.9+9)
OpenJDK 64-Bit Server VM Temurin-17.0.9+9 (build 17.0.9+9, mixed mode)

git version 2.47.1

node: v22.12.0
npm: 10.9.0

Docker version 27.3.1, build ce12230

JDL for the Entity configuration(s) entityName.json files generated in the .jhipster directory
JDL entity definitions
@ChangelogDate("20241228055624")
entity Region {
  regionName String
}
@ChangelogDate("20241228055625")
entity Country {
  countryName String
}
/**
 * not an ignored comment
 */
@ChangelogDate("20241228055626")
entity Location {
  streetAddress String
  postalCode String
  city String
  stateProvince String
}
@ChangelogDate("20241228055627")
entity Department {
  departmentName String required
}
/**
 * Task entity.\n@author The JHipster team.
 */
@ChangelogDate("20241228055628")
entity Task {
  title String
  description String
}
/**
 * The Employee entity.
 */
@ChangelogDate("20241228055629")
entity Employee {
  /**
   * The firstname attribute.
   */
  firstName String
  lastName String
  email String
  phoneNumber String
  hireDate Instant
  salary Long
  commissionPct Long
}
@ChangelogDate("20241228055630")
entity Job {
  jobTitle String
  minSalary Long
  maxSalary Long
}
@ChangelogDate("20241228055631")
entity JobHistory {
  startDate Instant
  endDate Instant
  language Language
}

enum Language {
  FRENCH,
  ENGLISH,
  SPANISH
}

relationship OneToOne {
  Country{region} to Region
  Location{country} to Country
  Department{location} to Location
  JobHistory{job} to Job
  JobHistory{department} to Department
  JobHistory{employee} to Employee
}
relationship OneToMany {
  /**
   * A relationship
   */
  Department{employee} to Employee
  Employee{job} to Job
}
relationship ManyToOne {
  Employee{manager} to Employee
}
relationship ManyToMany {
  Job{task(title)} to Task{job}
}

service Region, Country, Location, Department, Task, JobHistory with serviceImpl
search Region, Country, Location, Department, Task, Employee, Job, JobHistory with no
paginate Employee, JobHistory with infinite-scroll
paginate Job with pagination

Congratulations, JHipster execution is complete!
If you find JHipster useful consider sponsoring the project https://www.jhipster.tech/sponsors/

Screenshot of Modified Files

Screenshot 2024-12-28 at 1 20 23 AM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants