-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from allanhvam/dev
lists crud
- Loading branch information
Showing
16 changed files
with
318 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { Utils } from "../Utils.js"; | ||
import type { File } from "../types/File.js"; | ||
|
||
/** | ||
* @internal | ||
*/ | ||
export class FileMock { | ||
constructor(private files?: Array<File>, private file?: File) { | ||
} | ||
|
||
get = async () => { | ||
if (!this.file) { | ||
return new Response(undefined, { status: 404 }); | ||
} | ||
|
||
const f = Utils.upperCaseKeys(this.file); | ||
delete f.Content; | ||
f.Exists = true; | ||
|
||
return new Response( | ||
JSON.stringify(f), | ||
{ status: 200 }, | ||
); | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import type { File } from '../types/File.js'; | ||
import { FileMock } from './FileMock.js'; | ||
|
||
/** | ||
* @internal | ||
*/ | ||
export class FilesMock { | ||
constructor(private files?: Array<File>) { | ||
} | ||
|
||
get = async () => { | ||
if (!this.files) { | ||
return new Response(undefined, { status: 404 }); | ||
} | ||
|
||
const mocks = this.files.map(file => new FileMock(this.files, file)); | ||
const infos = new Array<any>(); | ||
for (let i = 0; i !== mocks.length; i++) { | ||
const list = await mocks[i].get(); | ||
infos.push(await list.json()); | ||
} | ||
|
||
return new Response( | ||
JSON.stringify(infos), | ||
{ status: 200 }, | ||
); | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.