Skip to content

Commit

Permalink
fix: list uploads should return source cid
Browse files Browse the repository at this point in the history
  • Loading branch information
vasco-santos committed Apr 25, 2022
1 parent 4da1a7d commit 6147b17
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 58 deletions.
1 change: 1 addition & 0 deletions packages/db/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const uploadQuery = `
_id:id::text,
type,
name,
sourceCid:source_cid,
created:inserted_at,
updated:updated_at,
content(cid, dagSize:dag_size, pins:pin(status, updated:updated_at, location:pin_location(_id:id, peerId:peer_id, peerName:peer_name, ipfsPeerId:ipfs_peer_id, region)))
Expand Down
136 changes: 78 additions & 58 deletions packages/db/postgres/pg-rest-api-types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1489,13 +1489,13 @@ export interface paths {
};
};
};
"/rpc/user_auth_keys_list": {
"/rpc/upsert_pins": {
post: {
parameters: {
body: {
args: {
/** Format: bigint */
query_user_id: number;
/** Format: json */
data: string;
};
};
header: {
Expand All @@ -1509,14 +1509,11 @@ export interface paths {
};
};
};
"/rpc/create_psa_pin_request": {
"/rpc/uuid_ns_url": {
post: {
parameters: {
body: {
args: {
/** Format: json */
data: string;
};
args: { [key: string]: unknown };
};
header: {
/** Preference */
Expand All @@ -1529,14 +1526,11 @@ export interface paths {
};
};
};
"/rpc/user_used_storage": {
"/rpc/pgrst_watch": {
post: {
parameters: {
body: {
args: {
/** Format: bigint */
query_user_id: number;
};
args: { [key: string]: unknown };
};
header: {
/** Preference */
Expand All @@ -1549,14 +1543,11 @@ export interface paths {
};
};
};
"/rpc/json_arr_to_json_element_array": {
"/rpc/uuid_nil": {
post: {
parameters: {
body: {
args: {
/** Format: json */
_json: string;
};
args: { [key: string]: unknown };
};
header: {
/** Preference */
Expand All @@ -1569,14 +1560,11 @@ export interface paths {
};
};
};
"/rpc/create_key": {
"/rpc/uuid_generate_v1": {
post: {
parameters: {
body: {
args: {
/** Format: json */
data: string;
};
args: { [key: string]: unknown };
};
header: {
/** Preference */
Expand All @@ -1589,13 +1577,13 @@ export interface paths {
};
};
};
"/rpc/json_arr_to_text_arr": {
"/rpc/create_content": {
post: {
parameters: {
body: {
args: {
/** Format: json */
_json: string;
data: string;
};
};
header: {
Expand All @@ -1609,7 +1597,7 @@ export interface paths {
};
};
};
"/rpc/uuid_generate_v1mc": {
"/rpc/uuid_ns_oid": {
post: {
parameters: {
body: {
Expand All @@ -1626,11 +1614,14 @@ export interface paths {
};
};
};
"/rpc/uuid_generate_v1": {
"/rpc/user_auth_keys_list": {
post: {
parameters: {
body: {
args: { [key: string]: unknown };
args: {
/** Format: bigint */
query_user_id: number;
};
};
header: {
/** Preference */
Expand All @@ -1643,11 +1634,14 @@ export interface paths {
};
};
};
"/rpc/uuid_generate_v4": {
"/rpc/find_deals_by_content_cids": {
post: {
parameters: {
body: {
args: { [key: string]: unknown };
args: {
/** Format: text[] */
cids: string;
};
};
header: {
/** Preference */
Expand All @@ -1660,13 +1654,15 @@ export interface paths {
};
};
};
"/rpc/create_upload": {
"/rpc/uuid_generate_v5": {
post: {
parameters: {
body: {
args: {
/** Format: json */
data: string;
/** Format: uuid */
namespace: string;
/** Format: text */
name: string;
};
};
header: {
Expand Down Expand Up @@ -1700,14 +1696,11 @@ export interface paths {
};
};
};
"/rpc/find_deals_by_content_cids": {
"/rpc/uuid_ns_x500": {
post: {
parameters: {
body: {
args: {
/** Format: text[] */
cids: string;
};
args: { [key: string]: unknown };
};
header: {
/** Preference */
Expand All @@ -1720,13 +1713,13 @@ export interface paths {
};
};
};
"/rpc/publish_name_record": {
"/rpc/json_arr_to_text_arr": {
post: {
parameters: {
body: {
args: {
/** Format: json */
data: string;
_json: string;
};
};
header: {
Expand All @@ -1740,11 +1733,14 @@ export interface paths {
};
};
};
"/rpc/uuid_ns_url": {
"/rpc/publish_name_record": {
post: {
parameters: {
body: {
args: { [key: string]: unknown };
args: {
/** Format: json */
data: string;
};
};
header: {
/** Preference */
Expand All @@ -1757,15 +1753,15 @@ export interface paths {
};
};
};
"/rpc/uuid_generate_v5": {
"/rpc/uuid_generate_v3": {
post: {
parameters: {
body: {
args: {
/** Format: text */
name: string;
/** Format: uuid */
namespace: string;
/** Format: text */
name: string;
};
};
header: {
Expand All @@ -1779,7 +1775,7 @@ export interface paths {
};
};
};
"/rpc/create_content": {
"/rpc/create_key": {
post: {
parameters: {
body: {
Expand All @@ -1799,7 +1795,7 @@ export interface paths {
};
};
};
"/rpc/uuid_ns_oid": {
"/rpc/uuid_generate_v4": {
post: {
parameters: {
body: {
Expand All @@ -1816,7 +1812,7 @@ export interface paths {
};
};
};
"/rpc/pgrst_watch": {
"/rpc/uuid_ns_dns": {
post: {
parameters: {
body: {
Expand All @@ -1833,11 +1829,14 @@ export interface paths {
};
};
};
"/rpc/uuid_ns_x500": {
"/rpc/json_arr_to_json_element_array": {
post: {
parameters: {
body: {
args: { [key: string]: unknown };
args: {
/** Format: json */
_json: string;
};
};
header: {
/** Preference */
Expand All @@ -1850,11 +1849,14 @@ export interface paths {
};
};
};
"/rpc/uuid_nil": {
"/rpc/create_psa_pin_request": {
post: {
parameters: {
body: {
args: { [key: string]: unknown };
args: {
/** Format: json */
data: string;
};
};
header: {
/** Preference */
Expand All @@ -1867,7 +1869,27 @@ export interface paths {
};
};
};
"/rpc/uuid_ns_dns": {
"/rpc/user_used_storage": {
post: {
parameters: {
body: {
args: {
/** Format: bigint */
query_user_id: number;
};
};
header: {
/** Preference */
Prefer?: parameters["preferParams"];
};
};
responses: {
/** OK */
200: unknown;
};
};
};
"/rpc/uuid_generate_v1mc": {
post: {
parameters: {
body: {
Expand All @@ -1884,15 +1906,13 @@ export interface paths {
};
};
};
"/rpc/uuid_generate_v3": {
"/rpc/create_upload": {
post: {
parameters: {
body: {
args: {
/** Format: text */
name: string;
/** Format: uuid */
namespace: string;
/** Format: json */
data: string;
};
};
header: {
Expand Down
1 change: 1 addition & 0 deletions packages/db/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export function normalizeUpload (upload) {
return {
...nUpload,
...upload.content,
cid: upload.sourceCid, // Overwrite cid to source cid
pins: normalizePins(upload.content.pins, {
isOkStatuses: true
})
Expand Down

0 comments on commit 6147b17

Please sign in to comment.