-
Notifications
You must be signed in to change notification settings - Fork 0
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
Deployment #120
base: master
Are you sure you want to change the base?
Deployment #120
Changes from all commits
f29735c
5277275
09cb916
d9d56d0
bd7c0eb
d9efaa3
4d77864
ec153f4
0f2c5b1
7326b28
bb308e8
5427283
3b79635
31d106f
d48ee3c
e9ed6e3
78594da
9b26e6d
e34d567
b647063
6b66b0a
f2ef055
e5f3c5a
86c4e29
3fcec0e
5dcdc4a
cf2c706
10bca66
1270b23
8bc098a
05ebbe1
41b1943
314bcc5
f5d761e
8f3f107
1b12722
0b3d8ab
7b950c2
92b2916
db2cc64
bb5a43f
3da2781
d470262
fbc81ed
73aecbb
e29c5ec
94b1ae2
a236d92
494d8ca
a0e46cf
db90bd0
1592207
397dfa1
8fd22ec
bda402f
376c1a7
6a984bb
6240c33
6f221d1
88cc3dd
ab05c2f
c29df75
9a424e4
20a7b61
2b6e848
37f4654
316d29a
36ed611
f612f40
789e548
4c9df24
54c0376
fce8a29
8ccdfdc
1b9ff76
97b27f4
969e3e2
49eb085
3fabc3c
3147890
910929e
560a99d
b69abec
af6cb80
db69f51
2ddfb21
ed83426
305d012
d959494
ce30650
36187ed
764d45e
8207d5f
b709008
e668920
2492c09
f4ffa53
a3d5e48
cf70122
7ee92cd
49edd15
8363acc
e7eaaa8
25ba56e
4ce4046
07b7302
1fdb70d
2465528
47cd731
d8a6a34
88eb7eb
3e33d6d
5b725ca
a991681
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,45 @@ | ||||||||||||||||||||||||
name: Build and Deploy to Staging | ||||||||||||||||||||||||
on: | ||||||||||||||||||||||||
push: | ||||||||||||||||||||||||
branches: | ||||||||||||||||||||||||
- deployment | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
jobs: | ||||||||||||||||||||||||
build-and-deploy: | ||||||||||||||||||||||||
runs-on: ubuntu-20.04 | ||||||||||||||||||||||||
steps: | ||||||||||||||||||||||||
# Step 1: Check out the code | ||||||||||||||||||||||||
- name: Checkout repository | ||||||||||||||||||||||||
uses: actions/checkout@v3 | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
# Step 2: Set up Java | ||||||||||||||||||||||||
- name: Set up JDK | ||||||||||||||||||||||||
uses: actions/setup-java@v3 | ||||||||||||||||||||||||
with: | ||||||||||||||||||||||||
java-version: '8' | ||||||||||||||||||||||||
distribution: 'temurin' | ||||||||||||||||||||||||
Comment on lines
+16
to
+20
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Update Java setup and add dependency caching. The - name: Set up JDK
- uses: actions/setup-java@v3
+ uses: actions/setup-java@v4
with:
java-version: '8'
distribution: 'temurin'
+ cache: 'maven' 📝 Committable suggestion
Suggested change
🧰 Tools🪛 actionlint (1.7.4)17-17: the runner of "actions/setup-java@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue (action) |
||||||||||||||||||||||||
|
||||||||||||||||||||||||
# Step 3: Build the JAR | ||||||||||||||||||||||||
- name: Build with Maven | ||||||||||||||||||||||||
run: mvn clean install -f NMSReportingSuite/pom.xml | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
# Step 4: Build FrontEnd | ||||||||||||||||||||||||
- name: Install Frontend Dependencies and Build with Grunt | ||||||||||||||||||||||||
run: | | ||||||||||||||||||||||||
cd app | ||||||||||||||||||||||||
npm install | ||||||||||||||||||||||||
grunt package | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
# Step 5: Store deployment data | ||||||||||||||||||||||||
- uses: actions/upload-artifact@v4 | ||||||||||||||||||||||||
with: | ||||||||||||||||||||||||
name: my-artifact | ||||||||||||||||||||||||
path: | | ||||||||||||||||||||||||
NMSReportingSuite/target/*.war | ||||||||||||||||||||||||
app/index.html | ||||||||||||||||||||||||
app/scripts/ | ||||||||||||||||||||||||
app/views/ | ||||||||||||||||||||||||
app/styles/ | ||||||||||||||||||||||||
app/dist/ | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
|
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -134,12 +134,12 @@ public TargetFileNotification generateTargetFile() { | |
case ASHACERTIFICATE: | ||
productName = "MA Certificate Download through SMS"; | ||
messageText = formatCertificateMessage(beneficiary, SMS_CONTENT_ASHACERTIFICATE_PREFIX, languageCode); | ||
String otpMessage = formatCertificateOTPMessage(beneficiary, SMS_CONTENT_ASHACERTIFICATE_OTP_PREFIX, languageCode); | ||
// String otpMessage = formatCertificateOTPMessage(beneficiary, SMS_CONTENT_ASHACERTIFICATE_OTP_PREFIX, languageCode); | ||
templateId = formatTemplateId(languageCode); | ||
writeMessage(writer, msisdn, stateName, productName, templateId, messageText); | ||
writeMessage(writer, msisdn, stateName, productName, SMS_CONTENT_CERTIFICATETemplateId_OTP_PREFIX, otpMessage); | ||
// writeMessage(writer, msisdn, stateName, productName, SMS_CONTENT_CERTIFICATETemplateId_OTP_PREFIX, otpMessage); | ||
flwIds.add(beneficiary.getAshaId()); | ||
recordsWritten += 2; | ||
recordsWritten ++; | ||
continue; | ||
Comment on lines
134
to
143
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Verify security implications of removing OTP messages. The removal of OTP message generation for ASHA certificates could impact the security of the certificate access process. Please verify:
Let's verify if there are any remaining OTP-related functionalities in the codebase: ✅ Verification successful🏁 Script executed: #!/bin/bash
# Search for OTP-related code and configurations
echo "Searching for OTP-related code..."
rg -i "otp" --type java
echo "Searching for certificate authentication mechanisms..."
rg -i "certificate.*auth" --type java Length of output: 76011 OTP Security Verification in ASHA Certificate Flow The OTP mechanism remains intact in the codebase even though the OTP message generation in the AshaTargetFileServiceImpl was removed. Specifically:
|
||
|
||
default: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.beehyv.nmsreporting.dao; | ||
|
||
import com.beehyv.nmsreporting.model.KilkariUsageChild; | ||
|
||
import java.util.Date; | ||
|
||
/** | ||
* Created by beehyv on 27/01/25. | ||
*/ | ||
public interface KilkariUsageChildDao { | ||
|
||
KilkariUsageChild getUsage(Integer locationId, String locationType, Date toDate, String periodType); | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.beehyv.nmsreporting.dao; | ||
|
||
import com.beehyv.nmsreporting.model.KilkariUsageMother; | ||
|
||
import java.util.Date; | ||
|
||
/** | ||
* Created by beehyv on 27/01/25. | ||
*/ | ||
public interface KilkariUsageMotherDao { | ||
|
||
KilkariUsageMother getUsage(Integer locationId, String locationType, Date toDate, String periodType); | ||
|
||
} |
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,47 @@ | ||||||||||||||||||||||||||||||||||||||
package com.beehyv.nmsreporting.dao.impl; | ||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||
import com.beehyv.nmsreporting.dao.AbstractDao; | ||||||||||||||||||||||||||||||||||||||
import com.beehyv.nmsreporting.dao.KilkariUsageChildDao; | ||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||
import com.beehyv.nmsreporting.model.KilkariUsageChild; | ||||||||||||||||||||||||||||||||||||||
import org.hibernate.Criteria; | ||||||||||||||||||||||||||||||||||||||
import org.hibernate.criterion.Order; | ||||||||||||||||||||||||||||||||||||||
import org.hibernate.criterion.Restrictions; | ||||||||||||||||||||||||||||||||||||||
import org.springframework.stereotype.Repository; | ||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||
import java.util.Date; | ||||||||||||||||||||||||||||||||||||||
import java.util.List; | ||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||
/** | ||||||||||||||||||||||||||||||||||||||
* Created by beehyv on 27/02/25. | ||||||||||||||||||||||||||||||||||||||
*/ | ||||||||||||||||||||||||||||||||||||||
@Repository("usageChildDao") | ||||||||||||||||||||||||||||||||||||||
public class KilkariUsageChildDaoImpl extends AbstractDao<Integer, KilkariUsageChild> implements KilkariUsageChildDao { | ||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||
@Override | ||||||||||||||||||||||||||||||||||||||
public KilkariUsageChild getUsage(Integer locationId, String locationType, Date toDate, String periodType){ | ||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||
Criteria criteria = createEntityCriteria().addOrder(Order.asc("locationId")); | ||||||||||||||||||||||||||||||||||||||
criteria.add(Restrictions.and( | ||||||||||||||||||||||||||||||||||||||
Restrictions.eq("locationId",locationId.longValue()), | ||||||||||||||||||||||||||||||||||||||
Restrictions.eq("locationType",locationType), | ||||||||||||||||||||||||||||||||||||||
Restrictions.eq("periodType",periodType), | ||||||||||||||||||||||||||||||||||||||
Restrictions.eq("date",toDate) | ||||||||||||||||||||||||||||||||||||||
)); | ||||||||||||||||||||||||||||||||||||||
List<KilkariUsageChild> result = criteria.list(); | ||||||||||||||||||||||||||||||||||||||
if(result.isEmpty()){ | ||||||||||||||||||||||||||||||||||||||
Long a = (long)0; | ||||||||||||||||||||||||||||||||||||||
KilkariUsageChild kilkariUsageChild = new KilkariUsageChild(0,locationType,locationId.longValue(),toDate,a,a,a,a,a,a,a,""); | ||||||||||||||||||||||||||||||||||||||
return kilkariUsageChild; | ||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||
KilkariUsageChild kilkariUsageChild = result.get(0); | ||||||||||||||||||||||||||||||||||||||
kilkariUsageChild.setCalls_1_25(kilkariUsageChild.getCalls_1_25() == null ? 0 : kilkariUsageChild.getCalls_1_25()); | ||||||||||||||||||||||||||||||||||||||
kilkariUsageChild.setCalls_25_50(kilkariUsageChild.getCalls_25_50() == null ? 0 : kilkariUsageChild.getCalls_25_50()); | ||||||||||||||||||||||||||||||||||||||
kilkariUsageChild.setCalls_50_75(kilkariUsageChild.getCalls_50_75() == null ? 0 : kilkariUsageChild.getCalls_50_75()); | ||||||||||||||||||||||||||||||||||||||
kilkariUsageChild.setCalls_75_100(kilkariUsageChild.getCalls_75_100() == null ? 0 : kilkariUsageChild.getCalls_75_100()); | ||||||||||||||||||||||||||||||||||||||
kilkariUsageChild.setCalledInbox(kilkariUsageChild.getCalledInbox() == null ? 0 : kilkariUsageChild.getCalledInbox()); | ||||||||||||||||||||||||||||||||||||||
kilkariUsageChild.setAnsweredAtleastOneCall(kilkariUsageChild.getAnsweredAtleastOneCall() == null ? 0 : kilkariUsageChild.getAnsweredAtleastOneCall()); | ||||||||||||||||||||||||||||||||||||||
kilkariUsageChild.setTotalBeneficiariesCalled(kilkariUsageChild.getTotalBeneficiariesCalled() == null ? 0 : kilkariUsageChild.getTotalBeneficiariesCalled()); | ||||||||||||||||||||||||||||||||||||||
Comment on lines
+38
to
+44
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Refactor null checks using a utility method. Multiple similar null checks can be simplified using a utility method. + private Long getValueOrDefault(Long value) {
+ return value == null ? 0L : value;
+ }
- kilkariUsageChild.setCalls_1_25(kilkariUsageChild.getCalls_1_25() == null ? 0 : kilkariUsageChild.getCalls_1_25());
- kilkariUsageChild.setCalls_25_50(kilkariUsageChild.getCalls_25_50() == null ? 0 : kilkariUsageChild.getCalls_25_50());
- kilkariUsageChild.setCalls_50_75(kilkariUsageChild.getCalls_50_75() == null ? 0 : kilkariUsageChild.getCalls_50_75());
- kilkariUsageChild.setCalls_75_100(kilkariUsageChild.getCalls_75_100() == null ? 0 : kilkariUsageChild.getCalls_75_100());
- kilkariUsageChild.setCalledInbox(kilkariUsageChild.getCalledInbox() == null ? 0 : kilkariUsageChild.getCalledInbox());
- kilkariUsageChild.setAnsweredAtleastOneCall(kilkariUsageChild.getAnsweredAtleastOneCall() == null ? 0 : kilkariUsageChild.getAnsweredAtleastOneCall());
- kilkariUsageChild.setTotalBeneficiariesCalled(kilkariUsageChild.getTotalBeneficiariesCalled() == null ? 0 : kilkariUsageChild.getTotalBeneficiariesCalled());
+ kilkariUsageChild.setCalls_1_25(getValueOrDefault(kilkariUsageChild.getCalls_1_25()));
+ kilkariUsageChild.setCalls_25_50(getValueOrDefault(kilkariUsageChild.getCalls_25_50()));
+ kilkariUsageChild.setCalls_50_75(getValueOrDefault(kilkariUsageChild.getCalls_50_75()));
+ kilkariUsageChild.setCalls_75_100(getValueOrDefault(kilkariUsageChild.getCalls_75_100()));
+ kilkariUsageChild.setCalledInbox(getValueOrDefault(kilkariUsageChild.getCalledInbox()));
+ kilkariUsageChild.setAnsweredAtleastOneCall(getValueOrDefault(kilkariUsageChild.getAnsweredAtleastOneCall()));
+ kilkariUsageChild.setTotalBeneficiariesCalled(getValueOrDefault(kilkariUsageChild.getTotalBeneficiariesCalled())); 📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||||||||||||
return kilkariUsageChild; | ||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package com.beehyv.nmsreporting.dao.impl; | ||
|
||
import com.beehyv.nmsreporting.dao.AbstractDao; | ||
import com.beehyv.nmsreporting.dao.KilkariUsageMotherDao; | ||
import com.beehyv.nmsreporting.model.KilkariUsageMother; | ||
import org.hibernate.Criteria; | ||
import org.hibernate.criterion.Order; | ||
import org.hibernate.criterion.Restrictions; | ||
import org.springframework.stereotype.Repository; | ||
|
||
import java.util.Date; | ||
import java.util.List; | ||
|
||
/** | ||
* Created by beehyv on 27/02/25. | ||
*/ | ||
@Repository("usageMotherDao") | ||
public class KilkariUsageMotherDaoImpl extends AbstractDao<Integer, KilkariUsageMother> implements KilkariUsageMotherDao { | ||
|
||
@Override | ||
public KilkariUsageMother getUsage(Integer locationId, String locationType, Date toDate, String periodType){ | ||
|
||
Criteria criteria = createEntityCriteria().addOrder(Order.asc("locationId")); | ||
criteria.add(Restrictions.and( | ||
Restrictions.eq("locationId",locationId.longValue()), | ||
Restrictions.eq("locationType",locationType), | ||
Restrictions.eq("periodType",periodType), | ||
Restrictions.eq("date",toDate) | ||
)); | ||
List<KilkariUsageMother> result = criteria.list(); | ||
if(result.isEmpty()){ | ||
Long a = (long)0; | ||
KilkariUsageMother kilkariUsageMother = new KilkariUsageMother(0,locationType,locationId.longValue(),toDate,a,a,a,a,a,a,a,""); | ||
return kilkariUsageMother; | ||
} | ||
KilkariUsageMother kilkariUsageMother = result.get(0); | ||
kilkariUsageMother.setCalls_1_25(kilkariUsageMother.getCalls_1_25() == null ? 0 : kilkariUsageMother.getCalls_1_25()); | ||
kilkariUsageMother.setCalls_25_50(kilkariUsageMother.getCalls_25_50() == null ? 0 : kilkariUsageMother.getCalls_25_50()); | ||
kilkariUsageMother.setCalls_50_75(kilkariUsageMother.getCalls_50_75() == null ? 0 : kilkariUsageMother.getCalls_50_75()); | ||
kilkariUsageMother.setCalls_75_100(kilkariUsageMother.getCalls_75_100() == null ? 0 : kilkariUsageMother.getCalls_75_100()); | ||
kilkariUsageMother.setCalledInbox(kilkariUsageMother.getCalledInbox() == null ? 0 : kilkariUsageMother.getCalledInbox()); | ||
kilkariUsageMother.setAnsweredAtleastOneCall(kilkariUsageMother.getAnsweredAtleastOneCall() == null ? 0 : kilkariUsageMother.getAnsweredAtleastOneCall()); | ||
kilkariUsageMother.setTotalBeneficiariesCalled(kilkariUsageMother.getTotalBeneficiariesCalled() == null ? 0 : kilkariUsageMother.getTotalBeneficiariesCalled()); | ||
return kilkariUsageMother; | ||
} | ||
Comment on lines
+18
to
+45
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Consider creating a common base class for usage DAOs. The implementation is almost identical to +public abstract class AbstractKilkariUsageDao<T> extends AbstractDao<Integer, T> {
+ protected T getUsageInternal(Integer locationId, String locationType, Date toDate, String periodType,
+ Function<Long, T> constructor) {
+ Criteria criteria = createEntityCriteria().addOrder(Order.asc("locationId"));
+ criteria.add(Restrictions.and(
+ Restrictions.eq("locationId", locationId.longValue()),
+ Restrictions.eq("locationType", locationType),
+ Restrictions.eq("periodType", periodType),
+ Restrictions.eq("date", toDate)
+ ));
+ List<T> result = criteria.list();
+ if (result.isEmpty()) {
+ return constructor.apply(0L);
+ }
+ return initializeNullFields(result.get(0));
+ }
+
+ protected abstract T initializeNullFields(T entity);
+}
+
+@Repository("usageMotherDao")
+public class KilkariUsageMotherDaoImpl extends AbstractKilkariUsageDao<KilkariUsageMother>
+ implements KilkariUsageMotherDao {
+
+ @Override
+ public KilkariUsageMother getUsage(Integer locationId, String locationType, Date toDate, String periodType) {
+ return getUsageInternal(locationId, locationType, toDate, periodType,
+ defaultValue -> new KilkariUsageMother(0, locationType, locationId.longValue(), toDate,
+ defaultValue, defaultValue, defaultValue, defaultValue, defaultValue, defaultValue, defaultValue, ""));
+ }
+
+ @Override
+ protected KilkariUsageMother initializeNullFields(KilkariUsageMother entity) {
+ entity.setCalls_1_25(getValueOrDefault(entity.getCalls_1_25()));
+ // ... similar for other fields
+ return entity;
+ }
+}
|
||
|
||
} | ||
Comment on lines
+1
to
+47
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Extract common functionality to a base class. This implementation is nearly identical to Example refactor: @MappedSuperclass
public abstract class AbstractKilkariUsageDao<T> extends AbstractDao<Integer, T> {
protected static final long DEFAULT_COUNT = 0L;
protected static final int DEFAULT_ID = 0;
protected T getUsageInternal(Integer locationId, String locationType,
Date toDate, String periodType,
Function<Object[], T> constructor) {
Criteria criteria = createEntityCriteria()
.addOrder(Order.asc("locationId"))
.add(Restrictions.and(
Restrictions.eq("locationId", locationId.longValue()),
Restrictions.eq("locationType", locationType),
Restrictions.eq("periodType", periodType),
Restrictions.eq("date", toDate)
));
return Optional.ofNullable(criteria.uniqueResult())
.map(result -> {
T usage = (T) result;
initializeNullMetrics(usage);
return usage;
})
.orElseGet(() -> createDefaultUsage(locationId, locationType,
toDate, constructor));
}
protected abstract void initializeNullMetrics(T usage);
protected abstract T createDefaultUsage(Integer locationId,
String locationType, Date toDate, Function<Object[], T> constructor);
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Update the checkout action to the latest version.
The
actions/checkout
action version v3 is outdated. Update to the latest version for security and performance improvements.📝 Committable suggestion
🧰 Tools
🪛 actionlint (1.7.4)
13-13: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)