Skip to content

Commit

Permalink
api: Add publicationNames in getIssues() response
Browse files Browse the repository at this point in the history
whattheduck: Bump version
  • Loading branch information
bperel committed Oct 3, 2024
1 parent 2781808 commit 83073a8
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 47 deletions.
5 changes: 3 additions & 2 deletions apps/web/src/stores/collection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,6 @@ export const collection = defineStore("collection", () => {
await collectionServices.deletePurchase(id);
await loadPurchases(true);
},
fetchPublicationNames = () => collectionServices.getPublicationTitles(),
loadPreviousVisit = async () => {
const result = await collectionServices.getLastVisit();
if (typeof result === "object" && result?.error) {
Expand All @@ -178,11 +177,14 @@ export const collection = defineStore("collection", () => {
loadCollection = async (afterUpdate = false) => {
if (afterUpdate || (!isLoadingCollection.value && !issues.value)) {
isLoadingCollection.value = true;
let publicationNames: Record<string, string> = {};
({
issues: issues.value,
countByCountrycode: coaIssueCountsPerCountrycode.value,
countByPublicationcode: coaIssueCountsByPublicationcode.value,
publicationNames,
} = await collectionServices.getIssues());
coa().addPublicationNames(publicationNames);
Object.assign(
coa().issuecodeDetails,
issues.value.map(({ issuecode, publicationcode, issuenumber }) => ({
Expand Down Expand Up @@ -374,7 +376,6 @@ export const collection = defineStore("collection", () => {
publicationUrlRoot,
createPurchase,
deletePurchase,
fetchPublicationNames,
hasRole,
hasSuggestions,
isLoadingUser,
Expand Down
4 changes: 2 additions & 2 deletions apps/whattheduck/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ android {
applicationId "net.ducksmanager.whattheduck3"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 116
versionName "3.0.7"
versionCode 117
versionName "3.0.8"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
aaptOptions {
// Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps.
Expand Down
2 changes: 1 addition & 1 deletion apps/whattheduck/android/capacitor.settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ include ':capawesome-capacitor-file-picker'
project(':capawesome-capacitor-file-picker').projectDir = new File('../../../node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@capawesome/capacitor-file-picker/android')

include ':capgo-capacitor-updater'
project(':capgo-capacitor-updater').projectDir = new File('../../../node_modules/.pnpm/@[email protected].4_@[email protected]/node_modules/@capgo/capacitor-updater/android')
project(':capgo-capacitor-updater').projectDir = new File('../../../node_modules/.pnpm/@[email protected].5_@[email protected]/node_modules/@capgo/capacitor-updater/android')
8 changes: 4 additions & 4 deletions apps/whattheduck/ios/App/App.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -366,15 +366,15 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 116;
CURRENT_PROJECT_VERSION = 117;
DEVELOPMENT_TEAM = ZHTS8HRVD7;
INFOPLIST_FILE = App/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 13.1;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 3.0.7;
MARKETING_VERSION = 3.0.8;
OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" \"-DDEBUG\"";
PRODUCT_BUNDLE_IDENTIFIER = net.ducksmanager.whattheduck;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -390,15 +390,15 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 116;
CURRENT_PROJECT_VERSION = 117;
DEVELOPMENT_TEAM = ZHTS8HRVD7;
INFOPLIST_FILE = App/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 13.1;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 3.0.7;
MARKETING_VERSION = 3.0.8;
PRODUCT_BUNDLE_IDENTIFIER = net.ducksmanager.whattheduck;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "";
Expand Down
2 changes: 1 addition & 1 deletion apps/whattheduck/ios/App/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def capacitor_pods
pod 'CapacitorStatusBar', :path => '../../../../node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@capacitor/status-bar'
pod 'CapawesomeCapacitorAppUpdate', :path => '../../../../node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@capawesome/capacitor-app-update'
pod 'CapawesomeCapacitorFilePicker', :path => '../../../../node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@capawesome/capacitor-file-picker'
pod 'CapgoCapacitorUpdater', :path => '../../../../node_modules/.pnpm/@[email protected].4_@[email protected]/node_modules/@capgo/capacitor-updater'
pod 'CapgoCapacitorUpdater', :path => '../../../../node_modules/.pnpm/@[email protected].5_@[email protected]/node_modules/@capgo/capacitor-updater'
end

target 'What The Duck' do
Expand Down
16 changes: 5 additions & 11 deletions apps/whattheduck/ios/App/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,17 @@ PODS:
- Capacitor
- CapawesomeCapacitorFilePicker (6.0.1):
- Capacitor
- CapgoCapacitorUpdater (6.2.4):
- CapgoCapacitorUpdater (6.2.5):
- Alamofire
- Capacitor
- SSZipArchive
- SwiftyRSA
- Version
- SQLCipher (4.6.0):
- SQLCipher/standard (= 4.6.0)
- SQLCipher/common (4.6.0)
- SQLCipher/standard (4.6.0):
- SQLCipher/common
- SSZipArchive (2.4.3)
- SwiftyRSA (1.7.0):
- SwiftyRSA/ObjC (= 1.7.0)
- SwiftyRSA/ObjC (1.7.0)
- Version (0.8.0)
- ZIPFoundation (0.9.19)

Expand All @@ -59,14 +55,13 @@ DEPENDENCIES:
- "CapacitorStatusBar (from `../../../../node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@capacitor/status-bar`)"
- "CapawesomeCapacitorAppUpdate (from `../../../../node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@capawesome/capacitor-app-update`)"
- "CapawesomeCapacitorFilePicker (from `../../../../node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@capawesome/capacitor-file-picker`)"
- "CapgoCapacitorUpdater (from `../../../../node_modules/.pnpm/@[email protected].4_@[email protected]/node_modules/@capgo/capacitor-updater`)"
- "CapgoCapacitorUpdater (from `../../../../node_modules/.pnpm/@[email protected].5_@[email protected]/node_modules/@capgo/capacitor-updater`)"

SPEC REPOS:
trunk:
- Alamofire
- SQLCipher
- SSZipArchive
- SwiftyRSA
- Version
- ZIPFoundation

Expand Down Expand Up @@ -98,7 +93,7 @@ EXTERNAL SOURCES:
CapawesomeCapacitorFilePicker:
:path: "../../../../node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@capawesome/capacitor-file-picker"
CapgoCapacitorUpdater:
:path: "../../../../node_modules/.pnpm/@[email protected].4_@[email protected]/node_modules/@capgo/capacitor-updater"
:path: "../../../../node_modules/.pnpm/@[email protected].5_@[email protected]/node_modules/@capgo/capacitor-updater"

SPEC CHECKSUMS:
Alamofire: f36a35757af4587d8e4f4bfa223ad10be2422b8c
Expand All @@ -115,13 +110,12 @@ SPEC CHECKSUMS:
CapacitorStatusBar: b81d4fb5d4e0064c712018071b3ab4b810b39a63
CapawesomeCapacitorAppUpdate: 3c05b5c8e42f9c6a88d666093406e9336d9bfdb1
CapawesomeCapacitorFilePicker: c80c30759ba48986ff34a2b51b23ac2babfd3774
CapgoCapacitorUpdater: 96ddeff53957d088973ab80fff635cf560fab7a0
CapgoCapacitorUpdater: 5cf2afb1f57842d2075a7f114e9de447e132298f
SQLCipher: 30a8e81afa6128e600b17ffa77d0f92fa05ed208
SSZipArchive: fe6a26b2a54d5a0890f2567b5cc6de5caa600aef
SwiftyRSA: 8c6dd1ea7db1b8dc4fb517a202f88bb1354bc2c6
Version: de5907f2c5d0f3cf21708db7801d1d5401139486
ZIPFoundation: b8c29ea7ae353b309bc810586181fd073cb3312c

PODFILE CHECKSUM: 74611ffb56453c4d546e84626f0f58154d558c34
PODFILE CHECKSUM: b9fa90a1accb2442067420f77c64ce80a75e2ce6

COCOAPODS: 1.15.2
2 changes: 0 additions & 2 deletions apps/whattheduck/src/stores/wtdcollection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ export const wtdcollection = defineStore('wtdcollection', () => {
const {
createPurchase,
findInCollection,
fetchPublicationNames,
isLoadingSuggestions,
loadCollection,
loadPurchases,
Expand Down Expand Up @@ -65,7 +64,6 @@ export const wtdcollection = defineStore('wtdcollection', () => {
await loadPurchases(force);
await loadUser(force);
await coaStore.fetchCountryNames(true);
coaStore.addPublicationNames(await fetchPublicationNames());
await usersStore.fetchStats([webCollectionStore.user?.id || 0], force);
// TODO retrieve user notification countries

Expand Down
24 changes: 5 additions & 19 deletions packages/api/services/collection/issues/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,26 +67,7 @@ const getCoaCountByCountrycode = (collectionCountrycodes: string[]) =>
),
);

export const getCollectionCountrycodes = (issues: issue[]) => [
...new Set(
getCollectionPublicationcodes(issues).map(
(publicationcode) => publicationcode.split("/")[0],
),
),
];

export const getCollectionPublicationcodes = (issues: issue[]) => [
...new Set(issues.map(({ publicationcode }) => publicationcode!)),
];

export default (socket: Socket<Events>) => {
socket.on("getPublicationTitles", async (callback) =>
getPublicationTitles({
publicationcode: {
in: await getCollectionPublicationcodes(socket.data.user!.id),
},
}).then(callback),
);
socket.on("getIssues", async (callback) => {
if (socket.data.user!.username === "demo") {
await resetDemo();
Expand Down Expand Up @@ -127,6 +108,11 @@ export default (socket: Socket<Events>) => {
countByPublicationcode: await getCoaCountByPublicationcode(
collectionPublicationcodes,
),
publicationNames: await getPublicationTitles({
publicationcode: {
in: collectionPublicationcodes,
},
})
};
})
.then(callback);
Expand Down
11 changes: 6 additions & 5 deletions packages/api/services/collection/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,12 @@ export default abstract class {
) => void;

abstract getIssues: (
callback: (data: {countByCountrycode: Record<string, number>, countByPublicationcode: Record<string, number>, issues: AugmentedIssue<issue & { issuecode: string }>[]}) => void,
callback: (data: {
countByCountrycode: Record<string, number>,
countByPublicationcode: Record<string, number>,
publicationNames: Record<string, string>,
issues: AugmentedIssue<issue & { issuecode: string }>[]
}) => void,
) => void;
abstract addOrChangeIssues: (
data: CollectionUpdateMultipleIssues,
Expand All @@ -57,10 +62,6 @@ export default abstract class {
callback: (data: TransactionResults) => void,
) => void;

abstract getPublicationTitles: (
callback: (value: Record<string, string>) => void,
) => void;

abstract createRequests: (
issueIds: number[],
callback: (
Expand Down

0 comments on commit 83073a8

Please sign in to comment.