@rowengine/common 1.1.16 → 1.1.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/utils/gc.d.ts +1 -0
- package/build/utils/gc.js +10 -1
- package/package.json +1 -1
package/build/utils/gc.d.ts
CHANGED
|
@@ -15,3 +15,4 @@ export interface FileToUpload {
|
|
|
15
15
|
gcsPath: string;
|
|
16
16
|
}
|
|
17
17
|
export declare const uploadFilesToProjectInGCS: (projectId: string, files: FileToUpload[]) => Promise<void>;
|
|
18
|
+
export declare const getCompanyLogo: (companyId: string) => Promise<import("@google-cloud/storage").File | null>;
|
package/build/utils/gc.js
CHANGED
|
@@ -12,7 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.uploadFilesToProjectInGCS = exports.deleteProjectFromGCS = exports.getFileFromProjectFieldInGCS = exports.getFileFromProjectInGCS = exports.getTileFromProjectInGCS = exports.downloadProjectFileFromGCS = exports.getFilesFromGCSFolder = void 0;
|
|
15
|
+
exports.getCompanyLogo = exports.uploadFilesToProjectInGCS = exports.deleteProjectFromGCS = exports.getFileFromProjectFieldInGCS = exports.getFileFromProjectInGCS = exports.getTileFromProjectInGCS = exports.downloadProjectFileFromGCS = exports.getFilesFromGCSFolder = void 0;
|
|
16
16
|
exports.uploadFileToGCS = uploadFileToGCS;
|
|
17
17
|
exports.uploadFolderToGCS = uploadFolderToGCS;
|
|
18
18
|
const promises_1 = __importDefault(require("fs/promises"));
|
|
@@ -125,3 +125,12 @@ const uploadFilesToProjectInGCS = (projectId, files) => __awaiter(void 0, void 0
|
|
|
125
125
|
yield Promise.all(files.map(({ localFilePath, gcsPath }) => limit(() => uploadFileToGCS(localFilePath, `projects/${projectId}/${gcsPath}`, fs_1.default.statSync(localFilePath).size))));
|
|
126
126
|
});
|
|
127
127
|
exports.uploadFilesToProjectInGCS = uploadFilesToProjectInGCS;
|
|
128
|
+
const getCompanyLogo = (companyId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
129
|
+
const logoPath = `companies/${companyId}.png`;
|
|
130
|
+
const gcFile = gc_storage_1.default.file(logoPath);
|
|
131
|
+
const [fileExists] = yield gcFile.exists();
|
|
132
|
+
if (!fileExists)
|
|
133
|
+
return null;
|
|
134
|
+
return gcFile;
|
|
135
|
+
});
|
|
136
|
+
exports.getCompanyLogo = getCompanyLogo;
|