Skip to content

Commit

Permalink
fix: refactoring and bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
vighnesh153 committed Nov 9, 2024
1 parent 7afb8c6 commit 400fb45
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 25 deletions.
16 changes: 8 additions & 8 deletions tools-nodejs/api-vighnesh153/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions tools-nodejs/api-vighnesh153/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
"@types/aws-lambda": "^8.10.145",
"@types/cookie": "^0.6.0",
"@types/node": "*",
"@vighnesh153/tools": "npm:@jsr/vighnesh153__tools@^0.1.12",
"@vighnesh153/tools-server": "npm:@jsr/vighnesh153__tools-server@^0.1.4",
"@vighnesh153/tools": "npm:@jsr/vighnesh153__tools@^0.1.13",
"@vighnesh153/tools-server": "npm:@jsr/vighnesh153__tools-server@^0.1.5",
"@vighnesh153/tsconfig": "0.4.8",
"cookie": "^1.0.1",
"sst": "^3.2.70",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import type {
DynamoTypeMap,
TableMetadata,
} from "@vighnesh153/tools-server/aws_dynamodb";
import type { DynamoTypeMap } from "@vighnesh153/tools-server/aws_dynamodb";

export const userInfoFields = /* @__PURE__ */ {
userId: "string",
Expand All @@ -11,19 +8,13 @@ export const userInfoFields = /* @__PURE__ */ {
createdAtMillis: "number",
} satisfies Record<string, keyof DynamoTypeMap>;

export const UserInfoTableMetadata = /* @__PURE__ */ {
fields: userInfoFields,
} satisfies Partial<TableMetadata>;

export const filesMetadataFields = /* @__PURE__ */ {
fileId: "string",
filePath: "string",
mimeType: "string",
fileSizeInBytes: "number",
createdAtMillis: "number",
createdBy: "string",
// whether the file is uploaded at this filePath
isUploaded: "boolean",
} satisfies Record<string, keyof DynamoTypeMap>;

export const FilesMetadataTableMetadata = /* @__PURE__ */ {
fields: filesMetadataFields,
} satisfies Partial<TableMetadata>;
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ export async function controller({
const fileExtension = file.fileExtension.length > 0
? `.${file.fileExtension}`
: "";
const filePath = `/${mediaType}/id${fileExtension}`;
const filePath = `/${mediaType}/${id}${fileExtension}`;
return {
clientSideId: file.clientSideId,
fileId: id,
Expand Down Expand Up @@ -226,6 +226,7 @@ export async function controller({
createdBy: metadata.createdBy,
createdAtMillis: metadata.createdAtMillis,
fileSizeInBytes: metadata.fileSizeInBytes,
isUploaded: false,
})),
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ import { FakeDynamoDBTable } from "@vighnesh153/tools-server/aws_dynamodb";

import { controller } from "./controller.ts";
import { FakeUserInfoDecoder } from "../common/user_info_decoder.ts";
import { UserInfoTableMetadata } from "../common/dynamo_db_table_metadata.ts";
import { userInfoFields } from "../common/dynamo_db_table_metadata.ts";
import { FakeCookieSerializer } from "../common/cookie_serializer.ts";

let fakeUserInfoDecoder: FakeUserInfoDecoder;
let fakeUserInfoTable: FakeDynamoDBTable<{
fields: (typeof UserInfoTableMetadata)["fields"];
fields: typeof userInfoFields;
tableName: "fake-user-info";
}>;
let fakeCookieSerializer: FakeCookieSerializer;
Expand Down

0 comments on commit 400fb45

Please sign in to comment.