Skip to content

Commit

Permalink
lowercase pages
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefan Wilke committed Nov 24, 2023
1 parent cfd7115 commit d0be571
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,49 +7,47 @@

import java.time.LocalDateTime;

public record CreateCmd(
@Size(max = 255)
String title,
@NotNull
@NotBlank
@Size(min = 5, max = 4096)
String content,
Boolean isEncrypted,
ExpirationRange expiry,
Exposure exposure
) {
public final class CreateCmd {
@Size(max = 255)
private final String title;
@NotNull
@NotBlank
@Size(min = 5, max = 4096)
private final String content;
private final Boolean isEncrypted;
private final ExpirationRange expiry;
private final Exposure exposure;

public CreateCmd(
final String title,
final String content,
final Boolean isEncrypted,
final ExpirationRange expiry,
final Exposure exposure
) {
this.title = title;
this.content = content;
this.isEncrypted = isEncrypted;
this.expiry = expiry;
this.exposure = exposure;
}

@Override
public String title() {
return StringUtils.hasText(title)
? title.strip()
: null;
}

@Override
public String content() {
return StringUtils.hasText(content)
? content
: null;
}

@Override
public Boolean isEncrypted() {
public boolean isEncrypted() {
return isEncrypted != null && isEncrypted;
}

@Override
@Deprecated
public Exposure exposure() {
throw new UnsupportedOperationException();
}

@Override
@Deprecated
public ExpirationRange expiry() {
throw new UnsupportedOperationException();
}

public LocalDateTime dateOfExpiry() {
return expiry == null
? ExpirationRange.ONE_DAY.toTimestamp() // default expiry if not set
Expand Down Expand Up @@ -114,5 +112,4 @@ public LocalDateTime toTimestamp() {

public abstract LocalDateTime toTimestamp();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ public class Paste {
@SuppressWarnings({"unused", "FieldCanBeLocal"})
@Column(PasteSchema.DATE_DELETED)
private LocalDateTime dateDeleted;
@SuppressWarnings({"unused", "FieldCanBeLocal"})
@Column(PasteSchema.REMOTE_ADDRESS)
private String remoteAddress;

Expand Down
6 changes: 3 additions & 3 deletions frontend/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import styles from './App.module.css';
import Footer from './components/Footer/Footer';
import Header from './components/Header/Header';
import RecentPastes from './components/RecentPastes/RecentPastes';
import Create from './pages/Create';
import Search from './pages/Search';
import Create from './pages/create';
import Search from './pages/search';

const Read = lazy(() => import('./pages/Read'));
const Read = lazy(() => import('./pages/read'));
const NotFound = lazy(() => import('./pages/404'));

const App: () => JSX.Element = () => {
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/CreatePaste/CreatePaste.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const CreatePaste: Component<CreatePasteProps> = ({onCreatePaste, initialPaste})
[fieldName]: inputElement.value
});
}
};
}

function resetCreatePaste() {
setForm({
Expand Down Expand Up @@ -106,7 +106,7 @@ const CreatePaste: Component<CreatePasteProps> = ({onCreatePaste, initialPaste})
resetCreateForm();
setLastPasteUrl(url);
})
.catch(e => submitInput.style.backgroundColor = 'red');
.catch(_ => submitInput.style.backgroundColor = 'red');
}

return (
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Spinner from '../components/Spinner/Spinner';

const Search: () => JSX.Element = () => {

const [searchTerm, setSearchTerm] = useSearchParams<{q: string}>();
const [searchTerm, setSearchTerm] = useSearchParams();

const [pastes] = createResource(
effectiveTerm,
Expand All @@ -18,7 +18,7 @@ const Search: () => JSX.Element = () => {
return (searchTerm.q && searchTerm.q.length >= 3) ? searchTerm.q : null;
}

function onSearchEnter(term: String) {
function onSearchEnter(term: string) {
setSearchTerm({q: term})
}

Expand Down

0 comments on commit d0be571

Please sign in to comment.