general update

This commit is contained in:
remy 2020-04-29 15:23:38 +02:00
parent 9a5f918d76
commit e3e85425e3
5 changed files with 82 additions and 0 deletions

View File

@ -1,2 +1,24 @@
# to do
Recupérer le isbn
Valider la chaine de caractere au format
lancer la requete sur le service
prioriser l'ordre des services
Mapping général pour lier plusieurs service
Stocker les résultats sous forme de carte
Avoir un uuid pour livre physisque
dédoublon a l'ajout
interface graphique
# library
ISBN :International Standard Book Number
ISBN13 = <xxx>&<ISBN10>
## Data Source
###BNF
http://catalogue.bnf.fr/api/test.do

15
shard.yml Normal file
View File

@ -0,0 +1,15 @@
name: library
version: 0.0.1
dependencies:
dodb:
git: https://git.baguette.netlib.re/Baguette/dodb.cr
branch: master
targets:
library:
main: src/main.cr

View File

@ -2,6 +2,13 @@ require "json"
# This will check if the ISBN is valid
# https://en.wikipedia.org/wiki/International_Standard_Book_Number#Check_digits
# get data from inventaire.io
url = "https://inventaire.io/api/entities?action=by-uris&uris=isbn%3A#{isbn}&refresh=false"
a = "978-0-306-40615"
b = "12-31231 23.1aa"
c = "0-306-406v155"

15
src/storage.cr Normal file
View File

@ -0,0 +1,15 @@
require "json"
require "uuid"
require "uuid/json"
require "dodb"
require "./storage/*"
class Library::Storage
getter books : DODB::DataBase(Book)
def initialize(@root : String)
@books = DODB::DataBase(Book).new "#{@root}/books"
end
end

23
src/storage/book.cr Normal file
View File

@ -0,0 +1,23 @@
require "json"
require "uuid"
require "uuid/json"
class Library::Book
property id : UUID
property title : String
property description : String?
property added_time : Time
property image_url : String?
property authors : Array(String)
def initialize(
@title ,
@added_time = Time.local
@id = UUID.random
@image_url = nil,
@description = nil
)
end
end