Skip to content

Commit 41ca4e5

Browse files
committed
feat: Add CLI command registration and enhance lifecycle service mutation handling
1 parent 5d6670a commit 41ca4e5

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

apps/api/src/_common/plugins/mongoose/history.plugin.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ export function historyPlugin(schema: Schema, options: HistoryPluginOptions) {
119119
logger.verbose(`Audit after state: ${JSON.stringify(after)}`)
120120

121121
if (!hasChanged) {
122+
console.log('change', after?._id ?? before?._id);
122123
logger.debug(`No significant changes detected for ${mergedOptions.collectionName} ${after?._id ?? before?._id}, skipping audit log.`)
123124
return
124125
}

apps/api/src/management/lifecycle/lifecycle.module.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import { Lifecycle, LifecycleSchema } from './_schemas/lifecycle.schema';
44
import { LifecycleController } from './lifecycle.controller';
55
import { LifecycleService } from './lifecycle.service';
66
import { IdentitiesModule } from '../identities/identities.module';
7+
import { useOnCli } from '~/_common/functions/is-cli';
8+
import { LifecycleCommand } from './lifecycle.command';
79

810
@Module({
911
imports: [
@@ -15,7 +17,12 @@ import { IdentitiesModule } from '../identities/identities.module';
1517
]),
1618
IdentitiesModule,
1719
],
18-
providers: [LifecycleService],
20+
providers: [
21+
LifecycleService,
22+
...useOnCli([
23+
...LifecycleCommand.registerWithSubCommands(),
24+
]),
25+
],
1926
controllers: [LifecycleController],
2027
exports: [LifecycleService],
2128
})

apps/api/src/management/lifecycle/lifecycle.service.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -546,6 +546,7 @@ export class LifecycleService extends AbstractServiceSchema implements OnApplica
546546
},
547547
{
548548
$set: {
549+
...lcs.mutation,
549550
lifecycle: lcs.target,
550551
lastLifecycleUpdate: new Date(),
551552
},

0 commit comments

Comments
 (0)