Skip to content

Commit

Permalink
FEAT:setup api get summary analytics
Browse files Browse the repository at this point in the history
  • Loading branch information
rivopelu committed Nov 28, 2024
1 parent 4a4fa98 commit 54c015e
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/main/java/com/pos/app/controller/AnalyticsController.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.pos.app.controller;

import com.pos.app.annotations.BaseController;
import com.pos.app.model.response.BaseResponse;
import org.springframework.web.bind.annotation.GetMapping;

@BaseController("analytics")
public interface AnalyticsController {

@GetMapping("v1/summary")
BaseResponse getAnalyticsSummary();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.pos.app.controller.impl;

import com.pos.app.annotations.BaseControllerImpl;
import com.pos.app.controller.AnalyticsController;
import com.pos.app.model.response.BaseResponse;
import com.pos.app.service.AnalyticsService;
import com.pos.app.utils.ResponseHelper;
import lombok.RequiredArgsConstructor;

@BaseControllerImpl
@RequiredArgsConstructor
public class AnalyticsControllerImpl implements AnalyticsController {
private final AnalyticsService analyticsService;

@Override
public BaseResponse getAnalyticsSummary() {
return ResponseHelper.createBaseResponse(analyticsService.getAnalyticsSummary());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.pos.app.model.response;

import com.fasterxml.jackson.databind.PropertyNamingStrategies;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigInteger;


@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@JsonSerialize
@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class)
public class ResponseAnalyticsSummary {
private BigInteger totalRevenue;
private BigInteger totalOrder;
private BigInteger totalItems;
}
8 changes: 8 additions & 0 deletions src/main/java/com/pos/app/service/AnalyticsService.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.pos.app.service;

import com.pos.app.model.response.ResponseAnalyticsSummary;

public interface AnalyticsService {

ResponseAnalyticsSummary getAnalyticsSummary();
}
13 changes: 13 additions & 0 deletions src/main/java/com/pos/app/service/impl/AnalyticsServiceImpl.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.pos.app.service.impl;

import com.pos.app.model.response.ResponseAnalyticsSummary;
import com.pos.app.service.AnalyticsService;
import org.springframework.stereotype.Service;

@Service
public class AnalyticsServiceImpl implements AnalyticsService {
@Override
public ResponseAnalyticsSummary getAnalyticsSummary() {
return null;
}
}

0 comments on commit 54c015e

Please sign in to comment.