@@ -92,7 +92,7 @@ public class ApplicationApiServiceImpl implements ApplicationApiService {
9292 private final OrgDevChecker orgDevChecker ;
9393 private final TemplateSolutionService templateSolutionService ;
9494 private final SuggestAppAdminSolutionService suggestAppAdminSolutionService ;
95-
95+
9696 private final FolderApiService folderApiService ;
9797 private final UserHomeApiService userHomeApiService ;
9898 private final UserApplicationInteractionService userApplicationInteractionService ;
@@ -240,8 +240,8 @@ private Mono<Void> checkApplicationViewRequest(Application application, Applicat
240240 if (expected == ApplicationRequestType .PUBLIC_TO_MARKETPLACE && application .isPublicToMarketplace () && application .isPublicToAll ()) {
241241 return Mono .empty ();
242242 }
243-
244- //
243+
244+ //
245245 // Falk: application.agencyProfile() & isPublicToAll must be both true
246246 if (expected == ApplicationRequestType .AGENCY_PROFILE && application .agencyProfile () && application .isPublicToAll ()) {
247247 return Mono .empty ();
@@ -560,9 +560,9 @@ public Mono<ResourcePermission> checkApplicationPermissionWithReadableErrorMsg(S
560560 return Mono .just (permissionStatus .getPermission ());
561561 });
562562 }
563-
564-
565-
563+
564+
565+
566566 private Mono <ApplicationInfoView > buildView (Application application , String role ) {
567567 return buildView (application , role , null ).delayUntil (applicationInfoView -> {
568568 String applicationId = applicationInfoView .getApplicationId ();
@@ -574,32 +574,47 @@ private Mono<ApplicationInfoView> buildView(Application application, String role
574574 }
575575
576576 private Mono <ApplicationInfoView > buildView (Application application , String role , @ Nullable String folderId ) {
577- return application .getCategory (applicationRecordService )
578- .zipWith (application .getDescription (applicationRecordService ))
579- .zipWith (application .getTitle (applicationRecordService ), TupleUtils ::merge )
580- .map (tuple ->
581- ApplicationInfoView .builder ()
582- .applicationId (application .getId ())
583- .applicationGid (application .getGid ())
584- .orgId (application .getOrganizationId ())
585- .name (application .getName ())
586- .createBy (application .getCreatedBy ())
587- .createAt (application .getCreatedAt ().toEpochMilli ())
588- .role (role )
589- .applicationType (application .getApplicationType ())
590- .applicationStatus (application .getApplicationStatus ())
591- .folderId (folderId )
592- .publicToAll (application .isPublicToAll ())
593- .publicToMarketplace (application .isPublicToMarketplace ())
594- .agencyProfile (application .agencyProfile ())
595- .editingUserId (application .getEditingUserId ())
596- .lastModifyTime (application .getUpdatedAt ())
597- .lastEditedAt (application .getLastEditedAt ())
598- .category (tuple .getT1 ())
599- .description (tuple .getT2 ())
600- .title (tuple .getT3 ())
601- .build ()
602- );
577+ Mono <String > categoryMono = application .getCategory (applicationRecordService );
578+ Mono <String > descriptionMono = application .getDescription (applicationRecordService );
579+ Mono <ApplicationVersion > latestRecordMono = applicationRecordService
580+ .getLatestRecordByApplicationId (application .getId ())
581+ .defaultIfEmpty (new ApplicationVersion () );
582+ Mono <String > titleMono = application .getTitle (applicationRecordService );
583+
584+ return Mono .zip (categoryMono , descriptionMono , latestRecordMono , titleMono )
585+ .map (tuple -> {
586+ String category = tuple .getT1 ();
587+ String description = tuple .getT2 ();
588+ ApplicationVersion latestRecord = tuple .getT3 ();
589+ String title = tuple .getT4 ();
590+ boolean hasPublished = latestRecord .getTag () != null && !latestRecord .getTag ().isEmpty ();
591+ return ApplicationInfoView .builder ()
592+ .category (category )
593+ .description (description )
594+ .published (hasPublished )
595+ .publishedVersion (hasPublished ? latestRecord .getTag () : null )
596+ .lastPublishedTime (hasPublished && latestRecord .getCreateTime () != 0
597+ ? Instant .ofEpochMilli (latestRecord .getCreateTime ())
598+ : null )
599+ .title (title )
600+ .applicationId (application .getId ())
601+ .applicationGid (application .getGid ())
602+ .orgId (application .getOrganizationId ())
603+ .name (application .getName ())
604+ .createBy (application .getCreatedBy ())
605+ .createAt (application .getCreatedAt ().toEpochMilli ())
606+ .role (role )
607+ .applicationType (application .getApplicationType ())
608+ .applicationStatus (application .getApplicationStatus ())
609+ .folderId (folderId )
610+ .publicToAll (application .isPublicToAll ())
611+ .publicToMarketplace (application .isPublicToMarketplace ())
612+ .agencyProfile (application .agencyProfile ())
613+ .editingUserId (application .getEditingUserId ())
614+ .lastModifyTime (application .getUpdatedAt ())
615+ .lastEditedAt (application .getLastEditedAt ())
616+ .build ();
617+ });
603618 }
604619
605620 private Mono <ApplicationInfoView > buildView (Application application ) {
0 commit comments