-
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 branch '22-odpc-minimaal-document-in-publicatieformulier' of ht…
…tps://github.com/GeneriekPublicatiePlatformWoo/Openbaar-Documenten-Publicatie-Component into 22-odpc-minimaal-document-in-publicatieformulier
- Loading branch information
Showing
9 changed files
with
182 additions
and
0 deletions.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
ODPC.Server/Features/Documenten/DocumentDetail/DocumentDetailController.cs
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,16 @@ | ||
using Microsoft.AspNetCore.Mvc; | ||
|
||
namespace ODPC.Features.Documenten.DocumentDetail | ||
{ | ||
[ApiController] | ||
public class DocumentDetailController: ControllerBase | ||
{ | ||
[HttpGet("api/v1/documenten/{uuid:guid}")] | ||
public IActionResult Get(Guid uuid) | ||
{ | ||
return DocumentenMock.Documenten.TryGetValue(uuid, out var document) | ||
? Ok(document) | ||
: NotFound(); | ||
} | ||
} | ||
} |
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,24 @@ | ||
using ODPC.Features.Publicaties; | ||
|
||
namespace ODPC.Features.Documenten | ||
{ | ||
public static class DocumentenMock | ||
{ | ||
public static readonly Dictionary<Guid, PublicatieDocument> Documenten = new PublicatieDocument[] | ||
{ | ||
new() | ||
{ | ||
Uuid = Guid.NewGuid(), | ||
Publicatie = PublicatiesMock.Publicaties.Keys.First(), | ||
OfficieleTitel = "Belangrijk document", | ||
VerkorteTitel = "Document", | ||
Omschrijving = "", | ||
Creatiedatum = new DateOnly(2024, 09, 23), | ||
Bestandsformaat = "DOCX", | ||
Bestandsnaam = "belangrijk.docx", | ||
Bestandsomvang = 100000 | ||
} | ||
} | ||
.ToDictionary(x => x.Uuid); | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
ODPC.Server/Features/Documenten/DocumentenOverzicht/DocumentenOverzichtController.cs
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 @@ | ||
using Microsoft.AspNetCore.Mvc; | ||
|
||
namespace ODPC.Features.Documenten.DocumentenOverzicht | ||
{ | ||
[ApiController] | ||
public class DocumentenOverzichtController : ControllerBase | ||
{ | ||
[HttpGet("api/v1/documenten")] | ||
public IActionResult Get([FromQuery] Guid publicatie) | ||
{ | ||
var documenten = DocumentenMock.Documenten.Values | ||
.Where(x=> x.Publicatie == publicatie) | ||
.ToList(); | ||
|
||
return Ok(documenten); | ||
} | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
ODPC.Server/Features/Documenten/InitialiseerDocument/InitialiseerDocumentController.cs
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,36 @@ | ||
using Microsoft.AspNetCore.Mvc; | ||
|
||
namespace ODPC.Features.Documenten.InitialiseerDocument | ||
{ | ||
[ApiController] | ||
public class InitialiseerDocumentController : ControllerBase | ||
{ | ||
[HttpPost("api/v1/documenten")] | ||
public IActionResult Post(PublicatieDocument document) | ||
{ | ||
document.Uuid = Guid.NewGuid(); | ||
var halve = document.Bestandsomvang / 2; | ||
var firstSize = Math.Ceiling(halve); | ||
var secondSize = Math.Floor(halve); | ||
|
||
document.Bestandsdelen = | ||
[ | ||
new() | ||
{ | ||
Omvang = firstSize, | ||
Url = $"/api/v1/{document.Uuid}/1", | ||
Volgnummer = 0 | ||
}, | ||
new() | ||
{ | ||
Omvang = secondSize, | ||
Url = $"/api/v1/{document.Uuid}/2", | ||
Volgnummer = 1 | ||
} | ||
]; | ||
|
||
DocumentenMock.Documenten[document.Uuid] = document; | ||
return Ok(document); | ||
} | ||
} | ||
} |
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,23 @@ | ||
namespace ODPC.Features.Documenten | ||
{ | ||
public class PublicatieDocument | ||
{ | ||
public Guid Uuid { get; set; } | ||
public Guid Publicatie { get; set; } | ||
public required string OfficieleTitel { get; set; } | ||
public string? VerkorteTitel { get; set; } | ||
public string? Omschrijving { get; set; } | ||
public DateOnly Creatiedatum { get; set; } | ||
public required string Bestandsnaam { get; set; } | ||
public required string Bestandsformaat { get; set; } | ||
public required double Bestandsomvang { get; set; } | ||
public List<Bestandsdeel>? Bestandsdelen { get; set; } | ||
} | ||
|
||
public class Bestandsdeel | ||
{ | ||
public required string Url { get; set; } | ||
public required int Volgnummer { get; set; } | ||
public required double Omvang { get; set; } | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
ODPC.Server/Features/Documenten/UploadBestandsdeel/UploadBestandsdeelController.cs
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,14 @@ | ||
using Microsoft.AspNetCore.Mvc; | ||
|
||
namespace ODPC.Features.Documenten.UploadBestandsdeel | ||
{ | ||
[ApiController] | ||
public class UploadBestandsdeelController : ControllerBase | ||
{ | ||
[HttpPut("api/v1/documenten/{uuid:guid}/bestandsdelen/{volgnummer:int}")] | ||
public IActionResult Put(Guid uuid, int volgnummer) | ||
{ | ||
return NoContent(); | ||
} | ||
} | ||
} |
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 @@ | ||
namespace ODPC.Features.Formats | ||
{ | ||
public class Format | ||
{ | ||
public required string Identifier { get; set; } | ||
public required string Name { get; set; } | ||
public required string MimeType { get; set; } | ||
} | ||
} |
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 @@ | ||
namespace ODPC.Features.Formats | ||
{ | ||
public static class FormatsMock | ||
{ | ||
public static readonly Dictionary<string, Format> Formats = new Format[] | ||
{ | ||
new() { Name = "7z", MimeType = "application/x-7z-compressed", Identifier = "a81129a3-ec70-40f3-8eb6-fc94e97ef865" }, | ||
new() { Name = "CSV", MimeType = "text/csv", Identifier = "6bdd2631-b5d5-472a-b336-9cc643822f0a" }, | ||
new() { Name = "Excel XLS", MimeType = "application/vnd.ms-excel", Identifier = "822928f7-73f0-45d3-b1a0-4f3a3dbc361a" }, | ||
new() { Name = "Excel XLSX", MimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", Identifier = "fd16ded8-f013-4ca7-ba21-ee3ca36a6054" }, | ||
new() { Name = "HTML", MimeType = "text/html", Identifier = "bf16a8af-f40b-4e36-96e3-0bdd5d6f5316" }, | ||
new() { Name = "ODF", MimeType = "application/vnd.oasis.opendocument.formula", Identifier = "26a3df9c-290c-40a4-98cb-387842816698" }, | ||
new() { Name = "ODP", MimeType = "application/vnd.oasis.opendocument.presentation", Identifier = "8b31aa20-d284-4540-aca4-222e1394c1d5" }, | ||
new() { Name = "ODS", MimeType = "application/vnd.oasis.opendocument.spreadsheet", Identifier = "837abc18-616f-4e82-945b-fe78ab939860" }, | ||
new() { Name = "ODT", MimeType = "application/vnd.oasis.opendocument.text", Identifier = "53b7d662-4413-4901-a3a4-6c129fcb93c1" }, | ||
new() { Name = "PDF", MimeType = "application/pdf", Identifier = "a8836b30-8b25-4af6-9b35-e68e4f644c59" }, | ||
new() { Name = "TXT", MimeType = "text/plain", Identifier = "549c6a31-6274-4b51-8528-fa9de141681e" }, | ||
new() { Name = "PPSX", MimeType = "application/vnd.openxmlformats-officedocument.presentationml.slideshow", Identifier = "ff7cf4ad-372f-4996-b6af-5bf8c5b178d8" }, | ||
new() { Name = "PPT", MimeType = "application/vnd.ms-powerpoint", Identifier = "580e3592-c5b2-40d0-ab7a-0c626c8e171a" }, | ||
new() { Name = "PPTX", MimeType = "application/vnd.openxmlformats-officedocument.presentationml.presentation", Identifier = "fc188a40-f0bf-415f-a339-fd7520b531f8" }, | ||
new() { Name = "PPS", MimeType = "application/vnd.ms-powerpoint.slideshow.macroEnabled.12", Identifier = "65298a3a-346d-4614-9fee-028f532ed8bc" }, | ||
new() { Name = "RTF", MimeType = "application/rtf", Identifier = "63026476-5d40-424e-a113-b02ed7fba760" }, | ||
new() { Name = "DOC", MimeType = "application/msword", Identifier = "26ccc5e3-acf2-4251-9618-46321e2b9d36" }, | ||
new() { Name = "DOCX", MimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document", Identifier = "ae0ea877-3207-4a97-b5df-bf552bc9b895" }, | ||
new() { Name = "ZIP", MimeType = "application/zip", Identifier = "f879f55e-a9c2-4779-96b2-288d6359d86b" } | ||
}.ToDictionary(x => x.Identifier); | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
ODPC.Server/Features/Formats/FormatsOverzicht/FormatsOverzichtController.cs
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,14 @@ | ||
using Microsoft.AspNetCore.Mvc; | ||
|
||
namespace ODPC.Features.Formats.FormatsOverzicht | ||
{ | ||
[ApiController] | ||
public class FormatsOverzichtController : ControllerBase | ||
{ | ||
[HttpGet("/api/v1/formats")] | ||
public IActionResult Get() | ||
{ | ||
return Ok(FormatsMock.Formats.Values.OrderBy(x => x.Name)); | ||
} | ||
} | ||
} |