Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
Backend-MECRED
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
MECRED
Backend-MECRED
Commits
e0d91847
Commit
e0d91847
authored
3 months ago
by
mcs22
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#52
: create route publish resource
parent
3daa3c85
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/db/schema/resource.schema.ts
+3
-3
3 additions, 3 deletions
src/db/schema/resource.schema.ts
src/db/schema/resourceEnum.schema.ts
+8
-0
8 additions, 0 deletions
src/db/schema/resourceEnum.schema.ts
src/routes/s3.route.ts
+1
-0
1 addition, 0 deletions
src/routes/s3.route.ts
with
12 additions
and
3 deletions
src/db/schema/resource.schema.ts
+
3
−
3
View file @
e0d91847
...
...
@@ -17,18 +17,18 @@ import userTable from './user.schema'
import
objectTypeTable
from
'
./object-type.schema
'
import
licenseTable
from
'
./license.schema
'
import
resourceStatsTable
from
'
./resource-stats.schema
'
import
resourceEnum
from
'
./resourceEnum.schema
'
//por padrao active é false, só é true quando o recurso é aprovado
const
resourceTable
=
pgTable
(
'
resources
'
,
{
id
:
serial
(
'
id
'
).
primaryKey
()
.
notNull
()
.
unique
(),
state
:
resourceEnum
(
'
state
'
).
notNull
().
default
(
'
draft
'
),
name
:
varchar
(
'
name
'
,
{
length
:
255
})
.
notNull
(),
author
:
varchar
(
'
author
'
,
{
length
:
255
})
.
notNull
(),
bucket_key
:
varchar
(
'
bucket_key
'
,
{
length
:
255
})
.
unique
(),
link
:
varchar
(
'
link
'
,
{
length
:
255
}),
thumbnail
:
varchar
(
'
thumbnail
'
,
{
length
:
255
})
.
notNull
(),
...
...
This diff is collapsed.
Click to expand it.
src/db/schema/resourceEnum.schema.ts
0 → 100644
+
8
−
0
View file @
e0d91847
import
{
pgEnum
}
from
"
drizzle-orm/pg-core
"
;
import
{
z
}
from
"
zod
"
;
const
resourceEnum
=
pgEnum
(
'
state
'
,[
'
draft
'
,
'
submitted
'
,
'
accepted
'
])
const
resourceEnumSchema
=
z
.
enum
(
resourceEnum
.
enumValues
)
export
default
resourceEnum
export
type
ResourceEnum
=
z
.
infer
<
typeof
resourceEnumSchema
>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/routes/s3.route.ts
+
1
−
0
View file @
e0d91847
...
...
@@ -242,6 +242,7 @@ export const s3Routes = new Hono()
// O corpo da resposta é o arquivo, e seu tipo de conteúdo pode ser acessado diretamente
const
fileData
=
await
response
.
Body
.
transformToByteArray
()
// Converte o conteúdo do corpo para ArrayBuffer ou outro formato adequado
return
new
Response
(
fileData
,
{
status
:
200
,
headers
:
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment