-
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.
feat: enable to return sections from Chapter API (#79)
- Loading branch information
1 parent
d0508e4
commit d0c39c4
Showing
50 changed files
with
1,132 additions
and
128 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
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,35 @@ | ||
post: | ||
tags: | ||
- Papers | ||
operationId: papers-sectionalize | ||
summary: Sectionalize paper | ||
requestBody: | ||
content: | ||
application/json: | ||
schema: | ||
$ref: ../../schemas/interface/papers/sectionalize/PaperSectionalizeRequest.yaml | ||
responses: | ||
"200": | ||
description: OK - Returns sectionalized paper | ||
content: | ||
application/json: | ||
schema: | ||
$ref: ../../schemas/interface/papers/sectionalize/PaperSectionalizeResponse.yaml | ||
"400": | ||
description: Bad Request - Invalid request | ||
content: | ||
application/json: | ||
schema: | ||
$ref: ../../schemas/interface/papers/sectionalize/PaperSectionalizeErrorResponse.yaml | ||
"404": | ||
description: Not Found - Paper not found or not authorized | ||
content: | ||
application/json: | ||
schema: | ||
$ref: ../../schemas/interface/papers/sectionalize/PaperSectionalizeErrorResponse.yaml | ||
"500": | ||
description: Internal Server Error - Server error | ||
content: | ||
application/json: | ||
schema: | ||
$ref: ../../schemas/interface/app/ApplicationErrorResponse.yaml |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
type: object | ||
description: Paper object with only ID | ||
properties: | ||
id: | ||
type: string | ||
description: Auto-generated paper ID | ||
example: 123e4567-e89b-12d3-a456-426614174000 | ||
required: | ||
- id |
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,7 @@ | ||
type: object | ||
description: Error Message for PaperOnlyId object | ||
properties: | ||
id: | ||
type: string | ||
description: Error message for paper ID | ||
example: "paper id is required, but got ''" |
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
11 changes: 11 additions & 0 deletions
11
docs/openapi/schemas/entity/section/SectionWithoutAutofield.yaml
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,11 @@ | ||
type: object | ||
description: Section object without auto-generated fields | ||
properties: | ||
name: | ||
type: string | ||
maxLength: 100 | ||
description: Section name | ||
example: Overview | ||
required: | ||
- name | ||
- content |
7 changes: 7 additions & 0 deletions
7
docs/openapi/schemas/entity/section/SectionWithoutAutofieldError.yaml
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,7 @@ | ||
type: object | ||
description: Error Message for SectionWithoutAutofield object | ||
properties: | ||
name: | ||
type: string | ||
description: Error message for section name | ||
example: section name is required, but got '' |
13 changes: 13 additions & 0 deletions
13
docs/openapi/schemas/interface/papers/sectionalize/PaperSectionalizeErrorResponse.yaml
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,13 @@ | ||
type: object | ||
description: Error Response Body for Paper Sectionalize API | ||
properties: | ||
user: | ||
$ref: ../../../entity/user/UserOnlyIdError.yaml | ||
project: | ||
$ref: ../../../entity/project/ProjectOnlyIdError.yaml | ||
paper: | ||
$ref: ../../../entity/paper/PaperOnlyIdError.yaml | ||
sections: | ||
type: array | ||
items: | ||
$ref: ../../../entity/section/SectionWithoutAutofieldError.yaml |
18 changes: 18 additions & 0 deletions
18
docs/openapi/schemas/interface/papers/sectionalize/PaperSectionalizeRequest.yaml
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,18 @@ | ||
type: object | ||
description: Request Body for Paper Sectionalize API | ||
properties: | ||
user: | ||
$ref: ../../../entity/user/UserOnlyId.yaml | ||
project: | ||
$ref: ../../../entity/project/ProjectOnlyId.yaml | ||
paper: | ||
$ref: ../../../entity/paper/PaperOnlyId.yaml | ||
sections: | ||
type: array | ||
items: | ||
$ref: ../../../entity/section/SectionWithoutAutofield.yaml | ||
required: | ||
- user | ||
- project | ||
- paper | ||
- sections |
9 changes: 9 additions & 0 deletions
9
docs/openapi/schemas/interface/papers/sectionalize/PaperSectionalizeResponse.yaml
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,9 @@ | ||
type: object | ||
description: Response Body for Paper Sectionalize API | ||
properties: | ||
sections: | ||
type: array | ||
items: | ||
$ref: ../../../entity/section/Section.yaml | ||
required: | ||
- sections |
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
Binary file modified
BIN
+0 Bytes
(100%)
fixtures/firestore_export/all_namespaces/all_kinds/all_namespaces_all_kinds.export_metadata
Binary file not shown.
Binary file modified
BIN
+596 Bytes
(110%)
fixtures/firestore_export/all_namespaces/all_kinds/output-0
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
fixtures/firestore_export/firestore_export.overall_export_metadata
Binary file not shown.
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
12 changes: 0 additions & 12 deletions
12
internal/document/document_project_with_chapter_ids_values.go
This file was deleted.
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,38 @@ | ||
package domain | ||
|
||
type SectionEntity struct { | ||
id SectionIdObject | ||
name SectionNameObject | ||
createdAt CreatedAtObject | ||
updatedAt UpdatedAtObject | ||
} | ||
|
||
func NewSectionEntity( | ||
id SectionIdObject, | ||
name SectionNameObject, | ||
createdAt CreatedAtObject, | ||
updatedAt UpdatedAtObject, | ||
) *SectionEntity { | ||
return &SectionEntity{ | ||
id: id, | ||
name: name, | ||
createdAt: createdAt, | ||
updatedAt: updatedAt, | ||
} | ||
} | ||
|
||
func (e *SectionEntity) Id() *SectionIdObject { | ||
return &e.id | ||
} | ||
|
||
func (e *SectionEntity) Name() *SectionNameObject { | ||
return &e.name | ||
} | ||
|
||
func (e *SectionEntity) CreatedAt() *CreatedAtObject { | ||
return &e.createdAt | ||
} | ||
|
||
func (e *SectionEntity) UpdatedAt() *UpdatedAtObject { | ||
return &e.updatedAt | ||
} |
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,18 @@ | ||
package domain | ||
|
||
import "fmt" | ||
|
||
type SectionIdObject struct { | ||
value string | ||
} | ||
|
||
func NewSectionIdObject(sectionId string) (*SectionIdObject, error) { | ||
if sectionId == "" { | ||
return nil, fmt.Errorf("section id is required, but got '%v'", sectionId) | ||
} | ||
return &SectionIdObject{value: sectionId}, nil | ||
} | ||
|
||
func (o *SectionIdObject) Value() string { | ||
return o.value | ||
} |
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,21 @@ | ||
package domain | ||
|
||
import "fmt" | ||
|
||
type SectionNameObject struct { | ||
value string | ||
} | ||
|
||
func NewSectionNameObject(name string) (*SectionNameObject, error) { | ||
if name == "" { | ||
return nil, fmt.Errorf("section name is required, but got '%v'", name) | ||
} | ||
if len(name) > 100 { | ||
return nil, fmt.Errorf("section name cannot be longer than 100 characters, but got '%v'", name) | ||
} | ||
return &SectionNameObject{value: name}, nil | ||
} | ||
|
||
func (o *SectionNameObject) Value() string { | ||
return o.value | ||
} |
Oops, something went wrong.