tangled
alpha
login
or
join now
t1c.dev
/
rocksky
forked from
rocksky.app/rocksky
2
fork
atom
A decentralized music tracking and discovery platform built on AT Protocol 🎵
2
fork
atom
overview
issues
pulls
pipelines
[api] add return types
tsiry-sandratraina.com
8 months ago
588ea8c9
808446e7
+85
-5
2 changed files
expand all
collapse all
unified
split
apps
api
src
xrpc
app
rocksky
dropbox
getFiles.ts
googledrive
getFiles.ts
+57
-3
apps/api/src/xrpc/app/rocksky/dropbox/getFiles.ts
···
42
42
params: QueryParams;
43
43
ctx: Context;
44
44
did: string;
45
45
-
}) => {
45
45
+
}): Effect.Effect<[Directories, Files], Error> => {
46
46
return Effect.tryPromise({
47
47
try: async () => {
48
48
const parentDirAlias = alias(tables.dropboxDirectories, "parent_dir");
···
111
111
});
112
112
};
113
113
114
114
-
const presentation = (data) => {
114
114
+
const presentation = (
115
115
+
data: [Directories, Files]
116
116
+
): Effect.Effect<any, never> => {
115
117
return Effect.sync(() => ({
116
118
directory: R.omit(
117
119
["createdAt", "updatedAt", "xataVersion"],
118
120
_.get(data, "0.0.parent", null) || _.get(data, "1.0.parent", null)
119
121
),
120
122
parentDirectory: R.omit(
121
121
-
["createdAt", "updatedAt"],
123
123
+
["createdAt", "updatedAt", "xataVersion"],
122
124
_.get(data, "0.0.parent_dir", null) || _.get(data, "1.0.parent_dir", null)
123
125
),
124
126
directories: data[0].map((item) => ({
···
141
143
})),
142
144
}));
143
145
};
146
146
+
147
147
+
type Directories = {
148
148
+
dropbox_directories: {
149
149
+
id: string;
150
150
+
name: string;
151
151
+
fileId: string;
152
152
+
path: string;
153
153
+
parentId: string;
154
154
+
createdAt: Date;
155
155
+
updatedAt: Date;
156
156
+
};
157
157
+
parent?: {
158
158
+
id: string;
159
159
+
name: string;
160
160
+
fileId: string;
161
161
+
dropboxId: string;
162
162
+
path: string;
163
163
+
};
164
164
+
parent_dir?: {
165
165
+
id: string;
166
166
+
name: string;
167
167
+
fileId: string;
168
168
+
dropboxId: string;
169
169
+
path: string;
170
170
+
};
171
171
+
}[];
172
172
+
173
173
+
type Files = {
174
174
+
dropbox_paths: {
175
175
+
id: string;
176
176
+
name: string;
177
177
+
fileId: string;
178
178
+
directoryId: string;
179
179
+
trackId?: string;
180
180
+
createdAt: Date;
181
181
+
updatedAt: Date;
182
182
+
};
183
183
+
parent?: {
184
184
+
id: string;
185
185
+
name: string;
186
186
+
fileId: string;
187
187
+
dropboxId: string;
188
188
+
path: string;
189
189
+
};
190
190
+
parent_dir?: {
191
191
+
id: string;
192
192
+
name: string;
193
193
+
fileId: string;
194
194
+
dropboxId: string;
195
195
+
path: string;
196
196
+
};
197
197
+
}[];
+28
-2
apps/api/src/xrpc/app/rocksky/googledrive/getFiles.ts
···
41
41
params: QueryParams;
42
42
ctx: Context;
43
43
did: string;
44
44
-
}) => {
44
44
+
}): Effect.Effect<[Directories, Files], Error> => {
45
45
return Effect.tryPromise({
46
46
try: async () => {
47
47
const parentDirAlias = alias(tables.googleDriveDirectories, "parent_dir");
···
119
119
});
120
120
};
121
121
122
122
-
const presentation = (data) => {
122
122
+
const presentation = (
123
123
+
data: [Directories, Files]
124
124
+
): Effect.Effect<any, never> => {
123
125
return Effect.sync(() => ({
124
126
directory: R.omit(
125
127
["createdAt", "updatedAt", "xataVersion"],
···
149
151
})),
150
152
}));
151
153
};
154
154
+
155
155
+
type Directories = {
156
156
+
google_drive_directories: {
157
157
+
id: string;
158
158
+
name: string;
159
159
+
fileId: string;
160
160
+
path: string;
161
161
+
parentId: string;
162
162
+
createdAt: Date;
163
163
+
updatedAt: Date;
164
164
+
};
165
165
+
}[];
166
166
+
167
167
+
type Files = {
168
168
+
google_drive_paths: {
169
169
+
id: string;
170
170
+
name: string;
171
171
+
fileId: string;
172
172
+
directoryId: string;
173
173
+
trackId?: string;
174
174
+
createdAt: Date;
175
175
+
updatedAt: Date;
176
176
+
};
177
177
+
}[];