general update
parent
9a5f918d76
commit
e3e85425e3
22
README.md
22
README.md
|
@ -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
|
# library
|
||||||
|
|
||||||
|
ISBN :International Standard Book Number
|
||||||
|
|
||||||
|
ISBN13 = <xxx>&<ISBN10>
|
||||||
|
|
||||||
|
## Data Source
|
||||||
|
###BNF
|
||||||
|
http://catalogue.bnf.fr/api/test.do
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,13 @@ require "json"
|
||||||
# This will check if the ISBN is valid
|
# This will check if the ISBN is valid
|
||||||
# https://en.wikipedia.org/wiki/International_Standard_Book_Number#Check_digits
|
# 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"
|
a = "978-0-306-40615"
|
||||||
b = "12-31231 23.1aa"
|
b = "12-31231 23.1aa"
|
||||||
c = "0-306-406v155"
|
c = "0-306-406v155"
|
||||||
|
|
|
@ -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
|
|
@ -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
|
Loading…
Reference in New Issue